fix(tests): stop test_start_parallel_base_index.sh killing the caller's tmux server - #139
Open
laird wants to merge 1 commit into
Open
fix(tests): stop test_start_parallel_base_index.sh killing the caller's tmux server#139laird wants to merge 1 commit into
laird wants to merge 1 commit into
Conversation
…'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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #138.
tests/test_start_parallel_base_index.shsandboxes itself withTMUX_TMPDIRand tears down withtmux kill-server. tmux prefers$TMUXoverTMUX_TMPDIR, so when the test runs from inside a tmux pane — where every agent runs — the sandbox is silently ignored: thekeepaliveandclaude-projsessions land on the caller's real server, and the EXIT trap'skill-serverdestroys 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.confnever applied, because the outer server was already running withoutbase-index 1.Change
unset TMUXsoTMUX_TMPDIRactually sandboxes the run.#{socket_path}and refuse to kill anything outside$TMPROOT.kill-serveris 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
$TMUXshould not be able to cost someone their session again.Verification
Guard decision logic exercised in isolation with
kill-serverstubbed:TMUXinherited, sandbox ignored)REFUSE sock=/tmp/tmux-1037/default outside /tmp/probeA.*WOULD-KILL sock=/tmp/probeB.*/s/tmux-1037/defaultNO-SERVERThen 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 commitin the scratch repo printsAuthor identity unknownon hosts without a global git identity. The test tolerates it and still passes; not touched here.