From 7d47e3b776968cac3fe21ee8a479cae97d44e699 Mon Sep 17 00:00:00 2001 From: rovle Date: Wed, 4 Mar 2026 22:43:42 -0800 Subject: [PATCH 1/2] fix: pass stable task_id in CLI and gateway to preserve sandbox state across turns Signed-off-by: rovle --- cli.py | 1 + gateway/run.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index 6c05b6b1e..0389eed5a 100755 --- a/cli.py +++ b/cli.py @@ -2157,6 +2157,7 @@ class HermesCLI: result = self.agent.run_conversation( user_message=message, conversation_history=self.conversation_history[:-1], # Exclude the message we just added + task_id=self.session_id, ) # Start agent in background thread diff --git a/gateway/run.py b/gateway/run.py index 617f71ade..fa6ada0fc 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -2131,7 +2131,7 @@ class GatewayRunner: if _p: _history_media_paths.add(_p) - result = agent.run_conversation(message, conversation_history=agent_history) + result = agent.run_conversation(message, conversation_history=agent_history, task_id=session_id) result_holder[0] = result # Return final response, or a message if something went wrong From ca33372595614e65ac84c16700d9703a9aa62595 Mon Sep 17 00:00:00 2001 From: rovle Date: Wed, 4 Mar 2026 23:39:55 -0800 Subject: [PATCH 2/2] fix: pass task_id to _create_environment as well, to prevent cross-session state mixing Signed-off-by: rovle --- tools/file_tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/file_tools.py b/tools/file_tools.py index 6182630b0..a864f4392 100644 --- a/tools/file_tools.py +++ b/tools/file_tools.py @@ -95,6 +95,7 @@ def _get_file_ops(task_id: str = "default") -> ShellFileOperations: cwd=cwd, timeout=config["timeout"], container_config=container_config, + task_id=task_id, ) with _env_lock: