Skip to content

fix(tests): stop test_start_parallel_base_index.sh killing the caller's tmux server - #139

Open
laird wants to merge 1 commit into
masterfrom
fix/tmux-kill-server-sandbox
Open

fix(tests): stop test_start_parallel_base_index.sh killing the caller's tmux server#139
laird wants to merge 1 commit into
masterfrom
fix/tmux-kill-server-sandbox

Conversation

@laird

@laird laird commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Fixes #138.

tests/test_start_parallel_base_index.sh sandboxes itself with TMUX_TMPDIR and tears down with tmux kill-server. tmux prefers $TMUX over TMUX_TMPDIR, so when the test runs from inside a tmux pane — where every agent runs — the sandbox is silently ignored: the keepalive and claude-proj sessions land on the caller's real server, and the EXIT trap's kill-server destroys it.

This took down a live swarm twice in one afternoon, killing workers holding 2.7G/3.3G/3.4G/5.3G contexts mid-task and orphaning 7 issue claims. It also meant the test was not testing what it claims: $TMPROOT/tmux.conf never applied, because the outer server was already running without base-index 1.

Change

  1. unset TMUX so TMUX_TMPDIR actually sandboxes the run.
  2. Make the teardown defensive — ask the server we would actually reach for its #{socket_path} and refuse to kill anything outside $TMPROOT. kill-server is unrecoverable, so it should not depend on the environment being right.

Point 2 is deliberate belt-and-braces: point 1 alone is the real fix, but a future edit that reintroduces an inherited $TMUX should not be able to cost someone their session again.

Verification

Guard decision logic exercised in isolation with kill-server stubbed:

Case Result
Pre-fix condition (TMUX inherited, sandbox ignored) REFUSE sock=/tmp/tmux-1037/default outside /tmp/probeA.*
Fixed, sandbox server running WOULD-KILL sock=/tmp/probeB.*/s/tmux-1037/default
Fixed, no server yet NO-SERVER

Then the real test: 13 passed / 0 failed, with the surrounding swarm untouched (all 4 panes still on server 435765 afterwards, no leftover /tmp/spbi.*). The manifest assertions reported pane ids %1/%2, confirming a fresh sandbox server rather than the shared one.

Unrelated pre-existing noise in the run: git commit in the scratch repo prints Author identity unknown on hosts without a global git identity. The test tolerates it and still passes; not touched here.

…'s tmux server

The test sandboxes itself with TMUX_TMPDIR and tears down with `tmux
kill-server`. But tmux prefers $TMUX over TMUX_TMPDIR, so when the test runs
from inside a tmux pane -- where every agent runs -- the sandbox is silently
ignored: the keepalive and claude-proj sessions are created on the caller's
real server, and the EXIT trap's kill-server destroys it.

This took down a live swarm twice in one afternoon, killing workers holding
multi-GB contexts mid-task and orphaning their issue claims. It also meant the
test was not testing what it claims: $TMPROOT/tmux.conf never applied, because
the outer server was already running without base-index 1.

Unset TMUX so TMUX_TMPDIR actually sandboxes the run, and make the teardown
defensive -- ask the server we would reach for its socket path and refuse to
kill anything outside $TMPROOT. kill-server is unrecoverable, so it should not
rely on the environment being right.

Verified: the guard refuses in the exact pre-fix condition, kills only the
sandbox socket, and no-ops with no server. Full test 13 passed / 0 failed with
the surrounding swarm untouched.

Fixes #138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests/test_start_parallel_base_index.sh runs tmux kill-server against the caller's real tmux server (TMUX_TMPDIR sandbox is a no-op inside tmux)

1 participant