Merge PR #419: fix: pass stable task_id in CLI and gateway to preserve sandbox state across turns
Authored by rovle. Passes session_id as task_id to run_conversation() in both CLI and gateway, so container backends (Docker/Modal/Singularity) reuse the same sandbox across turns. Also passes task_id through to _create_environment() in file_tools.py. Cherry-picked from original PR branch (which had unrelated divergent commits from the contributor's fork).
This commit is contained in:
1
cli.py
1
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user