NousResearch/hermes-agent

Terminal sandbox persistence across conversation turns

Cluster 6369. Data as of

Nothing open on GitHub. Fix merged in #6412 on 9 Apr 2026. Check it covers your case.

The short answer

0open issues
0open PRs
3items grouped
Known?
Yes. 3 related items grouped here, 1 issue already closed.
Fix event
A fix was merged to main in PR #6412. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this resolved, deciding PR #6412. That is separate from the fix event.
Still open
Nothing open on GitHub.

These issues and PRs concern persistent terminal sandboxes (docker/daytona/modal) being torn down between turns despite configuration indicating they should survive. A fix is proposed to make sandbox environments persist across turns as intended.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

  • #6412 fix(terminal): persistent sandbox envs survive between turns

    merged to main

    files: run_agent.py, tools/terminal_tool.py

    Show the diff
    • run_agent.py
      @@ -66,7 +66,7 @@
           handle_function_call,
           check_toolset_requirements,
       )
      -from tools.terminal_tool import cleanup_vm, get_active_env
      +from tools.terminal_tool import cleanup_vm, get_active_env, is_persistent_env
       from tools.tool_result_storage import maybe_persist_tool_result, enforce_turn_budget
       from tools.interrupt import set_interrupt as _set_interrupt
       from tools.browser_tool import cleanup_browser
      @@ -1687,9 +1687,25 @@ def _extract_reasoning(self, assistant_message) -> Optional[str]:
               return None
       
           def _cleanup_task_resources(self, task_id: str) -> None:
      -        """Clean up VM and browser resources for a given task."""
      +        """Clean up VM and browser resources for a given task.
      +
      +        Skips ``cleanup_vm`` when the active terminal environment is marked
      +        persistent (``persistent_filesystem=True``) so that long-lived sandbox
      +        containers survive between turns. The idle reaper in
      +        ``terminal_tool._cleanup_inactive_envs`` still tears them down once
      +        ``terminal.lifetime_seconds`` is exceeded. Non-persistent backends are
      +        torn down per-turn as before to prevent resource leakage (the original
      +        intent of this hook for the Morph backend, see commit fbd3a2fd).
      +        """
               try:
      -            cleanup_vm(task_id)
      +            if is_persistent_env(task_id):
      +                if self.verbose_logging:
      +                    logging.debug(
      +                        f"Skipping per-turn cleanup_vm for persistent env {task_id}; "
      +                        f"idle reaper will handle it."
      +                    )
      +            else:
      +                cleanup_vm(task_id)
               except Exception as e:
                   if self.verbose_logging:
                       logging.warning(f"Failed to cleanup VM for task {task_id}: {e}")
    • tools/terminal_tool.py
      @@ -814,6 +814,23 @@ def get_active_env(task_id: str):
               return _active_environments.get(task_id)
       
       
      +def is_persistent_env(task_id: str) -> bool:
      +    """Return True if the active environment for task_id is configured for
      +    cross-turn persistence (``persistent_filesystem=True``).
      +
      +    Used by the agent loop to skip per-turn teardown for backends whose whole
      +    point is to survive between turns (docker with ``container_persistent``,
      +    daytona, modal, etc.). Non-persistent backends (e.g. Morph) still get torn
      +    down at end-of-turn to prevent leakage. The idle reaper
      +    (``_cleanup_inactive_envs``) handles persistent envs once they exceed
      +    ``terminal.lifetime_seconds``.
      +    """
      +    env = get_active_env(task_id)
      +    if env is None:
      +        return False
      +    return bool(getattr(env, "_persistent", False))
      +
      +
       def get_active_environments_info() -> Dict[str, Any]:
           """Get information about currently active environments."""
           info = {

1 PR closed without merging

From the close comments: merged via another change 1

  • #6370 fix(terminal): persistent sandbox envs survive between turns · merged via another change → #6412
Closed issues · 1
  • Closed#6369Persistent terminal sandboxes (docker/daytona/modal) are torn down every turn, contradicting `terminal.lifetime_seconds`
How this cluster was grouped
  • Link evidence (structural links throughout): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
  • Pairwise link density 0.67: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. 1.00 means every pair is linked.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Merged PRs
#6412
Closed issues
1
Attempts
1 PR closed without merging
Fix link checked
9 Apr 2026. This confirmation is old and may be out of date (a revert or reopen would not have invalidated it here); re-verify.

For your agent

The same facts, typed.