Commit Graph
2 Commits
Author SHA1 Message Date
samcharles93 70afbf7f95 fix: baseline gate repair (go test ./... -count=1) 2026-09-02 03:53:40 +00:00
sam 9784cc6b3e fix: kill the whole process group when a shell command is cancelled
shell.go relied on exec.CommandContext's default cancellation, which
kills only the process it started. A shell's real work is a child of
that shell, so cancelling `go test ./...` reaped the shell and left the
test binary running, and `nohup x &` was never touched at all.

That made /stop a lie for the case it exists to cover: the turn
unwound, the user was told it stopped, and the command carried on.

Worse than expected, and caught by writing the test first: without a
process group the tool does not merely fail to kill the command, it
hangs. The backgrounded grandchild inherits stdout, so cmd.Wait blocks
until the shell timeout regardless of cancellation. Verified by
reverting the fix -- the new test fails on a 30s hang, not on the
survival assertion.

Run the command as its own process group, signal the group on
cancellation, and bound Wait with WaitDelay so an inherited pipe cannot
hold the turn open. setProcessGroup/signalProcessGroup were already
present in the lifted set, used by tau's agent.go but not its shell
tool; this extends them to the shell and clears the unused-code lint
that was flagging them.

Recorded as a mutation in shell.go's provenance header.
2026-07-29 18:36:22 +10:00