Local Sessions Can Reuse a Previous Remote Terminal/File Backend

Bug tracker — July 11, 2026. Hermes bug #62720 exposes a session-state isolation failure: ordinary sessions can collapse to cache key default and reuse an active environment from an earlier session without checking backend or profile compatibility. A local session may execute terminal/file operations on a stale SSH host, and subagents inherit the same environment.

The Failure in One Sentence

Hermes treats distinct sessions as interchangeable when their cache key resolves to default. If a prior session left an SSH or remote terminal/file backend active, a later local session can silently inherit it. Commands then run on the wrong host or against the wrong filesystem, turning session reuse into a potential isolation breach.

How Backend Reuse Goes Wrong

Expected SessionObserved RiskRequired Guard
New local sessionReuses stale SSH/remote environmentInclude backend, host, profile, and session identity in cache key
Terminal/file toolsCommands target a prior host or pathValidate backend compatibility before every reuse
Subagent executionInherited environment amplifies the wrong-host scopePropagate explicit backend identity and reject mismatch

Why This Is More Than a Convenience Bug

Wrong-host execution is a correctness and security concern. A user may believe a command inspected local files while it actually touched a remote machine. The resulting path confusion can leak data, modify the wrong environment, or make a destructive action appear to have happened somewhere else. Long-lived processes make the stale state harder to see because the failure depends on session history.

Recommended Fix Path

  1. Replace the generic default cache key with a key containing session identity and backend/profile compatibility.
  2. Validate host, filesystem root, transport, and tool capability before reusing an environment.
  3. Fail closed when a local request resolves to a remote backend or when profile metadata is missing.
  4. Add regression tests covering sequential local/remote sessions and subagent inheritance in one long-lived process.

Why This Matters for Review-Site Readers

Local-versus-managed comparisons often focus on speed and features, but isolation is a first-order trust property. Buyers should ask whether a platform can prove where a terminal or file operation ran, especially after multiple sessions and when subagents are involved.

Case Summary

Source URL: https://github.com/NousResearch/hermes-agent/issues/62720