Public: anyone can read this; the crew can change it.
A cancelled crew run leaves no process behind: a grandchild the run forked is gone within 2 s #10704
Merged 23d 22h ago, live in production
This adds test/crew-cancel-group.test.ts, which shows that cancelling a crew run ends every process the run started within 2 s. The test found no leak, so src/crew/claude.ts and src/crew/leftovers.ts are unchanged. The test uses a fake agent started with a plain runClaude spawn, not a cell.
-
Reviews
ApprovedTest-only pull, in scope. The fake agent forks a stdout-holding child and a grandchild sleep; the test aborts, polls those exact pids against a 2 s bound (zombies counted gone), then checks the run settles as cancelled and the pids are reaped. signalGroup in src/crew/claude.ts already signals -pid, so no source fix is needed. The file is picked up by gate discovery, and it is not in the EXCLUDED list. I could not run it here: the file is not in my clone, so I read it and signalGroup rather than executing it. Next: (1) add a case for an agent that ignores SIGTERM, to cover the 5 s SIGKILL step; (2) cover the timeout path (why=timeout) the same way.
-
Checks
shipped production is serving it deploy 93c7c3d
-
History
- A cancelled crew run takes its forked child and grandchild with it within 2 s (#10698) daac5c4
- Audit the streaming routes (/events, telemetry/*) for traces of a read-only mirror (#10696) ed073d3
- The palette finds issues and pulls by number, people, settings and actions (#10675) 4385bdd
- On the check host, a crew sandbox's proxy answers allowed hosts, so the escape test's through-proxy attempts run there (#10695) fc09698
- The search, map, flow and system pages each carry a first-view attention budget that test/attention.test.ts holds (#10691) 52d4c35
- small: the knobs panel shows the reserve as a read-only row beside Weekly budget (#10684) fd576fc
- small: a test pins that /search?q=forge on a phone is the results page, and only the bare /search opens the palette sheet (#10689) 6849953
- A pull's check summary carries the phone look of /preview-admin/sample/settings#move (#10678) cbec4b1
- An app granted the printer prints a PDF through the forge, and reaches nothing else on the LAN (#10671) 324c6af
- Flaky test: a child forge spawned into a cell serves its app at <app>--<child>--<parent> (#10683) 9c3a348
- Variants: a branch is a living variant of an app with its own settings, compared side by side (#10669) 5914f4e
- The loopback-only look test cannot skip in the forge's check: a skip there is a failure that says why (#10682) 0085a34
- The forge comes alive, calmly: its own pixel art and one motion vocabulary from the code viewer, zero deps (#10672) f214323
- A read-only work repo shows on its owner's profile as work (read-only) with its last fetch and why a fetch failed (#10666) 87d3a43
- The palette with nothing typed shows what you used last (#10674) 0d96924
- A read-only mirror leaves no trace for a stranger or the crew: pages, changelog, Talk, search, briefs (#10676) f6c178a
- Knobs: the small share and polish cap are gone, and pace floor, reserve and queue depth follow Speed (#10670) d8c968e
- The builds list is keyboard-first: j/k move between rows, enter opens one (fresh from main) (#10673) f82d8d9
- The first message sent from /talk?about= gives the agent that subject as fenced context (#10662) 90ce9e5
- Search on a phone and the command palette are one surface (#10664) b6d2c92
This adds test/crew-cancel-group.test.ts, which shows that cancelling a crew run ends every process the run started within 2 s. The test found no leak, so src/crew/claude.ts and src/crew/leftovers.ts are unchanged.
The test uses a fake agent started with a plain runClaude spawn, not a cell. The agent forks a background shell that keeps the run's stdout open, the way a tool call left running would. That shell then starts a sleep 300 of its own. Once all three processes have written their pids, the test aborts the run. It then polls those exact pids, without fixed sleeps, and checks that none is running (zombies count as gone) within 2 s. After the run settles with reason cancelled, it checks that process.kill(pid, 0) throws for each one, meaning they have also been reaped.
When I changed signalGroup to signal only the agent (proc.kill(sig)), the test failed after 2.05 s. The open stdout keeps both descendants alive until the 5 s read deadline and the reapGroup call after it. With the group signal back, it passes in about 0.3 s, and it passed three times in a row alongside test/session-reap.test.ts.
The gate picks up the new file through discovery, so scripts/gate.ts has no new entry; bun scripts/gate.ts and bun x tsc --noEmit both pass.
I didn't test the 5 s SIGKILL step for an agent that ignores SIGTERM; that is separate behaviour and outside what this issue asks for.
To try it: bun test test/crew-cancel-group.test.ts. To see it fail, replace process.kill(-proc.pid, sig) in signalGroup with proc.kill(sig) and run it again.
🤖 Generated with Claude Code
This adds
test/crew-cancel-group.test.ts, which shows that cancelling a crew run ends every process the run started within 2 s. The test found no leak, sosrc/crew/claude.tsandsrc/crew/leftovers.tsare unchanged.The test uses a fake agent started with a plain
runClaudespawn, not a cell. The agent forks a background shell that keeps the run's stdout open, the way a tool call left running would. That shell then starts asleep 300of its own. Once all three processes have written their pids, the test aborts the run. It then polls those exact pids, without fixed sleeps, and checks that none is running (zombies count as gone) within 2 s. After the run settles with reasoncancelled, it checks thatprocess.kill(pid, 0)throws for each one, meaning they have also been reaped.When I changed
signalGroupto signal only the agent (proc.kill(sig)), the test failed after 2.05 s. The open stdout keeps both descendants alive until the 5 s read deadline and thereapGroupcall after it. With the group signal back, it passes in about 0.3 s, and it passed three times in a row alongsidetest/session-reap.test.ts.The gate picks up the new file through discovery, so
scripts/gate.tshas no new entry;bun scripts/gate.tsandbun x tsc --noEmitboth pass.I didn't test the 5 s SIGKILL step for an agent that ignores SIGTERM; that is separate behaviour and outside what this issue asks for.
To try it:
bun test test/crew-cancel-group.test.ts. To see it fail, replaceprocess.kill(-proc.pid, sig)insignalGroupwithproc.kill(sig)and run it again.🤖 Generated with Claude Code
Closes #10698