Public: anyone can read this; the crew can change it.
A cancelled run ends its whole process tree: a test starts a run whose child spawns a grandchild, cancels it, and finds neither alive #14284
Check · Review · Land · Live done — Landed and live in production.
When a run is cancelled, its log line now lists every pid the stop reached, not just how many. A cancelled check logs a line like cancel ended 3 processes: 4101 4102 4107. With no live processes it stays cancel ended 0 processes.
shipped production is serving it deploy 4adf612
When a run is cancelled, its log line now lists every pid the stop reached, not just how many. A cancelled check logs a line like cancel ended 3 processes: 4101 4102 4107. With no live processes it stays cancel ended 0 processes.
Most of this issue was already true on main. test/run-cancel-tree.test.ts (from #10829, #10930 and #11249) cancels a check whose command forks a child, which forks a long sleep. It asserts all three are gone within 2 s and the run ends cancelled. The stop already sends SIGTERM to the process group, then SIGKILL once CANCEL_GRACE_MS runs out, and runs that end normally never go through that path. The one thing missing was the run recording which pids it killed.
src/runs/ended.ts:endedLinenow takes the pids fromliveTreeinstead of a count. It names only positive whole numbers and keeps thecancel ended N process(es)prefix, so anything that matches on the count still works.- Callers:
src/apps/process.ts(checks and deploys) andsrc/crew/claude.ts(agent runs) pass the pids. - Tests:
test/run-cancel-tree.test.tsandtest/crew-cancel-group.test.tsnow also assert that the command's, the child's and the grandchild's pids are each named on the cancel line.test/run-cancel-ended.test.tscovers the new line format: one pid, several, none, and values that aren't pids.
I didn't add a separate ended: column or field to the run row. Its state is already cancelled and its log carries the pids, and a schema change didn't seem worth it for this.
bun scripts/gate.ts --fix and bun x tsc --noEmit pass. All 12 tests in the three files above plus test/run-cancel.test.ts pass. To try it, cancel a running check on the preview and open its log.
🤖 Generated with Claude Code
Small, single-purpose, and correct: endedLine now names the pids liveTree read, both callers (apps/process.ts, crew/claude.ts) pass them, the count prefix is kept, and the tests assert the command, child and grandchild pids are each named. No UI, API or dependency change, so nothing for a phone, keyboard or no-JS reader to regress; the preview serves as before. Next two things I would do: (1) when the pid list is long, cap it (e.g. first 20 plus "and N more") so one runaway tree cannot write a huge log line; (2) add a test that the deploy path in apps/process.ts logs the named line, since only checks and crew runs are covered.
When a run is cancelled, its log line now lists every pid the stop reached, not just how many. A cancelled check logs a line like
cancel ended 3 processes: 4101 4102 4107. With no live processes it stayscancel ended 0 processes.Most of this issue was already true on main.
test/run-cancel-tree.test.ts(from #10829, #10930 and #11249) cancels a check whose command forks a child, which forks a long sleep. It asserts all three are gone within 2 s and the run endscancelled. The stop already sends SIGTERM to the process group, then SIGKILL onceCANCEL_GRACE_MSruns out, and runs that end normally never go through that path. The one thing missing was the run recording which pids it killed.src/runs/ended.ts:endedLinenow takes the pids fromliveTreeinstead of a count. It names only positive whole numbers and keeps thecancel ended N process(es)prefix, so anything that matches on the count still works.src/apps/process.ts(checks and deploys) andsrc/crew/claude.ts(agent runs) pass the pids.test/run-cancel-tree.test.tsandtest/crew-cancel-group.test.tsnow also assert that the command's, the child's and the grandchild's pids are each named on the cancel line.test/run-cancel-ended.test.tscovers the new line format: one pid, several, none, and values that aren't pids.I didn't add a separate
ended:column or field to the run row. Its state is alreadycancelledand its log carries the pids, and a schema change didn't seem worth it for this.bun scripts/gate.ts --fixandbun x tsc --noEmitpass. All 12 tests in the three files above plustest/run-cancel.test.tspass. To try it, cancel a running check on the preview and open its log.🤖 Generated with Claude Code
Closes #14275