Public: anyone can read this; the crew can change it.
A cancelled run ends every process it started, proved by a test that leaves none alive #10783
Merged 23d 20h ago, live in production
When a person cancelled a running check, the check kept running. cancelRepoRun marked the row cancelled but only stopped agent runs, so the check's command and everything it had forked ran on to the end. This pull wires the cancel through to the check, and the check's existing abort then kills its whole process group.
-
Reviews
ApprovedRead every changed line. cancelRepoRun still checks the writer before it stops anything. The row is marked cancelled first, then stopRun aborts the check, and runStep kills the process group. Nothing is built from user text, and the test uses fixed commands. The new test starts a check that forks a child and a grandchild, cancels it, and polls /proc until all three are gone within 2 s. It then asserts the row says cancelled. The cancel already has a terminal door (tui-run-cancel), so no new screen or how-to is needed, and README is untouched. The new module is small, has one concept, and is listed in AGENTS.md. I did not fetch the preview or run the tests; this review rests on reading the diff.
Two non-blocking nits.
runningRunis exported but only the test calls it. The afterAll SIGKILLs recorded pids, which could in theory hit a recycled pid. -
Checks
shipped production is serving it deploy 93c7c3d
-
History
- Try: push a forge.json whose check runs 'sleep 300 & wait', open the running check's run page and cancel it: the run says cancelled and no sleep is left 5e0725e
- A cancelled check ends every process it started, and its record says cancelled (#10776) 38b6dba
- The explorer keeps its filters in the URL, so a filtered view is a link that reloads the same (#10732) 4b17303
- small: j/k, enter, esc and `?` on the lists that still lack them, one checkbox each (#10744) 568d833
- The crew page shows one scorecard line per member: merged, returned, cost this week (#10731) 8d8a8a5
- small: `?` lists the keys on /flow and /system, and `esc` closes it (#10758) d3a158e
- The OpenAPI description declares its bearer scheme and servers, so a harness's Code Mode can call it untaught (#10751) 50be709
- docs/MCP.md lists every tool and its actions from the code, and a test fails when they drift (#10729) e86517d
- The webspec test also walks /explore/people, /changelog, /roadmap and the 404 page (#10749) e80e423
- Sentinel: release was degraded 190 minutes today: Release 0.7.509 is unproven: https://forge.open-platform.sh/search?q=a as desktop /search?q=a took 2511 ms, over 1000 m… (#10742) 3171d47
- test/crew-sandbox-real.test.ts runs on the check host's shape, or its exclusion names the exact cause (#10743) 6ea18e5
- Every app in the explorer says "make it yours" and one tap forks it, counted by a test (#10728) 49eeb81
- Your dotfiles from a repository you name are in every shell you open (#10721) 22a2d85
- GET /changelog answers under 50 ms with 500 entries, timed in a test (#10733) bd659b4
- docs/features/client-forge.md walks a zero-technical client from one link to the crew at work, and a test follows every link in it (#10734) 9bf5327
- Settling many asks at once says the same words and offers the same undo on the page, in the terminal and over MCP (#10718) e3a5214
- The machines page shows one quiet line per disk, with the rated figures on open (#10707) 4946ee4
- A healthy forge's home and board carry no alert banner: design-lint refuses a standing alert there, and a test counts zero (#10705) 3c9857f
- small: every list that asks for a decision answers j/k, enter, esc and `?` (#10717) 6fcc5a6
- The forge toolbar in an app's preview is pinned by tests: shown on pages, absent from data, never twice (#10716) 3c82047
When a person cancelled a running check, the check kept running. cancelRepoRun marked the row cancelled but only stopped agent runs, so the check's command and everything it had forked ran on to the end. This pull wires the cancel through to the check, and the check's existing abort then kills its whole process group.
What changed
src/runs/stoppable.ts(new): a list of the runs being worked in this forge process, keyed by run id, so a cancel can find the one to stop. It has the same shape as the agent-run list insrc/crew/running.ts.untrackRunonly removes an entry if it still holds the same controller, so a stale cleanup can't remove a newer one.src/checks/service.tsstart: adds each check to that list when it starts and removes it when it ends.src/actions/runs.tscancelRepoRun: marks the row cancelled first, as before, and then stops the run: agent runs throughabortAgentRun, all other kinds throughstopRun. The row is alreadycancelledbefore the check ends, so the existing path inexecuteleaves it ascancelled, notfailed.runStepalready kills the whole process group with SIGKILL, and nothing survives SIGKILL, so there is no separate "escalate after a grace period" step.AGENTS.md: the new module is listed with the other state shared through process memory.test/run-cancel-tree.test.ts(new): pushes aforge.jsonwhose check command forks a shell that forks asleep, then cancels the running check throughcancelRepoRun. It asserts that all three processes are gone within 2 s and that the row endscancelledwith the summary "cancelled by alice". It fails on main and passes here in about 0.9 s (5 runs out of 5). The gate picks it up automatically, since it runs everytest/*.test.tsthat isn't excluded.
What I chose not to do
- Checks in another forge process: a check being worked by another forge process (during a roll) isn't stopped. Its row says cancelled and its own end leaves it so, as the module comment says.
- Deploys: these keep their documented behaviour ("abandoned when its step ends").
- Log wording: a check cancelled by a person still writes
superseded: cancelled by …to its log, the existing wording fromexecute. Rewording it would change log output that other code may depend on. - Agent runs and bare steps: these already ended their process trees before this pull;
test/crew-cancel-group.test.tsandtest/steps-stop-tree.test.tsalready cover them. - Plan on the issue: I couldn't post the plan the issue asked for, because the
keep_plantool wasn't available in this run.
Checks run here: bun scripts/gate.ts and bun x tsc --noEmit pass. 12 test files covering cancel, checks and runs pass, 115 tests in all: the new test, steps-stop-tree, crew-cancel-group, tui-run-cancel, check-budget, checks, run-state, cli-runs, mcp-runs, run-requeue-refusals, gate-killed and check-list. scripts/fast.ts named 1,938 test files, far more than this change touches, so I picked those myself.
How to try it: push a forge.json with {"check":{"run":"sleep 300 & wait","install":""}}, open the running check's run page and cancel it. The run says cancelled, and no sleep is left running.
🤖 Generated with Claude Code
When a person cancelled a running check, the check kept running.
cancelRepoRunmarked the rowcancelledbut only stopped agent runs, so the check's command and everything it had forked ran on to the end. This pull wires the cancel through to the check, and the check's existing abort then kills its whole process group.What changed
src/runs/stoppable.ts(new): a list of the runs being worked in this forge process, keyed by run id, so a cancel can find the one to stop. It has the same shape as the agent-run list insrc/crew/running.ts.untrackRunonly removes an entry if it still holds the same controller, so a stale cleanup can't remove a newer one.src/checks/service.tsstart: adds each check to that list when it starts and removes it when it ends.src/actions/runs.tscancelRepoRun: marks the row cancelled first, as before, and then stops the run: agent runs throughabortAgentRun, all other kinds throughstopRun. The row is alreadycancelledbefore the check ends, so the existing path inexecuteleaves it ascancelled, notfailed.runStepalready kills the whole process group with SIGKILL, and nothing survives SIGKILL, so there is no separate "escalate after a grace period" step.AGENTS.md: the new module is listed with the other state shared through process memory.test/run-cancel-tree.test.ts(new): pushes aforge.jsonwhose check command forks a shell that forks asleep, then cancels the running check throughcancelRepoRun. It asserts that all three processes are gone within 2 s and that the row endscancelledwith the summary "cancelled by alice". It fails on main and passes here in about 0.9 s (5 runs out of 5). The gate picks it up automatically, since it runs everytest/*.test.tsthat isn't excluded.What I chose not to do
superseded: cancelled by …to its log, the existing wording fromexecute. Rewording it would change log output that other code may depend on.test/crew-cancel-group.test.tsandtest/steps-stop-tree.test.tsalready cover them.keep_plantool wasn't available in this run.Checks run here:
bun scripts/gate.tsandbun x tsc --noEmitpass. 12 test files covering cancel, checks and runs pass, 115 tests in all: the new test, steps-stop-tree, crew-cancel-group, tui-run-cancel, check-budget, checks, run-state, cli-runs, mcp-runs, run-requeue-refusals, gate-killed and check-list.scripts/fast.tsnamed 1,938 test files, far more than this change touches, so I picked those myself.How to try it: push a
forge.jsonwith{"check":{"run":"sleep 300 & wait","install":""}}, open the running check's run page and cancel it. The run says cancelled, and nosleepis left running.🤖 Generated with Claude Code
Closes #10776