listTmuxWindows mixes stderr into the window list and cannot see a non-zero exit #178
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lz/agent-nexus#178
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while auditing the fleet-status spec, and verified by reading
nexus/src/lib/server/sessions/service.ts.Two defects in one helper
listTmuxWindows(service.ts:1356) runstmux list-windows -t nexus -F '#W'withAttachStderr: true, collects the stream, and hands it tostripFraming. It never callsexec.inspect().stripFraming(service.ts:1377) tests only the first frame's stream byte:So:
inspect(), a non-zero exit is invisible.tmux list-windowsagainst a dead server writesno server running on …to stderr and exits 1 — which arrives as a non-empty set containing that sentence.Why it matters
convergeSessionsconsumes this set to decide whether a session's tmux window is missing, and a missing window with a surviving worktree triggers a relaunch. Today a failed listing therefore reads as "every window is missing" rather than as "we could not look" — the opposite of the rule fact #15 states for the sibling worktree listing, where uncertainty never triggers deletion.It gets worse under the fleet status layer, where this listing becomes an input to a store that other subsystems read as truth. Fix it before then — seeding a new source of truth from a read that cannot report failure is the worst possible order.
Fix
Route it through
execAndCapture, which already separates the streams and inspects the exit code. Zero test churn is expected:makeConvergeDocker's fake already exposes exactly the two methodsexecAndCapturedrives.Two guard tests, each of which must be shown to fail against the current implementation before the fix lands:
Scope note
stripFramingmay have other callers — check before deleting it rather than assuming this is the only one.