Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
test(tmux): the guard kills its own session, not the sandbox's server
enes1ac81619592b
diff --git a/CLAUDE.md b/CLAUDE.mdindex 28cd704d6..c114dd019 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -2870,6 +2870,13 @@ hardcode `-L nodeterm-rmt`; re-spelling it would judge different bytes) andthe one file that reached the live server by construction — measured, not inferred — and it nowrefuses to start unless the sandbox is in effect.+**What the sandbox does NOT do:** two suites naming the same socket inside it still share one tmux+server, so a `kill-server` there is still a shared-server kill — it has just been moved somewhere+harmless. Measured on CI the day this landed: the guard test's own `kill-server` on+`node-terminal` ended `host-destroy-tmux.test.ts`'s session mid-assertion. A suite kills its OWN+sessions by exact target (`-t =<name>`, since a miss falls through to prefix matching), or it owns+a socket name nothing else uses.+The guard has three legs on purpose, and the weakest one is the scan: a test can still escape byhanding a real tmux an `env` object it built from scratch with no `TMUX_TMPDIR` in it, which noregex sees. So the structural leg is the sandbox, the behavioural leg actually **starts a server ondiff --git a/src/core/tmux-socket-isolation.guard.test.ts b/src/core/tmux-socket-isolation.guard.test.tsindex a8ab0e08c..7f048f93e 100644--- a/src/core/tmux-socket-isolation.guard.test.ts+++ b/src/core/tmux-socket-isolation.guard.test.ts@@ -63,15 +63,23 @@ describe('the run cannot reach a live nodeterm tmux server', () => {'binds the REAL socket name inside the sandbox — measured, not inferred from the env',() => {const sandbox = process.env[SANDBOX_ENV]!+ // Its OWN session, killed by exact target. NOT `kill-server`: inside the sandbox this socket+ // name is shared with `main/remote/host-destroy-tmux.test.ts`, which binds it too (it has no+ // choice — `PtyManager` hardcodes the name), and killing the server took that suite's session+ // out from under it on CI. The sandbox moves the shared server somewhere harmless; it does+ // not stop a `kill-server` from being a SHARED-server kill once you are in there.+ const session = `nt-isolation-guard-${process.pid}`const tmux = (args: string[]): void => {execFileSync('tmux', ['-L', TMUX_SOCKET, ...args], { stdio: 'ignore' })}try {- tmux(['new-session', '-d', '-s', 'nt-isolation-guard', 'sleep', '30'])+ tmux(['new-session', '-d', '-s', session, 'sleep', '30'])expect(existsSync(tmuxSocketPath(sandbox, UID, TMUX_SOCKET))).toBe(true)} finally {try {- tmux(['kill-server'])+ // `=` is an exact match: without it tmux falls back to fnmatch and then to PREFIX+ // matching, so a miss could kill somebody else's session.+ tmux(['kill-session', '-t', `=${session}`])} catch {/* never started */}diff --git a/test/setup/tmux-sandbox.ts b/test/setup/tmux-sandbox.tsindex dd1a8eaa1..4f598e56d 100644--- a/test/setup/tmux-sandbox.ts+++ b/test/setup/tmux-sandbox.ts@@ -18,6 +18,12 @@// The sandbox is per RUN, not per file: `setup` creates it in the main process (so the workers// inherit the variable), `teardown` kills whatever is still bound inside it and removes it. Suites// that make their OWN private `TMUX_TMPDIR` are unaffected — this is the floor, not an override.+//+// WHAT IT DOES NOT DO: two suites naming the same socket inside the sandbox still share one tmux+// server, so a `kill-server` there is still a shared-server kill — it has just been moved somewhere+// harmless. Measured on CI the day this landed: the guard test's `kill-server` on `node-terminal`+// ended `host-destroy-tmux.test.ts`'s session mid-assertion. A suite kills its OWN sessions by+// exact target (`-t =<name>`), or it owns a socket name nothing else uses.import { execFileSync } from 'child_process'import fs from 'fs'import path from 'path'