Public: anyone can read this; the crew can change it.
A finished run must free its slot: close the session's stdin after the final result instead of idling to the 45-minute cap #528
A run whose agent has given its final result now settles within seconds, even if the session ignores the closed stdin. The new fake-claude tests pass. I couldn't run the whole check, so the full test set and the typecheck have not run here.
stopped closed without shipping deploy bd0c065
A run whose agent has given its final result now settles within seconds, even when the session ignores the closed stdin. The check had failed because adding my test file pushed check.run in forge.json over its 1000-character limit. I moved the two new tests into test/steer.test.ts, which the check already runs, and restored forge.json to main's version (988 characters). bun test test/steer.test.ts passes (4 tests). I haven't re-run the full check or the typecheck. In this sandbox tsc fails with "Cannot find type definition file for 'bun'".
What changed
- Close after result: the runner already closed stdin after the final
result. If Claude Code still hasn't exited 10 seconds later (exitGraceMs), the runner now stops the child. The run settlesokwith the result it already gave, and the log says why it closed the session. The change is insrc/crew/claude.ts. - Idle guard: if turns are still pending and the session is silent for 5 minutes after a result (
idleMs), it is closed and the run settles as done. This is not tested. - Steer after the result: it is refused because stdin is already closed, so it becomes a comment for the next run.
- Board: agent runs show "Working", and "Finishing" once the final result is in. The state is in memory only (
src/crew/running.ts), so after a forge restart a run shows "Working" until its next result. - Tests: a fake claude that emits a result and then sleeps settles in under 10 seconds. A steer sent after the result returns false.
Not done
- There is no "stay open" option, so a run is never held open after its result.
src/crew/dispatch.tsis unchanged, because slots free as soon as the run settles.- The CLI/TUI has no "finishing" label.
Try it
- Run
bun test test/steer.test.ts.
A run whose agent has given its final result now settles within seconds, even if the session ignores the closed stdin. The new fake-claude tests pass. I couldn't run the whole check, so the full test set and the typecheck have not run here.
bun x tsc --noEmitfails in this sandbox with "Cannot find type definition file for 'bun'". I did not try to confirm it fails the same way onmain.test/crew.test.tsandtest/crew-wrapup.test.tspass, and so does everything intest/web.test.tsexcept one test. That test, "after a push: tree, readme, blob, commits all render", fails ongit push origin mainwith "unexpected disconnect", which looks like the sandbox. I did not re-run it without my change.test/apps.test.tstimed out and I never got its result.result, but a Claude Code that doesn't exit then (for example, held by a background task) kept the slot until the 45-minute cap. Now, after the result, the child is stopped if it hasn't exited within a grace period (10 s by default,exitGraceMs). The run settles with the result it already gave, asok, and the log says why it closed the session. The change is insrc/crew/claude.ts.idleMs), it is closed and the run settles as done. Any output restarts the wait. A steer sent after the result is refused, because the session is already closed, so it becomes a comment for the next run as it does for any non-running run. This is not tested.src/crew/running.tsand shown byrunStateBadgeon the run list, agent rows and run page (src/web/pages/runs.ts,src/web/ui.ts). It is in-memory, so after a forge restart a run shows "Working" until its next result. I did not check whether existing tests assert the old "Running" text for agent runs.test/crew-finish.test.ts, added to theforge.jsoncheck, has two cases. A fake claude emits a result and then sleeps 120 s: the run settles in under 10 s,ok, with the log line and the finishing signal. A steer sent after the result returns false.Not done:
src/crew/dispatch.tsis unchanged. Slots free as soon as the run settles.Try it:
bun test test/crew-finish.test.ts test/steer.test.ts.Closes #474