Skip to content

The agent that grows with you

test(desktop): boot-lifecycle teardown interrupts the live turn it leaves running

Teknium81d936ab4f40
diff --git a/apps/desktop/e2e/core/boot-lifecycle.spec.ts b/apps/desktop/e2e/core/boot-lifecycle.spec.ts
index cd78aa578bc..07a178db949 100644
--- a/apps/desktop/e2e/core/boot-lifecycle.spec.ts
+++ b/apps/desktop/e2e/core/boot-lifecycle.spec.ts
@@ -170,7 +170,8 @@ test('boot handshake, supervised respawn, and zero orphans on quit', async () =>
hold.open()
// Teardown on request: the CLI stop takes the daemon and its tool child down.
- const stopped = stopSandboxGateway(sandbox)
+ // The turn is still live, so the stop must be told to interrupt it.
+ const stopped = stopSandboxGateway(sandbox, { interrupt: true })
expect(stopped.code, stopped.output).toBe(0)
await expect
.poll(
diff --git a/apps/desktop/e2e/core/harness.ts b/apps/desktop/e2e/core/harness.ts
index 7e2a4b6b8cf..cf4df23c434 100644
--- a/apps/desktop/e2e/core/harness.ts
+++ b/apps/desktop/e2e/core/harness.ts
@@ -305,13 +305,20 @@ export function backendProcesses(sandbox: CoreSandbox): ProcInfo[] {
* `hermes gateway stop` for the sandbox profile, run with the backend's own
* interpreter (argv[0] of the live `gateway run`). Attach-mode Desktop never
* owns the gateway, so this is how a test proves teardown works when asked.
+ * `interrupt` passes `--yes`: stop refuses while a turn is live unless told to
+ * interrupt it.
*/
-export function stopSandboxGateway(sandbox: CoreSandbox): { code: number | null; output: string } {
+export function stopSandboxGateway(
+ sandbox: CoreSandbox,
+ { interrupt = false }: { interrupt?: boolean } = {}
+): { code: number | null; output: string } {
const [backend] = backendProcesses(sandbox)
// argv[0], unquoted (a Windows command line quotes a path with spaces).
const python = /^"([^"]+)"|^(\S+)/.exec(backend?.cmdline ?? '')?.slice(1).find(Boolean) || 'python3'
- const result = spawnSync(python, ['-m', 'hermes_cli.main', 'gateway', 'stop'], {
+ const args = ['-m', 'hermes_cli.main', 'gateway', 'stop', ...(interrupt ? ['--yes'] : [])]
+
+ const result = spawnSync(python, args, {
cwd: REPO_ROOT,
env: coreAppEnv(sandbox),
encoding: 'utf8',