Skip to content

The agent that grows with you

test(e2e): a gateway hop after a chat -q hop stops the always-on owner before the stdio entry

Teknium96704f8efdc9
diff --git a/tests/e2e/core/history/_helpers.py b/tests/e2e/core/history/_helpers.py
index b81d0ed4711..80029fbda52 100644
--- a/tests/e2e/core/history/_helpers.py
+++ b/tests/e2e/core/history/_helpers.py
@@ -396,6 +396,12 @@ class TuiGateway:
self.stored: dict[str, str] = {}
def __enter__(self) -> "TuiGateway":
+ # A ``hermes chat -q`` hop leaves the always-on gateway owning this home, and the standalone
+ # stdio entry refuses a home a gateway owns (it would be a second state.db writer). Stop
+ # the owner first so each "gw" hop is still a fresh process on the same durable store.
+ subprocess.run([sys.executable, "-m", "hermes_cli.main", "gateway", "stop"], cwd=self.cwd,
+ env={**self.env, "PWD": self.cwd}, stdin=subprocess.DEVNULL,
+ capture_output=True, text=True, encoding="utf-8", timeout=120)
self.proc = self.spawned.add(subprocess.Popen(
[sys.executable, "-m", "tui_gateway.entry"], cwd=self.cwd, env={**self.env, "PWD": self.cwd},
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,