orca-orchestrate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOrca orchestration runbook
Orca编排运行手册
Drive a supervised multi-agent run on Orca from the orchestrator cockpit. The orchestrator is
the DAG driver: it dispatches only ready tasks, watches every worker settle with ,
unblocks dependents only after their parent's green PR is merged, and gates on failures. It
never schedules workers itself — Orca does not infer placement or conflicts. The agents choose
placement; the orchestrator decides what runs when.
worker_doneRe-orient first if you are in a fresh session (). Confirm the worktree guardrail
first: you must be in the primary worktree (see ) — never coordinate from a
task branch.
/orca-resume/orca-setup从编排器控制台在Orca上驱动受监督的多Agent运行。编排器是
DAG驱动程序:它仅分发就绪任务,监控每个工作者通过完成任务,
仅在父任务的绿色PR合并后才解除子任务的阻塞,并拦截失败任务。
它从不自行调度工作者——Orca不会推断部署位置或冲突。由Agent选择
部署位置;编排器决定什么任务在何时运行。
worker_done如果是新会话,请先重新定位()。首先确认工作树防护:
你必须处于主工作树(查看)——绝不要从任务分支进行协调。
/orca-resume/orca-setupTwo entry paths
两种入口路径
- Planned run (recommended): →
/orca-planproduced a Run and its Tasks. You bind that Run and drive it./orca-tasks - Quick path: a small 1-2 task job that skipped planning. +
run-createdirectly from the objective, then drive identically.task-create
- 规划运行(推荐):→
/orca-plan生成一个Run及其任务。你需要 绑定该Run并驱动它运行。/orca-tasks - 快速路径:跳过规划的小型1-2个任务作业。直接根据目标执行+
run-create, 然后以相同方式驱动运行。task-create
Load the guides before any command
在执行任何命令前加载指南
text
orca skills get orchestration
orca skills get orca-cliRead them before running anything. Prefer for agent-driven calls. Never guess
subcommands or flags from memory.
--jsontext
orca skills get orchestration
orca skills get orca-cli在运行任何命令前阅读这些指南。对于Agent驱动的调用,优先使用参数。绝不要凭记忆猜测
子命令或标志。
--jsonPre-flight
预检查
- Verify the primary worktree: →
orca worktree current --jsonmust beisMainWorktree, or the run is being coordinated from a task branch. Stop and move to the cockpit worktree if not.true - Verify the setup marker exists (), else route to
docs/agents/setup.md./orca-setup - Bind the Run (planned path):
or create it (quick path):bash
orca orchestration run-use --id <run_id> --json.orca orchestration run-create --objective "<objective>" --json
- 验证主工作树:→
orca worktree current --json必须为isMainWorktree,否则运行是从任务分支进行协调的。如果不是,请停止操作并切换到控制台 工作树。true - 验证设置标记是否存在(),否则跳转至
docs/agents/setup.md。/orca-setup - 绑定Run(规划路径):
或者创建Run(快速路径):bash
orca orchestration run-use --id <run_id> --json。orca orchestration run-create --objective "<objective>" --json
The DAG loop
DAG循环
-
Sweep what is ready to run:bash
orca orchestration task-list --run <run_id> --ready --jsonEverytask has all its blockers merged onready. Dispatch each ready task to a worker in its own worktree — one task = one branch = one worktree, never the primary.mainCreate the task worktree first, then launch theprofile in it, then bind the dispatch (theworkerprofile is selected through config, notworker, because opencode's--agentis broken in TUI mode):-a <agent>bash# independent (no blockers) → top-level worktree; dependent → child worktree orca worktree create --name <slug> --no-parent --setup run --json # or: orca worktree create --name <slug> --parent-worktree active --setup run --json orca terminal create --worktree id:<newWorktreeId> --title <slug> --command "OPENCODE_CONFIG_CONTENT='{\"default_agent\":\"worker\"}' opencode --auto -m <model>" --json orca terminal wait --terminal <handle> --for tui-idle --timeout-ms 60000 --json orca orchestration worker-start --task <task_id> --terminal <handle> --worktree id:<newWorktreeId> --jsonUse a fresh terminal per worker (one worktree = one branch = one worker). Reuse a worker terminal only for an immediate follow-up Task on the same worktree, and only when the plan allows it. Tasks the plan markedare the sole exception to the worktree rule — they run in the primary worktree and must be declared before dispatch.isolated: noNote: the bareabove (noworktree create) may open a fallback shell alongside the later--agent. Target only the agent handle; close a fallback shell only afterterminal createconfirms it is an unused shell.orca terminal list --worktree id:<id> --jsonAlternative — composed launch: when the agent is not opencode (e.g. Claude Code) and itsprofile can be the launched agent,workercan create the worktree and launch in one call:worker-start. Only use this when the launched TUI actually runs the permissiveorca orchestration worker-start --task <task_id> --worktree new-top-level --name <slug> --agent <tui> --jsonprofile — otherwise the run stalls on permission prompts.worker -
Wait in rolling windows and process every message before acknowledging:bash
orca orchestration check --wait --types worker_done,escalation,question --timeout-ms 900000 --jsonA timeout oris a checkpoint, not a worker failure. Keep waiting until every dispatch settles; workers routinely run 15-60 minutes.{count:0} -
On each, settle it before acknowledging the Delivery:
worker_done- → the worker already verified the tests are green (CI for github,
succeeded/equivalent for local). Merge the task branch, then clean up the task worktree, then re-sweep:uv run pytestMerging unblocks dependents: after cleanup, runbash# github tracker: merge the PR (auto or via the user's review gate) gh pr merge <pr_number> --squash --delete-branch # local-only (linear tracker, no remote): merge the branch into main in the cockpit # git merge --squash <task-branch> && git push (if a remote exists) orca orchestration worker-release --dispatch <dispatch_id> --json orca worktree rm --worktree <task_worktree_id> --force --json # linear tracker: move the linked issue to Done explicitly — merge does not do it # orca linear status set <issue_key> --to "Done" --workspace <workspace_id> --jsonagain and dispatch what is newly ready. The worker merged nothing itself — the coordinator owns the merge. Antask-list --readyworker stays live afterexternal_terminal: close it withworker-release(see hard-won notes).orca terminal close --terminal <handle> - → never redispatch silently. Mark the task failed, block its dependents, and raise a decision gate to the user:
failedThe recommended option is a single bounded retry: create a fresh worktree/terminal (same recipe as step 1) and bindbashorca orchestration task-update --id <task_id> --status failed --json # dependents are blocked by the failure — surface them via gate orca orchestration gate-create --task <dependent_id> --question "<task> failed; retry bounded (worker-start --retry-of), fix forward, or abandon?" --options '["retry","fix-forward","abandon"]' --json. Your call through the gate decides.worker-start --task <id> --terminal <handle> --worktree <sel> --retry-of <failed_dispatch_id> --json
-
Acknowledge only after every message and release/merge/gate decision is handled:bash
orca orchestration check --ack <delivery_id> --wait --types worker_done,escalation,question --timeout-ms 900000 --json -
Repeat untilshows every task
task-listand no dispatch is unsettled.completed
-
扫描就绪可运行的任务:bash
orca orchestration task-list --run <run_id> --ready --json每个任务的所有阻塞项都已合并到ready分支。将每个就绪任务分发到独立工作树中的工作者—— 一个任务 = 一个分支 = 一个工作树,绝不要使用主工作树。main先创建任务工作树,然后在其中启动配置文件,再绑定分发(worker配置文件通过配置选择,而非worker参数,因为opencode的--agent在TUI模式下存在问题):-a <agent>bash# 独立任务(无阻塞项)→ 顶级工作树;依赖任务 → 子工作树 orca worktree create --name <slug> --no-parent --setup run --json # 或者:orca worktree create --name <slug> --parent-worktree active --setup run --json orca terminal create --worktree id:<newWorktreeId> --title <slug> --command "OPENCODE_CONFIG_CONTENT='{\"default_agent\":\"worker\"}' opencode --auto -m <model>" --json orca terminal wait --terminal <handle> --for tui-idle --timeout-ms 60000 --json orca orchestration worker-start --task <task_id> --terminal <handle> --worktree id:<newWorktreeId> --json每个工作者使用一个全新终端(一个工作树 = 一个分支 = 一个工作者)。仅当计划允许时,才可在同一工作树上 为后续任务重用工作者终端。计划标记为的任务是工作树规则的唯一例外—— 它们在主工作树中运行,且必须在分发前声明。isolated: no注意:上面的命令(不带worktree create)可能会在后续--agent之外打开一个备用shell。仅针对Agent句柄操作; 只有在terminal create确认它是未使用的shell后,才可关闭备用shell。orca terminal list --worktree id:<id> --json**替代方案——组合启动:**当Agent不是opencode(例如Claude Code)且其配置文件可作为启动的Agent时,worker可一次性创建工作树并启动:worker-start。仅当启动的TUI实际运行宽松的orca orchestration worker-start --task <task_id> --worktree new-top-level --name <slug> --agent <tui> --json配置文件时才使用此方法——否则运行会因权限提示而停滞。worker -
滚动窗口等待,并在确认前处理所有消息:bash
orca orchestration check --wait --types worker_done,escalation,question --timeout-ms 900000 --json超时或是检查点,而非工作者失败。持续等待直到所有分发任务完成;工作者通常运行15-60分钟。{count:0} -
针对每个,在确认交付前完成处理:
worker_done- → 工作者已验证测试通过(GitHub的CI,本地的
succeeded/等效命令)。合并任务分支,然后清理任务工作树, 再重新扫描:uv run pytest合并操作会解除子任务的阻塞:清理完成后,再次运行bash# GitHub追踪器:合并PR(自动或通过用户审核关卡) gh pr merge <pr_number> --squash --delete-branch # 仅本地(线性追踪器,无远程):在控制台将任务分支合并到main # git merge --squash <task-branch> && git push(如果存在远程仓库) orca orchestration worker-release --dispatch <dispatch_id> --json orca worktree rm --worktree <task_worktree_id> --force --json # 线性追踪器:显式将关联问题移至Done状态——合并操作不会自动完成 # orca linear status set <issue_key> --to "Done" --workspace <workspace_id> --json并分发新就绪的任务。工作者本身不会执行合并——协调器负责合并操作。task-list --ready工作者在external_terminal后会保持活跃:使用worker-release关闭它(参见经验总结)。orca terminal close --terminal <handle> - → 绝不要静默重新分发。标记任务失败,阻塞其子任务,并向用户发起决策关卡:
failed推荐选项是单次有限重试:创建新的工作树/终端(与步骤1相同的流程)并绑定bashorca orchestration task-update --id <task_id> --status failed --json # 子任务会因失败被阻塞——通过关卡展示它们 orca orchestration gate-create --task <dependent_id> --question "<task>失败;是否进行有限重试(worker-start --retry-of)、向前修复或放弃?" --options '["retry","fix-forward","abandon"]' --json。通过关卡做出决策。worker-start --task <id> --terminal <handle> --worktree <sel> --retry-of <failed_dispatch_id> --json
-
仅在处理完所有消息以及释放/合并/关卡决策后进行确认:bash
orca orchestration check --ack <delivery_id> --wait --types worker_done,escalation,question --timeout-ms 900000 --json -
重复上述步骤,直到显示所有任务为
task-list且没有未完成的分发任务。completed
Watchdog: worker finished but no worker_done
看门狗:工作者已完成但未发送worker_done
A worker can finish its work and idle at the prompt without sending . When a wait
window times out, inspect each unsettled dispatch instead of waiting blindly:
worker_done- and
orca orchestration worker-read --dispatch <id> --json.orca terminal wait --terminal <handle> --for tui-idle --timeout-ms 60000 --json - If the worker is idle and its last message shows the work done (branch pushed, CI green, PR
ready, final summary) but no arrived, re-inject the finalization from the worker's own terminal — the authority must come from there:
worker_donethen continuebashorca terminal send --terminal <handle> --text 'orca orchestration send --type worker_done --subject "<status>" --body "<done, found, left>" --task-id <task_id> --dispatch-id <dispatch_id> --outcome succeeded --files-modified "path/a" --json' --enter --json.check --wait - If it still does not settle, recover manually:
then
orca orchestration task-update --id <task_id> --status completed.orca orchestration worker-release --dispatch <dispatch_id> --json
Never stop, close, or kill a worker because of a timeout, TUI idle, heartbeat, or status — those
mean alive, not done. Never leave a settled worker live: reuse, retain only at the user's
request, or .
worker-release工作者可能完成工作后在提示符处闲置,却未发送。当等待窗口超时时,请检查每个未完成的分发任务,而非盲目等待:
worker_done- 执行和
orca orchestration worker-read --dispatch <id> --json。orca terminal wait --terminal <handle> --for tui-idle --timeout-ms 60000 --json - 如果工作者处于闲置状态,且其最后一条消息显示工作已完成(分支推送、CI通过、PR就绪、最终总结)但未收到,则从工作者自身终端重新注入完成指令——权限必须来自该终端:
worker_done然后继续执行bashorca terminal send --terminal <handle> --text 'orca orchestration send --type worker_done --subject "<status>" --body "<done, found, left>" --task-id <task_id> --dispatch-id <dispatch_id> --outcome succeeded --files-modified "path/a" --json' --enter --json。check --wait - 如果仍未完成,则手动恢复:
然后
orca orchestration task-update --id <task_id> --status completed。orca orchestration worker-release --dispatch <dispatch_id> --json
绝不要因超时、TUI闲置、心跳或状态而停止、关闭或终止工作者——这些状态表示工作者仍在运行,而非已完成。绝不要让已完成的工作者保持活跃:重用、仅在用户请求时保留,或执行。
worker-releaseMerge policy
合并策略
- CI green is the gate. Nothing red merges — better to test and fix than merge and break.
- github tracker: squash-merge the PR () once green.
gh pr merge --squash --delete-branch - linear tracker with no remote: the worker's tests are the gate; merge the task branch into
the cockpit locally (
main), push if a remote exists.git merge --squash <task-branch> - The coordinator merges, the worker never does. The merge is what unblocks dependents, so
merge promptly after a report — a dependent blocked on an unmerged parent looks identical to a stuck run.
succeeded
- CI通过是关卡。任何失败的任务都不会合并——测试并修复比合并后破坏更好。
- GitHub追踪器:CI通过后,压缩合并PR()。
gh pr merge --squash --delete-branch - 线性追踪器(无远程):工作者的测试是关卡;在控制台将任务分支本地合并到(
main),如果存在远程仓库则推送。git merge --squash <task-branch> - 由协调器执行合并,工作者绝不执行。合并操作会解除子任务的阻塞,因此
在收到报告后请及时合并——因父任务未合并而阻塞的子任务看起来与停滞的运行完全相同。
succeeded
Hard-won notes
经验总结
- opencode's is broken in TUI mode (prints help and exits) → pass the agent with
-a <agent>and addOPENCODE_CONFIG_CONTENT='{"default_agent":"worker"}'as a safety net:--autobashOPENCODE_CONFIG_CONTENT='{"default_agent":"worker"}' opencode --auto -m <model>launches the named TUI app; it does not select the permissiveworker-start --agent <tui>profile. For opencode, select the profile withworkerand bind viaOPENCODE_CONFIG_CONTENT(see the DAG loop).--terminal - requires
worker-start --terminal <handle>to match the terminal's worktree, or it fails with--worktree.terminal_worktree_mismatch - opencode defaults to prompting () for
askandexternal_directory; thedoom_loopagent auto-allows them so unattended runs never stall on a permission prompt.worker - must come from the worker's own terminal with the injected
worker_done/--task-id; it marks the task and dispatch complete automatically — do not follow it with a manual--dispatch-id(except in recovery).task-update worker-start/--worktree new-childcreates a fresh worktree + branch and does not rerun setup. Do not reuse the primary worktree for tasks.new-top-level- A worker launched through (custom argv /
terminal create) is anOPENCODE_CONFIG_CONTENT: afterexternal_terminalreturnsworker-release, close the worker terminal yourself (retained / external_terminal) — Orca does not close terminals it did not create throughorca terminal close --terminal <handle>.worker-start - Tracker updates after merge are not automatic: closes the GitHub issue on its own, but Linear does not move the issue state when the PR merges. After a successful linear-tracker merge, update the linked issue explicitly (
gh pr mergeandorca linear status set <key> --to "Done" --workspace <id>) so the tracker reflects the run.orca linear comment add <key> --body "Merged in <pr/branch>"
- opencode的在TUI模式下存在问题(打印帮助信息后退出)→ 通过
-a <agent>传递Agent,并添加OPENCODE_CONFIG_CONTENT='{"default_agent":"worker"}'作为安全网:--autobashOPENCODE_CONFIG_CONTENT='{"default_agent":"worker"}' opencode --auto -m <model>会启动指定的TUI应用;它不会选择宽松的worker-start --agent <tui>配置文件。对于opencode,请通过worker选择配置文件并通过OPENCODE_CONFIG_CONTENT绑定(参见DAG循环)。--terminal - 要求
worker-start --terminal <handle>与终端的工作树匹配,否则会因--worktree失败。terminal_worktree_mismatch - opencode默认会对和
external_directory进行提示(doom_loop);askAgent会自动允许这些操作,因此无人值守的运行绝不会因权限提示而停滞。worker - 必须来自工作者自身终端,并注入
worker_done/--task-id;它会自动标记任务和分发完成——请勿在其后执行手动--dispatch-id(恢复场景除外)。task-update - 的
worker-start/--worktree new-child会创建新的工作树+分支,且不会重新运行设置。请勿将主工作树用于任务。new-top-level - 通过启动的工作者(自定义argv /
terminal create)属于OPENCODE_CONFIG_CONTENT:在external_terminal返回worker-release后,请自行关闭工作者终端(retained / external_terminal)——Orca不会关闭未通过orca terminal close --terminal <handle>创建的终端。worker-start - 合并后的追踪器更新不会自动完成:会自行关闭GitHub问题,但Linear在PR合并时不会更改问题状态。成功合并线性追踪器的任务后,请显式更新关联问题 (
gh pr merge和orca linear status set <key> --to "Done" --workspace <id>),以便追踪器反映运行状态。orca linear comment add <key> --body "已合并至<pr/branch>"