Skip to content

Tell orchestration coordinators to end their turn after dispatch, and fix placement guidance - #34564

Closed
Jinwoo-H wants to merge 13 commits into
mainfrom
orchestration-guide-rewrite
Closed

Jinwoo-H wants to merge 13 commits into
mainfrom
orchestration-guide-rewrite

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​481 $\color{#cf222e}{\Huge{\mathbf{−}}}$​433 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​48

ELI5

The orchestration guide used to tell an agent to sit and wait, for up to 15 minutes, while its worker agents ran. Orca has been able to wake the agent when a worker finishes since August, but the guide never said so. The guide now says: start the workers, end your turn, and Orca will wake you with the result. It also fixes how to put a worker in a new workspace of another project, and it is shorter and plainer.

What Changed

Only corrections to outdated or incomplete text. When to use orchestration (the skill trigger) and where workers go by default are unchanged.

  • End the turn after dispatch. Orca wakes the coordinator with "You have N orchestration messages. Run orca orchestration check --run <id>". The text is typed into its terminal, or sent as a new user message in a chat. The coordinator then runs check, handles each message, acks, and frees each finished worker. The old guide's loop of 15-minute check --wait calls with "do not end the coordinator turn" predates the wake (fix(orchestration): wake coordinators with mail pointers #12988 for terminals, feat(orchestration): orchestrate native-born structured chat sessions #18827 for chats). A 15-minute wait is also longer than the 10-minute per-command limit some agents have.

  • The wake is best-effort. It can fail to arrive (for example, a Claude coordinator with a busy agent-teams teammate keeps reporting "working", so no wake is typed). The guide says so, and tells the coordinator to run check --run <id> whenever it resumes. The app-side fix is a separate PR.

  • check --wait is opt-in. Use it only when this turn needs the result, or when nothing can wake the agent (it is not running in an Orca terminal or chat). The timeout is under 10 minutes.

  • Placement accuracy:

    • placement flags go on worker-start, and run-create takes none;
    • the new-workspace example now includes --repo. Without it, Orca uses the Git project you are in, and fails if you are in none;
    • the new-workspace command now appears in the main guide, not only in a reference.

    The default is still the current or an existing workspace, with a new workspace only when the user asks or sharing a checkout would conflict.

  • Shorter and plainer, same rules.

    • The main guide goes from about 1,800 words to about 1,300.
    • Terms (Run, Task, Dispatch, settled) are defined once.
    • The safety rules and worker duties are kept with the same meaning.
    • Some edge cases moved into existing references: DAG waves and --task to coordinator-loop, caller.orcaSessionId to messaging-and-gates, and the retired-scheduler note to legacy-contract-migration.
  • Review corrections:

    • the full completion rule is restored (every Dispatch settled, mail acked, nothing reclaimable);
    • dropped rules are back (active-Dispatch authority, no binding ancestor Runs, report unknown as unknown);
    • retry now requires a proven failed or stopped attempt, not agent exit;
    • "settled" includes stop, abandon, and failed start;
    • the unscoped worker-list description is fixed (it uses the bound Run);
    • two new phrasings are removed (the default agent "kind you are" and "the worker sees only its spec").
  • Leftover contradictions fixed in the references: the recovery table no longer says to wait for dependencies with check --wait, the DAG example no longer puts every worker in one checkout, and retries point to --retry-of.

  • Unchanged: the skill description, the discovery stub, and the orca-cli guide.

  • Generated files: src/cli/bundled-skill-guides.ts is regenerated. The skill ledger keeps the digest of an interim stub pushed earlier on this branch, because the ledger only grows.

Every command and flag in the guide is checked against src/cli/specs by the existing bundled-guide-flags test.

Why

Agents followed the old guide literally:

  • they held the turn open on a blocking wait, so the user or a Slack thread could not get a reply until it returned;
  • the 15-minute timeout ran past per-command limits;
  • with no correct new-workspace example to copy, one agent put --worktree new-top-level on run-create and got selector_not_found.

Linked Issue

N/A (maintainer change). Follow-up for a related app gap: STA-12520.

Visual Proof

Setup: a hidden dev build (ORCA_BACKGROUND_LAUNCH=1) with its own profile, CDP port, and agent config. A coordinator agent ran in an Orca terminal with the prompt: "Have another agent add a --verbose flag to the greet script in the demo-app project, and tell me what it did when it's finished."

Before (base guide) After (this PR)
A: coordinator in a plain folder workspace Started the worker in demo-app's existing main checkout, then blocked in its turn on check --wait --timeout-ms 540000 until the worker reported. worker-start --worktree new-top-level --repo id:<demo-app>, then ended its turn. Woken 14 s later, it ran check, verified the diff, released the worker, acked, and reported.
B: coordinator in another repo's worktree (not run) Same commands, and said it skipped its own checkout because the change belongs to another project. A heartbeat woke it first; it acked that and ended its turn again. worker_done woke it next, and it reported.

In the after runs, neither coordinator used check --wait. With a plain prompt that asks for no agent ("Add a --verbose flag…"), both guides lead the agent to edit the project itself. That is expected, since the trigger is unchanged.

Before, A: blocked inside its turn on check --wait.

A-coordinator-blocked.png

After, A: ended its turn, then was woken by the pointer and reported.

A-coordinator-after-wake.png

After, B:

B-coordinator-after-wake.png

App issue seen during testing, not changed here: a coordinator terminal created from the CLI, whose pane was never mounted in the hidden window, got its wake only after its workspace was made active.

Testing

  • I manually tested these changes locally (macOS, hidden dev build, before/after above)
  • Automated tests added/updated, or explained why not below

pnpm check:changed --maxWorkers=2 passes all 19 checks. The bundled-guide flag test, the generator and routing tests, the agent-facing parity test, and both skills CLI tests pass. No new tests: guide content is already covered by the flag and routing checks.

AI Disclosure

Review

@coderabbitai

coderabbitai Bot commented Oct 27, 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
Walkthrough

The orchestration guide and bundled copies now provide role-specific workflows for coordinators and dispatched workers. Supporting references clarify Task startup, Run-mail handling, workspace placement, worker-list scope, recovery, and helper-worker rules. The bundled skill source includes the orchestration skill, and the released digest list adds its digest.

Priority: Normal

Merge Risk: Moderate · previous review aade3

A coordinator can report completion while dependent work remains unstarted. Add the next-wave check before merging. The existing terminal-reuse example also still needs correction.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly identifies the two main changes: coordinator turn-ending behavior after dispatch and placement guidance corrections.
Description check Passed The description is mostly complete and clearly documents the user impact, changes, rationale, testing, visual proof, and maintainer issue exception. The Agent skill upstream boundary, Notes, and Check…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
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 mostly complete and clearly documents the user impact, changes, rationale, testing, visual proof, and maintainer issue exception. The Agent skill upstream boundary, Notes, and Checklist sections are omitted, and Review and AI Disclosure are empty, but these omissions do not prevent understanding the change.

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

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

@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: 3651934c-357a-45f8-8b37-19e6aa619464
Commits

Reviewing files that changed from the base of the PR and between c791ee2 and 355ed97.

Files selected for processing: 11
  • resources/skills/current-manifest.json
  • resources/skills/released-digests.json
  • skill-guides/orchestration.md
  • skill-guides/orchestration/references/coordinator-loop.md
  • skill-guides/orchestration/references/legacy-contract-migration.md
  • skill-guides/orchestration/references/messaging-and-gates.md
  • skill-guides/orchestration/references/placement-and-remote.md
  • skill-stubs/orchestration.md
  • skills/orchestration/SKILL.md
  • src/cli/bundled-skill-guides.ts
  • src/main/skills/bundled-skill-install/bundled-skill-sources.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.

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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Major · Use new-top-level for project code changes. · placement-and-remote.md:8-11

skill-guides/orchestration/references/placement-and-remote.md:8-11
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use new-top-level for project code changes.

skill-guides/orchestration.md:47-55 now makes current the default and limits new workspaces to explicit requests or checkout conflicts. This allows ordinary project code changes to run in the coordinator’s checkout, contrary to the intended code-change workflow.

Keep current for non-code and plain-folder work. Use new-top-level --repo ... for project code changes, then regenerate the bundled copies.


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: 09042b6a-aac6-43bb-9e09-897cfbdeda56
Commits

Reviewing files that changed from the base of the PR and between 355ed97 and c8af66b.

Files selected for processing: 4
  • skill-guides/orchestration.md
  • skill-guides/orchestration/references/placement-and-remote.md
  • src/cli/bundled-skill-guides.ts
  • src/main/skills/bundled-skill-install/bundled-skill-sources.ts

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

@Jinwoo-H Jinwoo-H changed the title Teach the orchestration guide when to hand off, and to end the turn after dispatch Tell orchestration coordinators to end their turn after dispatch, and fix placement guidance Oct 27, 2026

@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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Major · Pass the reused workspace with --worktree. · coordinator-loop.md:61

skill-guides/orchestration/references/coordinator-loop.md:61
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Pass the reused workspace with --worktree.

When the reused terminal belongs to a different workspace, omitting --worktree defaults to the coordinator’s workspace and fails terminal validation.

Proposed fix
-ORCA orchestration worker-start --task <next_task_id> --terminal <agent_terminal_handle> --json
+ORCA orchestration worker-start --task <next_task_id> --terminal <agent_terminal_handle> --worktree <same_workspace> --json

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: 9cbf1462-42ec-43f1-bb12-66d9e6b5e6b4
Commits

Reviewing files that changed from the base of the PR and between c8af66b and de746c0.

Files selected for processing: 4
  • resources/skills/released-digests.json
  • skill-guides/orchestration/references/coordinator-loop.md
  • skill-guides/orchestration/references/recovery-and-cleanup.md
  • src/cli/bundled-skill-guides.ts

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

| Code | Meaning | Recovery |
| -------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `task_not_found` | No Task with that id, or not in the bound Run (`data.taskId`, `data.runId`) | Check `task-list --json`; create the Task with `task-create` if it does not exist |
| `task_not_startable` | Task cannot start now: not `ready`, or invalid `--retry-of` (`data.status`, `data.unmetDependencies`, `data.retryOf`) | Wait for running dependencies to report (Orca wakes you); retry or unblock failed ones; inspect `dispatch-show` if already dispatched |

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.

Minor · Functional Correctness · Quick win

Handle invalid --retry-of separately.

task_not_startable also covers an invalid --retry-of, but this recovery text only describes waiting for dependencies or retrying failed dependencies. When data.retryOf is the cause, no dependency may be running, so the coordinator can wait indefinitely or repeat the same invalid retry. Branch on data.unmetDependencies versus data.retryOf, then correct the retry Dispatch ID before retrying. (raw.githubusercontent.com)

Comment thread src/cli/bundled-skill-guides.ts Resolved
…d safety rules, fixed scope and settled wording

@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: 90ace25a-3936-4715-b84e-6b68a5ea5015
Commits

Reviewing files that changed from the base of the PR and between 77da1fc and aade312.

Files selected for processing: 7
  • skill-guides/orchestration.md
  • skill-guides/orchestration/references/coordinator-loop.md
  • skill-guides/orchestration/references/messaging-and-gates.md
  • skill-guides/orchestration/references/placement-and-remote.md
  • skill-guides/orchestration/references/recovery-and-cleanup.md
  • skill-guides/orchestration/references/worker-contract.md
  • src/cli/bundled-skill-guides.ts

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

Comment on lines +76 to +77
The wake is best-effort and can fail to arrive, so whenever you resume for any
reason, run `check --run <run_id>` first. The loop:

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.

Major · Functional Correctness · Heavy lift

Start newly ready Tasks after each completed wave.

If Task B depends on Task A, the coordinator cannot start B until A reports. The new wake loop handles A’s mail but does not direct the coordinator to list ready Tasks and start B. The completion rule also checks only Dispatches already started. A coordinator following this loop can leave B unstarted and never complete the requested DAG. After processing a batch, check for newly ready Tasks and start the next wave before declaring completion. The coordinator-loop reference already documents planned Tasks and the ready view. (raw.githubusercontent.com)

@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

Superseded by #36137, which combines the orchestration v3 changes into one PR.

@Jinwoo-H Jinwoo-H closed this Oct 29, 2026
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