Skip to content

Let agent workers park on tasks and resume - #2

Merged
praveenperera merged 3 commits into
masterfrom
waiting-handoff
Oct 5, 2026
Merged

praveenperera merged 3 commits into
masterfrom
waiting-handoff

Conversation

@praveenperera

@praveenperera praveenperera commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Why

An agent worker that needs a long command (GPU run, release build, CI watch) had no good option:

  • Waiting in the foreground burns its turn and context budget.
  • Backgrounding the command dies with the turn in headless claude -p. A worker did this, lost two builds, and exited 0 without a report. That counted as TASK_SUCCEEDED, so anything held after it would have started on unfinished work.
  • Handing it off by convention (blocked with WAITING <id>, plus an orchestrator-queued resume) needed manual bookkeeping. It used after, so the resume was cancelled whenever the waited task didn't succeed.

What changes

  • waiting report outcome. homebased task report --outcome waiting --on <task> --notes-file - parks the worker. Notes are stored in homebased, so no RESUME.md goes 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.
  • Chains and continuations. Run tasks stay immutable. A chain owns one unit of work across its runs. When the worker exits, the daemon atomically parks the chain, creates a held continuation that is released when every target ends with any outcome, and sends 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.
  • Dependencies follow the chain. A task held after a 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 is TASK_FAILED with reason: "no_report". Task, container, and trailer-off agents are unchanged. Readers derive the reason, so it is never sent between Fleet machines.
  • No Claude background work. Claude workers run with CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1. Verified on Claude Code 2.1.288: Bash and Agent lose run_in_background, and a foreground command that hits its timeout is killed instead of being moved to the background. Monitor keeps claude -p alive until it finishes, so it stays enabled.
  • Explicit exit classification table in callback.rs, plus schema v2 (waiting targets, notes, after rule, task_chains, chain_runs).
  • Skill and docs. Report trailer, 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, and just test pass: 632 lib, 87 integration, 54 fleet, plus cli smoke and message tests. New integration tests in tests/integration/waiting.rs cover parking and resume for Codex and Claude, release on failure, dependents through a chain, restart and duplicate-exit recovery, validation errors, cancellation, thread reservation, and no_report. A v1 database migration test and a v0.14 Fleet decoder test are included.

Summary by CodeRabbit

  • New Features
    • Agents can pause work while long-running tasks complete, then continue in a new run with their notes and the tasks’ results.
    • Task details and lists show when work is parked, along with its continuation status.
    • Task reports now support a waiting outcome with specified tasks and notes.
  • Bug Fixes
    • Task status and dependency handling now distinguish parked work from completed or failed work.
    • Missing reports from agents required to report are identified as failures.

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.
@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Review in Change Stack →

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
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5eefa9a-d06b-4f43-9905-e01c7c55aa7c
📥 Commits

Reviewing files that changed from the base of the PR and between a65d660 and d8d88b4.

📒 Files selected for processing (49)
  • .agents/skills/homebased/SKILL.md
  • .agents/skills/homebased/references/errors.md
  • .agents/skills/homebased/references/events.md
  • .agents/skills/homebased/references/inspect.md
  • .agents/skills/homebased/references/submit.md
  • .agents/skills/homebased/references/worker.md
  • README.md
  • src/agents.rs
  • src/callback.rs
  • src/callback/tests.rs
  • src/cli/task.rs
  • src/daemon.rs
  • src/daemon/actors/store.rs
  • src/daemon/api.rs
  • src/daemon/api/views.rs
  • src/daemon/chains.rs
  • src/daemon/dependencies.rs
  • src/dependency.rs
  • src/dispatcher_tests.rs
  • src/domain.rs
  • src/error.rs
  • src/events.rs
  • src/lib.rs
  • src/report.rs
  • src/store.rs
  • src/store/admission.rs
  • src/store/chain.rs
  • src/store/dependency.rs
  • src/store/events.rs
  • src/store/events/inbox.rs
  • src/store/events/tests.rs
  • src/store/lifecycle.rs
  • src/store/presentation.rs
  • src/store/schema.rs
  • src/store/task.rs
  • src/store/tests.rs
  • src/submission.rs
  • src/waiting.rs
  • tests/fixtures/fake-agent
  • tests/fixtures/fake-opencode
  • tests/integration.rs
  • tests/integration/lifecycle.rs
  • tests/integration/reports.rs
  • tests/integration/waiting.rs
  • tests/integration/workers.rs
  • web/src/lib/api.ts
  • web/src/lib/components/ParkedBadge.svelte
  • web/src/lib/components/TaskList.svelte
  • web/src/routes/tasks/[id]/+page.svelte
 ________________________________________________________
< Code review is a dish best served cold. Like a carrot. >
 --------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Adds task parking and continuation logic to the daemon.

The PR appears safe to merge; no actionable failure was established.

Summary

The PR adds waiting reports that park agent workers, persist held continuations, and make dependencies follow the final outcome of a run chain. It also classifies reporting agents that exit without a report as failed, updates worker guidance, and displays parked state in the dashboard.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Agent run] -->|waiting report and exit 0| B[Parked chain]
  B --> C[Held continuation]
  D[Waited tasks end] --> C
  C --> E[Continued agent run]
  E -->|final outcome| F[Resolve tasks held after the chain]
Loading

Reviews (1) · Last reviewed commit: "Fix continuation thread and cancel handl..."

@praveenperera
praveenperera merged commit d9338c6 into master Oct 5, 2026
3 of 4 checks passed
@praveenperera
praveenperera deleted the waiting-handoff branch October 5, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant