Skip to content

Let send talk to a worker in any state, reopening closed workers for follow-ups - #36533

Merged
Jinwoo-H merged 17 commits into
mainfrom
orch-send-followup
Oct 31, 2026
Merged

Jinwoo-H merged 17 commits into
mainfrom
orch-send-followup

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​508 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​489
Prod 54 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1584 $\color{#cf222e}{\Huge{\mathbf{−}}}$​249 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1335

ELI5

A coordinator talks to its workers with orca orchestration send --to dispatch:<id>. Until now that only worked while the worker was still on its task: once a worker finished, send was refused, and if its tab had auto-closed there was no way back to it. Now send works whatever state the worker is in. Orca steers a working worker, gives a finished worker a follow-up task in place, or reopens a closed worker in its saved conversation and gives it the task there.

What Changed

  • send to a finished worker creates a follow-up Task and Dispatch (follow_up_of_dispatch_id) through worker-start on the sender's behalf, so the same Run checks and custody rules apply. send returns that worker-start receipt (and prints it as worker-start does) plus followUpOf and a delivery that says what happened:
    • in place: the worker's tab is still open, kept open by the user, or its conversation is open in the user's own tab (that tab stays the user's);
    • reopened: a closed terminal worker resumes its saved conversation through the existing resume-in-workspace path; a closed chat worker gets its tab back with the same chat;
    • started fresh: when no conversation can be resumed, the same agent starts with the earlier task and report as context.
  • Races: two sends at once create one follow-up and the second steers it; mail a worker never read before worker_done becomes or joins the follow-up, and mail moved to a follow-up wakes it like any Dispatch mail (durable across restarts, and a repeat startup pass does nothing); a send racing a report never gets the old "Dispatch is completed" refusal.
  • Bookkeeping: migration v46 (follow_up_of_dispatch_id, follow_up_mail_at, saved resume session); the worker's conversation is saved on provider-session changes, at worker_done, and before stop and release; worker-show shows followUpOf; restart recovery of an in-flight follow-up names its Dispatch.
  • Safety: liveness comes from the existing inspectWorkerTerminal (including handle re-mint); if Orca can't tell whether the old agent still runs, the send is refused rather than starting a second worker. An Orca-owned pane whose agent exited is released before its replacement starts.
  • Mixed versions: an older paired server refuses finished-worker sends with an update message naming worker-start --on <server>; steering running workers works as before.
  • Guide: start workers with worker-start, talk to them with send, answer questions with reply; worker-retain is no longer taught for follow-ups.

Why

Agents reach for send to talk to a worker. Requiring them to know whether it is still working, finished, or closed (and to switch to worker-start --terminal with a handle, or start over) was a dead end in field use. Making a follow-up a worker-start run for the same worker reuses the existing start, custody and recovery machinery instead of a parallel path.

Linked Issue

None.

Visual Proof

N/A: no UI change beyond the reopened tab. Real app, isolated profile: terminal Claude workers followed up while open, after closing (resumed, history visible) and in the user's own tab; a chat worker reopened in the same chat and recalled the earlier exchange; kept-open worker follow-up; fresh start; the worker_done race. Receipts and database dumps were captured for each.

Testing

  • worker-follow-up.test.ts and related: unread mail across a restart (including mail moved to the follow-up that won, woken once), stale handle after restart (no second worker), send racing a report, follow-up of a failed follow-up, conversation saved after /clear, queued chat follow-up counted as started, kept-open follow-up, older paired server refusal.
  • pnpm check:changed --maxWorkers=2 passes.
  • Not run: SSH/WSL, phone, a real older paired server.

Notes

  • Known follow-ups: an Orca restart while a follow-up is starting has a recovery hint but no automatic resume; mail that loses two races in a row stays unread until the next send.
  • Migration v46 is additive.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after evidence for the behaviour change
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm check:changed passes; CI covers the rest

A send to a finished worker's Dispatch becomes its next Task, started the way
worker-start starts one: in place while its tab is open, reopened in its saved
conversation once closed, or as a fresh agent with the earlier task and report
when no conversation was kept. Mail a worker never read before it reported
becomes that follow-up too. Kept-open workers take follow-ups and stay kept.
…e the conversation at stop and release, and show followUpOf

A card in Orca's own worker chat runs when that turn ends, so it reads as ready
instead of outcome_unknown; a user's chat keeps the unknown reading. The
terminal conversation is also saved before stop and release close the pane, so
a worker that stopped without reporting or ran /clear reopens its latest one.
Unread mail a worker left when it reported is marked in that settlement, read in
the follow-up's own claim, and steered into a racing follow-up instead; startup
and report replay continue what a restart interrupted. A send to a working
worker stays synchronous until its mail is inserted. Follow-ups read the worker's
terminal through worker inspection, refuse while it is unverifiable, close an
Orca shell whose agent exited, and fall back to a fresh agent when a resume is
refused before spawning. The send's pending receipt names the follow-up it
accepted; a failed follow-up continues the worker before it; a worker pane's
conversation is saved whenever its agent reports a new one.
…to the follow-up, and write the saved conversation without comparing
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b05cb70a-8030-459e-88ce-c798308c0d45
Commits

Reviewing files that changed from the base of the PR and between 2b093d6 and c5f7d0a.

Files selected for processing: 3
  • src/cli/handlers/orchestration-send-receipt-warnings.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up.test.ts
Files skipped from review as they are similar to previous changes: 2
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Messages to finished workers can create follow-up dispatches, which may continue on a live worker, reopen a saved session, or start a fresh agent. The changes add dispatch lineage and unread-mail tracking, capture worker resume sessions, and continue unread mail after reports or runtime restarts. Worker-start and terminal-transfer behavior now supports follow-ups and user-kept terminals. The CLI and orchestration guides describe and report the follow-up behavior.

Merge Risk: Moderate · previous review c5f7d

Remote follow-up setup can fail using the documented command, and sufficiently large unread-mail backlogs can cause messages to remain marked delivered without being continued. These issues should be fixed before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely summarizes the main change: allowing send to reach workers in any state and reopen closed workers for follow-ups.
Description check Passed The description is detailed and aligned with the changes. It covers the user-facing behavior, implementation, rationale, testing, limitations, and checklist. The Linked Issue section says "None," and …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and aligned with the changes. It covers the user-facing behavior, implementation, rationale, testing, limitations, and checklist. The Linked Issue section says "None," and the AI Disclosure, Review, and Agent skill upstream boundary sections are omitted.

Full details: Docstring Coverage

Explanation

Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 52 functions across 54 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 402ccfd7-92a7-4063-80d0-5f771cf1b42e
Commits

Reviewing files that changed from the base of the PR and between 71a9311 and ebba985.

Files selected for processing: 56
  • skill-guides/orchestration.md
  • skill-guides/orchestration/references/coordinator-loop.md
  • skill-guides/orchestration/references/low-level-topology.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/orchestration/message-send-handler.ts
  • src/cli/handlers/orchestration/worker-observation-handlers.ts
  • src/cli/runtime/client.ts
  • src/cli/specs/orchestration-worker-specs.ts
  • src/main/runtime/orca-runtime-agent-transitions.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/orchestration/db/contract-constants.ts
  • src/main/runtime/orchestration/db/dispatch-context/worker-follow-up-lineage.ts
  • src/main/runtime/orchestration/db/dispatch-context/worker-report-settlement.ts
  • src/main/runtime/orchestration/db/dispatch-row-writer.ts
  • src/main/runtime/orchestration/db/row-column-lists.ts
  • src/main/runtime/orchestration/db/schema/create-core-tables-sql.ts
  • src/main/runtime/orchestration/db/schema/create-graph-tables-sql.ts
  • src/main/runtime/orchestration/db/schema/migrate-v46.ts
  • src/main/runtime/orchestration/db/schema/migrate.ts
  • src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-start.ts
  • src/main/runtime/orchestration/db/worker-terminal/worker-terminal-resource-store.ts
  • src/main/runtime/orchestration/db/worker-terminal/worker-terminal-transfer.ts
  • src/main/runtime/orchestration/db/worker-terminal/worker-terminal-user-keep.ts
  • src/main/runtime/orchestration/orchestration-schema-version-skew.ts
  • src/main/runtime/orchestration/structured-session-mail-target.test.ts
  • src/main/runtime/orchestration/types.ts
  • src/main/runtime/orchestration/worker-terminal-ownership.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federated-worker-show.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-control-mail.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/settled-worker-follow-through.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/worker-follow-up-receipt.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/worker-follow-up.ts
  • src/main/runtime/rpc/methods/orchestration/worker/deliver-worker-dispatch-preamble.ts
  • src/main/runtime/rpc/methods/orchestration/worker/dispatch-context-exposure.ts
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start-dispatch.ts
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-auto-release.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-control.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-placement.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-observation.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-observation.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-release-archive-capture.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-release-archive.spec.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-resume-session-capture.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-agent-placement.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-readiness-settlement.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-turn-observation.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-stop-archive.ts
  • src/main/runtime/rpc/methods/orchestration/worker/workers.ts
  • src/main/runtime/rpc/orchestration-mutation-receipt.ts
  • src/main/runtime/runtime-orchestration-db.test-fixture.ts
  • src/main/runtime/structured-chat-worker-reuse.test.ts
  • src/main/runtime/workspaces/persisted-surfaces/automation-operations.ts
Files with no reviewable changes: 1
  • skill-guides/orchestration/references/coordinator-loop.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Comment thread skill-guides/orchestration.md Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e849e12-1592-4937-8ce6-fd3a38561475
Commits

Reviewing files that changed from the base of the PR and between ebba985 and 5f7cf76.

Files selected for processing: 12
  • src/cli/handlers/orchestration/message-send-handler.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/orchestration/db/dispatch-context/worker-follow-up-lineage.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/settled-worker-follow-through.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/worker-follow-up.ts
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-earlier-work.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-placement.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up.test.ts
  • src/main/runtime/structured-chat-worker-reuse.test.ts
Files with no reviewable changes: 2
  • src/main/runtime/rpc/methods/orchestration/worker/worker-earlier-work.ts
  • src/main/runtime/orchestration/db/dispatch-context/worker-follow-up-lineage.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

… prove a worker exited before replacing it, and keep each message's subject

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f8155a04-e6c8-4d8e-b943-bc2db846b050
Commits

Reviewing files that changed from the base of the PR and between 5f7cf76 and b383eae.

Files selected for processing: 4
  • src/main/runtime/rpc/methods/orchestration/messaging/send-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/settled-worker-follow-through.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up-choice.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

… paired-server refusals by state, and resolve follow-up recovery commands in JSON

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e55eb5c-53e0-44e8-b639-f1017e5bc3e2
Commits

Reviewing files that changed from the base of the PR and between b383eae and 2b093d6.

Files selected for processing: 10
  • skill-guides/orchestration.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/orchestration/message-send-handler.ts
  • src/cli/handlers/orchestration/worker-launch-handler.ts
  • src/cli/orchestration-mutation-recovery.ts
  • src/main/runtime/orchestration/db/dispatch-context/worker-follow-up-lineage.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-control-mail.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/settled-worker-follow-through.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up.test.ts
Files skipped from review as they are similar to previous changes: 5
  • src/main/runtime/rpc/methods/orchestration/messaging/send-control-mail.ts
  • src/cli/bundled-skill-guides.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-follow-up.test.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-methods.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/settled-worker-follow-through.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment thread skill-guides/orchestration.md Resolved
… pane identity changed, and test the follow-up mode line
…w-up, delivered once that one is ready or has reported
# Conflicts:
#	skill-guides/orchestration.md
#	skill-guides/orchestration/references/coordinator-loop.md
#	src/cli/bundled-skill-guides.ts
#	src/cli/handlers/orchestration/message-send-handler.ts
#	src/cli/handlers/orchestration/worker-launch-handler.ts
#	src/cli/handlers/orchestration/worker-observation-handlers.ts
# Conflicts:
#	skill-guides/orchestration.md
#	src/cli/bundled-skill-guides.ts
#	src/cli/handlers/orchestration/worker-launch-handler.ts
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