Repository navigation
Let agent workers park on tasks and resume - #2
Conversation
Workers that needed a long command could only wait in the foreground, background it and lose it when a headless Claude turn ended, or hand it off by convention with orchestrator-queued resumes that broke on any non-success outcome. A worker can now report `waiting --on <task>` with notes. The daemon parks it in a chain, holds a continuation until the waited tasks end with any outcome, and resumes the Codex thread or starts a fresh session from the original prompt and notes. Tasks held after a parked worker resolve on the chain's final outcome. An agent that exits 0 without reporting is now TASK_FAILED with reason no_report instead of a success that would release dependents. Claude workers run with CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 so no Claude-managed background work dies with the turn.
The descendant created its pid file before writing to it, so the test could read an empty file and fail to parse it. Write to a temporary file and move it into place.
A Codex continuation fell back to the first run's resume thread when the exiting run printed no session header, so a second park could start a fresh session or resume the wrong conversation. It now resumes the exiting run's known thread. A run whose cancel was requested but which still exited 0 after a waiting report created a continuation, cancelled it in the same transaction, and still sent TASK_WAITING naming it. Such a run now never parks and reads as cancelled. Docs now describe the Codex fallback and limit no_report to agents given the report trailer.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (49)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Why
An agent worker that needs a long command (GPU run, release build, CI watch) had no good option:
claude -p. A worker did this, lost two builds, and exited 0 without a report. That counted asTASK_SUCCEEDED, so anything heldafterit would have started on unfinished work.blockedwithWAITING <id>, plus an orchestrator-queued resume) needed manual bookkeeping. It usedafter, so the resume was cancelled whenever the waited task didn't succeed.What changes
waitingreport outcome.homebased task report --outcome waiting --on <task> --notes-file -parks the worker. Notes are stored in homebased, so noRESUME.mdgoes in the repository. Validation runs in the report transaction and covers unknown, self, remote, resource-queue, and transitive-cycle targets, plus a 20-run chain limit.TASK_WAITING. Codex continuations resume the known thread with only the continuation block. Other agents start a fresh session with the original prompt plus the block. A parked chain reserves its Codex thread.aftera parked worker stays held and resolves on the chain's final outcome. Cancelling any run cancels the chain's current run.no_report. An agent given the report trailer that exits 0 without reporting isTASK_FAILEDwithreason: "no_report". Task, container, and trailer-off agents are unchanged. Readers derive the reason, so it is never sent between Fleet machines.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1. Verified on Claude Code 2.1.288: Bash and Agent loserun_in_background, and a foreground command that hits its timeout is killed instead of being moved to the background.Monitorkeepsclaude -palive until it finishes, so it stays enabled.callback.rs, plus schema v2 (waiting targets, notes, after rule,task_chains,chain_runs).worker.md,events.md,submit.md,errors.md,inspect.md, README, and a dashboard parked badge.The second commit fixes three review findings: the Codex continuation thread fallback, cancel-requested runs parking, and doc wording. A separate commit fixes a pre-existing race in
process_group_cleaned_when_child_leaves_descendant.Not in v1
Waiting across machines, waiting on resource-queue jobs, persistent Claude sessions, suppressing root events for waited tasks, and dashboard chain navigation.
Testing
just fmt --check,just clippy, andjust testpass: 632 lib, 87 integration, 54 fleet, plus cli smoke and message tests. New integration tests intests/integration/waiting.rscover parking and resume for Codex and Claude, release on failure, dependents through a chain, restart and duplicate-exit recovery, validation errors, cancellation, thread reservation, andno_report. A v1 database migration test and a v0.14 Fleet decoder test are included.Summary by CodeRabbit