Repository navigation
skills: rewrite and trim the seven non-orchestration guides (do not merge without Jinwoo) - #18724
Conversation
…st standard Every guide leads with Result / Done / Safe failure, states conditions instead of case lists, keeps one done bar and one autonomy envelope, and loads references at the point of use via `skills get <topic> --full`. orca-cli drops from 424 to 260 always-loaded lines with three references; orca-per-workspace-env from 794 to 397 with five. Defects fixed in shipped guides: `emulator camera` (no such command), iOS `permissions` (backend refuses it), Android pane described as in development, `relayGracePeriodSeconds: 0` documented as immediate teardown (it is unbounded), doctor `ok: true` hiding `warn`, an SSH exemplar setting both `jumpHost` and `proxyCommand`, a provisioned-root fetch from `origin`, and the Linear unconfirmed-write rule keyed on four verbs when ten emit it. The resolver ladder, placeholder rule, and older-binary fallback shared by every installable SKILL.md now come from one skill-stubs/_shared/cli-resolution.md fragment composed by the generator, which also bundles per-guide references into --full. New guards: every ORCA invocation and flag resolves against COMMAND_SPECS, descriptions carry no angle-bracket tokens, reference routing is checked both ways, and an always-loaded size ratchet (300 lines) that guides may leave but never join.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (42)
🚧 Files skipped from review as they are similar to previous changes (36)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThis change centralizes shared stub content and expands it during guide generation. It packages guide-specific reference files with full guides and adds routing checks. Skill guides and descriptions now use consistent Merge Risk: 🟡 Moderate · up to The guides can still validate unsupported commands, omit required full references, misroute cloud workflows, and establish SSH trust without an authenticated fingerprint. These issues should be resolved before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkResolution Add the required Why section, provide an actual issue reference after Fixes #, add Visual Proof with N/A and a reason if applicable, complete AI Disclosure if required, and fill the Review, Agent skill upstream boundary, Notes, and Checklist sections. Full details: Docstring CoverageExplanation Docstring coverage is 26.92% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 11 files. (32 skipped: 32 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
Actionable comments posted: 9
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
skills/orca-emulator/SKILL.md (1)
48-48: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winLoad the full guide projection.
The PR contract requires
skills get <topic> --fullbefore guide actions. These commands omit--full, so users receive the compact projection without bundled references.
skills/orca-emulator/SKILL.md#L48-L48: change the command toORCA skills get orca-emulator --full.skills/linear-tickets/SKILL.md#L48-L48: change the command toORCA skills get linear-tickets --full.skills/orca-per-workspace-env/SKILL.md#L40-L40: change the command toORCA skills get orca-per-workspace-env --full.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 78daa00f-2dfd-4848-8a8c-a447202591f1
📒 Files selected for processing (45)
.gitattributesconfig/scripts/generate-bundled-skill-guides.mjsconfig/scripts/generate-bundled-skill-guides.test.mjsconfig/scripts/orca-cli-skill-guidance.test.mjsconfig/scripts/orca-linear-skill-guidance.test.mjsconfig/scripts/skill-description-length.test.mjsconfig/scripts/skill-guide-size-budget.test.mjsconfig/scripts/skill-stub-composition.mjsresources/skills/current-manifest.jsonresources/skills/snapshot-registry.jsonskill-guides/computer-use.mdskill-guides/linear-tickets.mdskill-guides/orca-cli.mdskill-guides/orca-cli/references/automations.mdskill-guides/orca-cli/references/browser.mdskill-guides/orca-cli/references/publishing.mdskill-guides/orca-emulator-android.mdskill-guides/orca-emulator.mdskill-guides/orca-linear.mdskill-guides/orca-per-workspace-env.mdskill-guides/orca-per-workspace-env/references/docker-ssh.mdskill-guides/orca-per-workspace-env/references/failure-modes.mdskill-guides/orca-per-workspace-env/references/provider-vercel.mdskill-guides/orca-per-workspace-env/references/ssh-host.mdskill-guides/orca-per-workspace-env/references/windows-scripts.mdskill-stubs/_shared/cli-resolution.mdskill-stubs/computer-use.mdskill-stubs/linear-tickets.mdskill-stubs/orca-cli.mdskill-stubs/orca-emulator-android.mdskill-stubs/orca-emulator.mdskill-stubs/orca-linear.mdskill-stubs/orca-per-workspace-env.mdskill-stubs/orchestration.mdskills/linear-tickets/SKILL.mdskills/orca-emulator-android/SKILL.mdskills/orca-emulator/SKILL.mdskills/orca-linear/SKILL.mdskills/orca-per-workspace-env/SKILL.mdskills/orchestration/SKILL.mdsrc/cli/bundled-skill-guides.tssrc/cli/help.tssrc/cli/skill-guide-cli-parity.test.tssrc/cli/specs/skills.test.tssrc/cli/specs/skills.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| "packageDigest": "74871af12c2081788baa33746ba375fe74cd3cdc3bcff2ec26a871a340481d61", | ||
| "gitTreeSha": "f9fc3f0f2b1d20544d75cd3ebffe9a084a7257f1", |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Append a new revision for the changed orchestration package.
The package digest and tree hash changed, but releaseRevision remains 29. The manifest generator creates the next revision and appends a snapshot when the package digest changes. Rewriting revision 29 breaks snapshot immutability and can make historical revision 29 resolve to new content.
Regenerate both resources/skills/snapshot-registry.json and resources/skills/current-manifest.json so this package is recorded as revision 30.
| - For structured coordination, invoke the `orchestration` skill; it uses `orca orchestration ...` commands for messages, handoffs, task DAGs, dispatches, inbox/reply flows, and coordinator loops. A receiving agent can run `orca orchestration check --unread --format` to render its unread mail in agent-readable form; this checks the caller's inbox and does not remotely deliver input to another terminal. | ||
| - Use `terminal create --worktree active --command "<agent>"` for a fresh agent in the current worktree. Use `worktree create --agent <agent>` only for a separate checkout (agent in the first terminal — do not also `terminal create` the same agent). | ||
| - A send receipt with `accepted: true` proves the bytes reached the terminal, not that the agent started a turn. Confirm a turn with `terminal read` or `terminal wait --for tui-idle`; never resend on silence. | ||
| - For structured coordination, invoke the `orchestration` skill; it uses `orca orchestration ...` commands for messages, handoffs, task DAGs, dispatches, inbox/reply flows, and coordinator loops. A receiving agent can run `ORCA orchestration check --peek --format --json` to render its unread mail in agent-readable form; this checks the caller's inbox and does not remotely deliver input to another terminal. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use the selected ORCA executable for orchestration commands.
Start Here requires every command example to use the executable that ran skills get, but this instruction uses literal orca orchestration .... In a development checkout, that can invoke the wrong binary or fail. Replace it with ORCA orchestration .... Apply the same correction to the prohibition at Line 58 if it is intended as an executable example.
| ssh_opts=(-p "$ssh_port"); [ -n "$identity_file" ] && ssh_opts+=(-i "$identity_file") | ||
| # A fresh host's key isn't in known_hosts, and a StrictHostKeyChecking prompt HANGS a | ||
| # non-interactive create. Pre-add the key (or set the option) so it can't block. | ||
| ssh-keyscan -p "$ssh_port" "$host" >> "$HOME/.ssh/known_hosts" 2>/dev/null || true |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
sed -n '55,90p' skill-guides/orca-per-workspace-env/references/ssh-host.mdRepository: stablyai/orca
Length of output: 2358
Other (CWE-295): Improper Certificate Validation
Reachability: External · Exploitability: Moderate
Verify the host key before adding it to known_hosts.
ssh-keyscan does not authenticate the returned key. A network attacker can supply a key, receive the SSH session, and access GH_TOKEN. Compare the scanned fingerprint with a trusted or user-supplied fingerprint before writing known_hosts.
| // An incomplete reference like `ORCA emulator ...` names a real prefix and pins no flags. | ||
| if (pathPrefixes.has(tokens.join(' '))) { | ||
| return failures |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Only exempt an explicit ... prefix placeholder.
Lines 142-144 also exempt real incomplete invocations. For example, ORCA emulator --webcam resolves to the emulator prefix and passes without validating the unsupported flag.
Require a literal ... after the prefix before returning success. Report every other incomplete command path.
Proposed fix
- if (pathPrefixes.has(tokens.join(' '))) {
+ if (
+ pathPrefixes.has(tokens.join(' ')) &&
+ masked.trim().endsWith('...')
+ ) {
return failures
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // An incomplete reference like `ORCA emulator ...` names a real prefix and pins no flags. | |
| if (pathPrefixes.has(tokens.join(' '))) { | |
| return failures | |
| // An incomplete reference like `ORCA emulator ...` names a real prefix and pins no flags. | |
| if ( | |
| pathPrefixes.has(tokens.join(' ')) && | |
| masked.trim().endsWith('...') | |
| ) { | |
| return failures |
There was a problem hiding this comment.
ℹ️ No critical issues — a thorough, well-guarded rewrite with two minor consistency notes below.
Reviewed changes
- Seven guides rewritten to an outcome-first kernel.
orca-cli,orca-per-workspace-env,orca-emulator,orca-emulator-android,orca-linear,linear-tickets, andcomputer-usenow lead with a Result/Done/Safe-failure spine;orca-cli(424→260) andorca-per-workspace-env(794→397) split their command catalogs intoreferences/fetched viaskills get <topic> --full. - Generator bundles references and single-authors stubs.
generate-bundled-skill-guides.mjscomposesfullMarkdownfromreferences/*.md; the newskill-stub-composition.mjsmoves the resolver ladder, placeholder rule, and older-binary fallback into oneskill-stubs/_shared/cli-resolution.mdfragment, with fatal errors on unknown/missing/duplicated/re-inlined blocks. - Real defect fixes in the shipped guides. Removes the never-existent
emulator cameraand the iOS-rejectedpermissions, drops the stale Android "in development" notice, correctsrelayGracePeriodSeconds: 0to unbounded (it was documented as immediate teardown), fixes the doctorok: true-hides-warnreading, removes the SSH exemplar's contradictoryjumpHost+proxyCommand, and switches the provisioned-root fetch fromoriginto the suppliedORCA_REPO_URL. - Guards. A CLI-parity test resolves every
ORCAinvocation and flag againstCOMMAND_SPECS(this is what found the camera defect), plus description-length, angle-bracket-token, and always-loaded size-budget ratchets.
I verified the load-bearing runtime claims against the source: relayGracePeriodSeconds accepts only 0 or [60, 604800] and 0 is unbounded (relay-grace-lifecycle.ts), doctor ok is checks.every(c => c.status !== 'fail'), terminal send/wait return accepted/satisfied + blockedReason, and --connect is an accepted --provision synonym. All match the rewritten guides.
ℹ️ Seven discovery stubs still promise the "complete" guide
skills get now returns the compact guide by default and --full gates the command catalogs, and the orchestration stub was updated to say "compact" with a --full pointer — but the other seven stubs were not. They still read "Load the full guide before running Orca commands … That prints the complete … guide" and, for orca-cli, enumerate "automations, and the built-in browser", which now live behind --full. An agent that trusts the stub verbatim gets the compact kernel and only discovers the --full gate table after the fact.
Technical details
# Align the seven non-orchestration stubs with the compact/--full wording
## Affected sites
- skill-stubs/orca-cli.md:16-24 — "Load the full guide … prints the complete … guide" and the "automations … built-in browser" enumeration.
- skill-stubs/orca-per-workspace-env.md:9-18, skill-stubs/computer-use.md, skill-stubs/linear-tickets.md, skill-stubs/orca-emulator.md, skill-stubs/orca-emulator-android.md, skill-stubs/orca-linear.md — same "full/complete" wording.
## Required outcome
- Each stub describes `skills get <topic>` as returning the compact guide, and names `--full` as the route to the bundled references (mirroring skill-stubs/orchestration.md:24-27).
## Suggested approach (optional)
- Reuse the orchestration stub's sentence shape; the change is mechanical and the projections regenerate byte-identically.ℹ️ Orchestration stub references --full before orchestration references exist
The updated orchestration stub tells agents to run ORCA skills get orchestration --full and "read the named bundled reference" for conditional gates, but skill-guides/orchestration.md has no references/ directory on this branch, so --full is a no-op until #16904 lands. This is sequencing-only and already documented in the PR body, but worth a deliberate check of merge order: a release cut between this PR and #16904 ships a stub pointing at a reference that does not exist.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
- ssh-host create script: route the bootstrap ssh through the chosen jump host or proxy command, refuse both at once, use StrictHostKeyChecking=accept-new instead of a blind ssh-keyscan append, and pass gh_token/project_root/repo_url/repo_ref to the remote bash via printf %q so a quote in a value cannot break out of the command. - per-workspace-env envelope: the step-10 workspace test the user asked for is no longer forbidden by the same paragraph. - linear guides: name the full verb, ORCA linear list-issues. - parity guard: a prefix reference such as ORCA linear --help or ORCA emulator --webcam now has its flags checked against every command under that prefix; only an exact path or an explicit ... was checked before.
Shorter outcome spines, one idea per sentence, no restated rationale after a rule. No rule, command, or pinned phrase changes; 47 net lines fewer across the guides and references.
|
Addressed in 634b62d and the follow-up prose commit:
Not changed:
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Tightened the CLI-parity guard so a prefix reference such as
ORCA emulator --webcamnow validates its flags against every command under that prefix, with a dedicated test covering both the pass and fail paths. - Hardened the SSH host recipe by adding a mutually exclusive
jumpHost/proxyCommandguard, replacingssh-keyscanpre-seeding withStrictHostKeyChecking=accept-new, actually applying-J/-o ProxyCommand=to the bootstrap connection, and quoting values throughprintf %qso a path or ref cannot break out of the remote shell. - Narrowed the per-workspace autonomy envelope so the "never create an Orca workspace" rule permits the optional step-10 workspace test the user asked for.
- Prefixed the Linear
list-issuesguidance withORCA linearso it resolves againstCOMMAND_SPECS. - Regenerated the bundled guide constants in lockstep with the guide markdown.
The SSH recipe now correctly rejects simultaneous jumpHost/proxyCommand, routes the bootstrap connection through the selected proxy, and escapes interpolated values; the parity-guard test is exact enough to fail on a regression in either direction.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
skill-guides/orca-per-workspace-env/references/provider-vercel.md (1)
45-46: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRemove
--timeout 30sfromvercel sandbox exec. The current Vercel CLI contract supports this flag for sandbox lifecycle commands, notexec; it can fail beforecodex login statusruns. Set the timeout invercel sandbox createinstead.Source: MCP tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: a722016e-0196-42c8-84f4-a5b821a229dc
📒 Files selected for processing (13)
skill-guides/computer-use.mdskill-guides/linear-tickets.mdskill-guides/orca-cli.mdskill-guides/orca-cli/references/browser.mdskill-guides/orca-cli/references/publishing.mdskill-guides/orca-emulator-android.mdskill-guides/orca-emulator.mdskill-guides/orca-linear.mdskill-guides/orca-per-workspace-env.mdskill-guides/orca-per-workspace-env/references/failure-modes.mdskill-guides/orca-per-workspace-env/references/provider-vercel.mdskill-guides/orca-per-workspace-env/references/ssh-host.mdsrc/cli/bundled-skill-guides.ts
🚧 Files skipped from review as they are similar to previous changes (8)
- skill-guides/linear-tickets.md
- skill-guides/orca-cli/references/publishing.md
- skill-guides/orca-per-workspace-env/references/ssh-host.md
- skill-guides/orca-linear.md
- skill-guides/orca-per-workspace-env/references/failure-modes.md
- skill-guides/computer-use.md
- skill-guides/orca-emulator-android.md
- skill-guides/orca-emulator.md
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| This guide covers the interview, the phase order, and the doctor loop on its own. At a gate below, | ||
| run `ORCA skills get orca-per-workspace-env --full` once and read only the named reference. It | ||
| returns this guide plus every reference from the same CLI build. Read the reference at the gate, not | ||
| before. If `--full` is rejected, keep these rules, use the command's `--help`, and do not guess |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Route provider references by provider.
The conditional-reference table sends every “snapshot-capable cloud provider” to references/provider-vercel.md, although the workflow also supports Fly, Modal, and other providers. A user can apply Vercel-specific commands to another provider and reach invalid or paid API calls. Restrict this row to Vercel Sandbox, or provide provider-specific references and a provider-neutral fallback.
| Verify by exit code. The remote command prints a sentinel instead of relying on the exit code, | ||
| because a provider CLI may not propagate remote exit codes: |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Rename the verification heading.
The command below does not verify by the provider's exit code. It captures a remote sentinel because the provider may not propagate the remote exit code. Rename this heading to Verify with a remote sentinel so the procedure does not contradict itself.
<!-- orca-pr-loc -->
<!-- Programmatic LoC summary. Do not edit by hand; rewritten on every commit. -->
| | Files | Added | Deleted | Net |
| :--- | ---: | ---: | ---: | ---: |
| Test | 225 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$21666 | $\color{#cf222e}{\Huge{\mathbf{−}}}$2820 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$18846 |
| Prod | 348 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$17107 | $\color{#cf222e}{\Huge{\mathbf{−}}}$4706 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$12401 |
<!-- /orca-pr-loc -->
## ELI5
Orca now treats orchestration like a durable control plane instead of inferring success from terminal keystrokes. Agents can tell whether a prompt was accepted or a turn started, replay an ambiguous request without sending twice, and recover coordinator mail after a crash. Completed workers can be inspected, released, or retained, and their panes no longer auto-resume as if the work were still running.
## What changed
- **Run receipts** from `run-create/use/current/show/list` are the row without routing plumbing (`home_database`, `coordinator_pane_key`) and without the duplicate `binding` object.
- **`terminal send` receipts are honest and idempotent.** `input_accepted` and `turn_started` are the only stages; `--wait-submit` observes without resending; `--retry-request <uuid>` replays the exact request against the same process incarnation. A transport timeout keeps the retry ID; only a different runtime answering strips it. Value-less or non-UUID `--retry-request` is rejected on the CLI and the SSH shim.
- **Mailbox delivery is committed before wakeup.** Pointer writes are staged in the DB before any PTY byte, replayed once after restart, and never emit a naked Enter. The watermark that parks concurrent deliveries is released with the DB reservation. Restart rescans pointer-pending and `dispatch:` mailboxes.
- **Lifecycle is a guarded transition graph** (`lifecycle-transition.ts`) with a table-driven test over every caller edge. Task reopen/overturn stays in the public contract. A PTY exit during `worker-stop` is the stop succeeding, not a failure.
- **Worker lifecycle CLI:** `worker-start` (`--spec` creates Task + attempt in one call), `worker-show`, `worker-read` (provider transcript first, bounded terminal fallback with a typed reason, local/WSL/SSH), `worker-stop`, `worker-abandon`, `worker-release`, `worker-retain`, `worker-list` (rowid-fenced pagination, fleet liveness, `attention`, literal `nextAction`).
- **Release is an explicit ownership table** (`decideWorkerTerminalRelease`): only an `owned` resource can be settled, the archive is mandatory where reachable, and an owner whose process is proven exited can always get out of `retained` via `archive_status: unavailable`. User-taken-over, external, and transferred panes stay retained.
- **Settled-worker resume fence** (folds in #17651): a settled dispatch whose pane is still open is fenced at settlement, on stop/abandon/exit, and at startup; lifted on release, retain, takeover, and pane reuse.
- **Liveness is `live` / `unverifiable` / `exited` only**, from execution-host evidence. Fleet projection reads the evidence clock, not the relay delivery clock. A host-certified exit outranks the worker's settled state. `unverifiable` never authorizes stop, abandon, retry, or release, in code or in the guide.
- **Federation:** structured reads negotiate by `method_not_found` so every shipped host keeps transcript-first output; exited remote workers are closed before being reported closed; epoch fencing holds across peer restart, downgrade, and pairing rotation; no per-second forced capability probe.
- **Schema v35:** repairs databases stamped v34 by the pre-fix branch (mailbox_handle default, index predicates), drops the write-only `lifecycle_transition_receipts` ledger and five never-read v31 identity columns.
- **Schema v36:** `dispatch:<id>` mailboxes get a real consumer generation on `dispatch_contexts` and `remote_dispatch_attachments`, bumped and fenced in the same transaction on every re-attach (manual inject, worker-start, federated attach). A stale worker whose Dispatch moved to another process now gets `consumer_fenced` instead of silently acking the new worker's Delivery. Run mailboxes already worked this way.
- **Schema v37:** `dispatch_contexts` records its creator (`creator_handle`, `creator_pane_key`), so a coordinator's context-only self-dispatch is bookkeeping rather than a nesting parent; before this, one self-dispatch made every later `worker-start` from that coordinator fail the depth cap. Pre-v37 rows keep counting (fails closed).
- **Dispatch-mailbox ownership is checked, not inferred.** A `check` from a process whose pane no longer holds the Dispatch, or whose last Attempt was abandoned/failed and moved to another terminal, gets `consumer_fenced` instead of an empty inbox that reads as "no mail yet". `--peek`/`--all` stay readable. A paneless caller still gets `stable_pane_required` with the rebind recovery.
- **Liveness certification is stricter:** a `process_exited` stage whose termination reason is `unknown` (a stop that was issued but never observed) projects `unverifiable`, not `exited`. Federated `worker-show` carries the execution host's verdict and host kind instead of a local guess. A live, ready worker with nothing pending has `nextAction: none` rather than pointing at the `worker-show` that produced it.
- **Wire:** `workerShow` keeps `dispatch.task_id` next to `taskId` for shipped CLIs. `ask --json` uses the standard `{ok, result}` envelope like every sibling verb.
- **Migration start-version detection** treats the two v32 recovery columns as versioned. Before this, every shipped database stamped below 32 resolved to the v6 floor and replayed the whole chain (the v23 backfill synthesized 68 phantom retained workers on a real v30 profile). Verified on a copy of a real 62 MB v30 profile: starts at 30, no row delta, integrity ok, 11 ms.
- **Skill guide** rewritten as a ≤200-line kernel plus seven references, to the outcome-first standard (Result / Done / Safe failure first, conditions not case lists, one done bar, references loaded at the point of use). The canonical loop uses `worker-start --spec`, names `worker-list` for completion accounting, documents `--retry-request` / `request-show` / `--wait-submit`, and requires positive evidence before any stall action. The other seven guides get the same treatment in #18724, split out so this PR stays orchestration-only.
- **`rpc/methods/orchestration-*`** (126 flat files) regrouped into `orchestration/{worker,federation,messaging,runs,gates}/`.
## Why
User reports showed the same boundary failures: false `agent_prompt_stalled` causing duplicate sends (#15180), coordinators unable to trust screen scrapes, cold-parked terminals receiving a pointer without the submit, settled workers accumulating as live tabs and auto-resuming after restart, and no way to tell a stalled worker from a working one.
## Linked issues
Fixes #15180. Fixes #17935 (orchestration skill description is 866 characters; a guard now caps every bundled skill at 1,024). Supersedes #17651 (fence folded in). Advances #16660, #16522, #14907, #13047.
## Review record
This PR was reviewed adversarially after revival: eight independent lenses (lifecycle, mailbox, send, worker, federation, transcript, complexity, live ergonomics), each required to prove findings with a failing test. That produced 16 proven blockers, all fixed with red-then-green regression tests, followed by two re-review rounds and a third fix wave that caught 3 regressions introduced by the fixes and 7 fixes that missed their target; all closed. A final pass (five lenses incl. a live built-runtime smoke, then a re-review of the fix wave) found and fixed seven more, chiefly the stale-worker mailbox steal, the self-dispatch depth wedge, and the unproven-exit certification. Three independent Codex (gpt-6-astra) passes followed: the first found nothing new, the second found and fixed 3 defects (task-status reachability, WSL-local host classification, peer-capability epoch), the third found and fixed 6 (production PTY controller never installed settled writes, ambiguous in-flight pointer failures allowed duplicate replay, SSH/relay deadlines cut off a valid `--wait-submit`, stop-vs-exit race during inspection, and two release-recovery paths for vanished or exited terminals). The full record (findings, proof tests, triage, declines with reasons) is archived outside the repo.
**Rework after the live smoke.** A first live cross-host run on the shipped adhoc build (this Mac, a paired Windows host on the same build, a paired Mac on 1.4.195, and an SSH host) found a P1: a running local worker read `unverifiable`/`missing_status` because the fleet snapshot rows lacked the terminal handle the matcher keyed on. A 59-row failure table over every bug fixed during review showed the same two classes recurring: a fact dropped in transit through optional fields, and two authorities for one fact. Two blind designs (Opus, Codex) converged on the same mechanisms, and the scoped tranches landed here with red-then-green seam tests from the real producer to the real consumer, faults injected only at the transport or hook-ingest boundary:
- **Settlement (data-loss class):** one three-valued `WriteSettlement` (`accepted | refused{reason} | unverifiable{reason, bytesHandedToTransport}`) from the SSH multiplexer through daemon client, providers, controller, to pointer staging. No boolean, no rejection-as-third-state. The two silent degrades that fabricated a handoff are deleted; a provider that cannot settle refuses before any effect. Pointer text and Enter share the contract; a partial flush is `unverifiable`, never `refused`.
- **Evidence identity (false-liveness class):** fleet agent-status evidence is a tagged union (`binding: worker | pane | unresolved{reason}`, `clock: observed | delivery`) minted once at ingest, so a hook row captured on one process incarnation can never bind to a later dispatch on the same pane. The matcher's `!worker.paneKey ||` defaults are gone. One host-scope parser replaces two.
- **Small pre-merge items:** `capability_unsupported` from an old peer is no longer relabelled `host_unavailable`; a producer census test asserts every agent-status consumer path projects a pane-only hook row as `live`.
Two ergonomics defects the second live run surfaced on a real database are fixed here too: a pre-v3 dispatch already marked `completed` projected as `outcome_unknown` / `requiresAction: true` forever (three copies of the outcome ladder disagreed on legacy rows; now one resolver, legacy `completed` reads `succeeded` with nothing to act on, legacy `failed` stays actionable on the failure), and an unscoped `worker-list` enumerated the entire database (now defaults to the Run bound to the calling terminal, `--run` overrides, and the receipt's additive `scope` field says which).
A third live round on the shipped adhoc build of `b082443e1f` (same four hosts) plus an unscripted run in the user's own prompt style (a plain Claude Code shell, `/orchestration`, three workers, zero errors, bound-Run default confirmed) found two more branch defects, fixed with red-then-green tests: a worker freshly started on a paired server projected `unverifiable`/`host_indeterminate` with `requiresAction` for ~3 minutes, including after its own `worker_done`, because the host's federation observation returned `missing_liveness_verdict` for any PTY the liveness register had not yet swept (the host now reads a connected pane it owns locally as `live`; disconnected or SSH-scoped panes stay `unverifiable`); and six pre-v3 completed rows still carried an `input` category because settling through the task-status path or `failDispatch` never closed the Dispatch's pending question threads (both paths close them now, and schema v38 closes threads already pending on settled rows). The guide's `worker-start` examples now show `--model sonnet`, since an omitted model inherits the launcher's default.
A Codex adversarial pass on the tranche diff found one real design hole (identity minted at read time instead of ingest, now closed) and two daemon settlement paths that threw instead of settling (fixed). Two `@ts-nocheck` runtime mixins on these paths were extracted into checked modules; the repo-wide `@ts-nocheck` count is unchanged at 171.
Deletions during review: ~1,900 lines (write-only ledger, unread columns, dead v1 archive path, test harnesses shipped in prod, duplicated liveness and state-machine copies, self-capability checks that were compile-time true).
## Testing
- `pnpm typecheck:tsc:node|cli|web` clean
- `pnpm run check:code-quality:changed` 0 findings; `check:react-doctor:changed` 0
- `pnpm verify:bundled-skill-guides`, `verify:skill-bundle-manifest`
- full `pnpm test` on the integrated head: 72,332 pass / 292 skipped; the only failures were three non-PR files (two zsh live-shell suites hit a node-pty spawn-helper ENOENT while a concurrent native rebuild ran, 44/44 in isolation; `release-checkout.unit.test.ts` is a known 30 s load timeout that passes in isolation on `origin/main` too).
- CI on 70b4811 (rerun, pre-Codex): the only reds are five SSH e2e specs plus `terminal-send-agent-prompt-submit:198`, each shown failing identically on main (main's E2E workflow is red on its last 40 runs). The terminal-send spec is root-caused and fixed separately in #18707. The Windows hook-service flake (#17721) and the federation load flake did not recur.
- Skills: `pnpm exec vitest run` over the skill gate files plus `src/cli`, `config/scripts`, `src/main/skills` pass; live smoke on the built CLI of `skills get orchestration` and `--full` (7 references).
- live headless runtime (`orca-dev serve`, isolated profile): canonical loop, stop, release, archive read, retry rejection, stale-handle check, SIGKILL-and-replay all verified with receipts
- Live cross-host smoke on the shipped adhoc build of `0d465e7931` (this Mac and a paired Windows host on the build, a paired Mac left on 1.4.195, an SSH host): local, paired-new, paired-old and SSH loops all settle; running workers read `live` on every host and `exited` after release; the old peer reads `capability_unsupported` and refuses release honestly. Injected 10 s relay stall with a send in flight: delivered exactly once after recovery, zero duplicates. Every liveness field across 104 receipts is only `live` / `unverifiable` / `exited`.
- Final live cross-host smoke on the shipped adhoc build of `b082443e1f` (same hosts): every loop settles; 942 of 948 legacy completed rows read settled with `requiresAction: false` before the question-thread fix and all of them after; `worker-list` scope reads `bound` / `flag` / `all` correctly; 122 JSON receipts carry only `live` / `unverifiable` / `exited`. Unscripted prompt-style run: clean.
- Confirmation smoke on the shipped adhoc build of `2da076d4e9` (this Mac and the paired Windows host, both updated): a freshly started Windows worker reads `live` on the first fleet poll and on all 20 that follow, with no `host_indeterminate` at any point, and `exited` after release; all 948 legacy completed rows read `requiresAction: false` with `nextAction: none` after schema v38; every verdict across 60 receipts is `live` / `unverifiable` / `exited`.
- Not physically exercised: WSL hosts, the renderer notification bell (headless has no renderer), same-session fence via a real pane close (renderer-only state), restart mid-delivery on a real app (covered by e2e only).
## Notes
- Remote-wire additions are optional fields or `method_not_found`-negotiated methods; one new Electron-only IPC channel (`agentStatus:legacyWorkerTerminalResumeFence`) never crosses the wire.
- SSH contact loss remains `unverifiable`; the execution host stays authoritative.
- Intentional wire projection change: an SSH host scope with an empty `targetId` now projects host id `ssh` instead of an empty string (remote-wire-compatibility rule 3, old clients decode the same field). A fleet pane key without a terminal handle is now `unidentifiable` rather than matched by pane key alone.
- Found live but pre-existing on main, filed separately: a relay daemon-start collision during transport loss rewrites the endpoint credential and wedges the surviving relay (host needs a manual kill); `terminal create` on a reconnecting SSH host reports an opaque `No PTY provider for connection`; `terminal list` reports `orphaned:false` and `terminal close` reports `ptyKilled:true` for a pane whose relay is gone (orchestration's own projection reads `unverifiable` correctly at the same moment).
- Downgrade after this PR is not a supported path: main opens a v37 database and early-returns (its inserts still work against the v36/v37 defaulted columns), but its one-outstanding-Delivery-per-Run index is a no-op against the branch's mailbox-scoped index of the same name.
- Known follow-ups (not blockers): `worker-list` materializes every dispatch row per call; a positive "agent absent" signal distinct from PTY liveness is a product decision left open (a headless fake agent never reaches `live`, so its `nextAction` stays `inspect`); a context-only self-dispatch still lists as `role: worker` in `worker-list`; `dispatch` task-not-found / task-not-ready / inject-rejected still surface as `runtime_error`; task and inbox receipts still expose raw row columns. Deferred skill product decisions live on #18724.
Resolves the skills-get --reference seam from #16904: the generator, its test, the skills spec, help text, and the orchestration stub all take main's per-reference support; the shared resolver fragment and the generalized reference-routing test from this branch stay. orca-cli.md keeps main's --wait-submit bullets plus this branch's accepted-bytes rule. The size-budget ratchet drops orchestration, which is now a 200-line kernel.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Both guides told agents to load --full at a gate because the per-reference selector did not exist when they were written. Now that main serves `skills get <topic> --reference references/<file>.md`, load only the named file and keep --full as the fallback for an older CLI, matching the orchestration kernel.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Merged
origin/main, pulling the orchestration rewrite into this branch. The orchestration guide now bundles sevenreferences/documents and shares the outcome-first spine, andskills getgains a working--reference <name>/--referencesselector that this PR's body had previously listed as deferred. - Reconciled the
orca-cliterminal rules with main'sterminal sendvocabulary. The guide now names--wait-submit,--retry-request, theinput_accepted/turn_startedstages, and the older-hostold-hostfallback, all of which resolve againstCOMMAND_SPECS; theaccepted: truehandoff bar remains intact beside them. - Generator emits per-reference constants and a
referencesfield with a name-collision guard, so--referenceserves each document verbatim and--fullstill composes the whole package. - Dropped
orchestrationfrom the size-budget ratchet now that its kernel fits under the bound.
I verified the load-bearing claims against the source (terminal-send.ts, orchestration-worker-specs.ts, skill-guide-get.ts) and ran the parity, generator, size-budget, description-length, guidance, and --reference-selector suites — all green.
ℹ️ PR description is now stale after the merge
The "Deferred product decisions" section still lists skills get --reference <name> as deferred (it shipped via the merge), and "Relationship to #16904" still says main has no --wait-submit (main now has it and the branch uses it). Worth a one-line refresh of the non-table prose before merge; no code change needed.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Routed the
orca-cliandorca-per-workspace-envconditional-reference gates through--reference. Both guides now tell the agent to runskills get <topic> --reference references/<file>.mdand read only that document, with--fullas the fallback for a CLI that predates the per-reference selector and--helpas the last resort. This matches the orchestration stub's already-consistent pattern and is a cleaner match for "references loaded at the point of use" than always fetching the whole package.
I confirmed the new wording resolves against the CLI: --reference accepts both the references/<file>.md spelling and the bare name (normalizeReferenceSelector in skill-guide-get.ts), the parity guard treats skills get <topic> --reference … as a valid skills get invocation, and the guidance tests assert the new --reference-first wording. All relevant suites pass.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Reopened after the revert (#19126). This branch is now the single home for the skill work; nothing merges without explicit sign-off. Since the original review, two commits on top of the merge with main: 914b766 drops the Result/Done/Safe-failure preambles and Next Action closers from the six CLI-wrapper guides (orchestration and per-workspace-env keep theirs). f344a77 trims the redundancy:
Skill guidance, generator, manifest, parity, and CLI skills suites pass (194 tests). Changed-code lint and |
<!-- orca-pr-loc -->
<!-- Programmatic LoC summary. Do not edit by hand; rewritten on every commit. -->
| | Files | Added | Deleted | Net |
| :--- | ---: | ---: | ---: | ---: |
| Test | 225 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$21666 | $\color{#cf222e}{\Huge{\mathbf{−}}}$2820 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$18846 |
| Prod | 348 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$17107 | $\color{#cf222e}{\Huge{\mathbf{−}}}$4706 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$12401 |
<!-- /orca-pr-loc -->
## ELI5
Orca now treats orchestration like a durable control plane instead of inferring success from terminal keystrokes. Agents can tell whether a prompt was accepted or a turn started, replay an ambiguous request without sending twice, and recover coordinator mail after a crash. Completed workers can be inspected, released, or retained, and their panes no longer auto-resume as if the work were still running.
## What changed
- **Run receipts** from `run-create/use/current/show/list` are the row without routing plumbing (`home_database`, `coordinator_pane_key`) and without the duplicate `binding` object.
- **`terminal send` receipts are honest and idempotent.** `input_accepted` and `turn_started` are the only stages; `--wait-submit` observes without resending; `--retry-request <uuid>` replays the exact request against the same process incarnation. A transport timeout keeps the retry ID; only a different runtime answering strips it. Value-less or non-UUID `--retry-request` is rejected on the CLI and the SSH shim.
- **Mailbox delivery is committed before wakeup.** Pointer writes are staged in the DB before any PTY byte, replayed once after restart, and never emit a naked Enter. The watermark that parks concurrent deliveries is released with the DB reservation. Restart rescans pointer-pending and `dispatch:` mailboxes.
- **Lifecycle is a guarded transition graph** (`lifecycle-transition.ts`) with a table-driven test over every caller edge. Task reopen/overturn stays in the public contract. A PTY exit during `worker-stop` is the stop succeeding, not a failure.
- **Worker lifecycle CLI:** `worker-start` (`--spec` creates Task + attempt in one call), `worker-show`, `worker-read` (provider transcript first, bounded terminal fallback with a typed reason, local/WSL/SSH), `worker-stop`, `worker-abandon`, `worker-release`, `worker-retain`, `worker-list` (rowid-fenced pagination, fleet liveness, `attention`, literal `nextAction`).
- **Release is an explicit ownership table** (`decideWorkerTerminalRelease`): only an `owned` resource can be settled, the archive is mandatory where reachable, and an owner whose process is proven exited can always get out of `retained` via `archive_status: unavailable`. User-taken-over, external, and transferred panes stay retained.
- **Settled-worker resume fence** (folds in stablyai#17651): a settled dispatch whose pane is still open is fenced at settlement, on stop/abandon/exit, and at startup; lifted on release, retain, takeover, and pane reuse.
- **Liveness is `live` / `unverifiable` / `exited` only**, from execution-host evidence. Fleet projection reads the evidence clock, not the relay delivery clock. A host-certified exit outranks the worker's settled state. `unverifiable` never authorizes stop, abandon, retry, or release, in code or in the guide.
- **Federation:** structured reads negotiate by `method_not_found` so every shipped host keeps transcript-first output; exited remote workers are closed before being reported closed; epoch fencing holds across peer restart, downgrade, and pairing rotation; no per-second forced capability probe.
- **Schema v35:** repairs databases stamped v34 by the pre-fix branch (mailbox_handle default, index predicates), drops the write-only `lifecycle_transition_receipts` ledger and five never-read v31 identity columns.
- **Schema v36:** `dispatch:<id>` mailboxes get a real consumer generation on `dispatch_contexts` and `remote_dispatch_attachments`, bumped and fenced in the same transaction on every re-attach (manual inject, worker-start, federated attach). A stale worker whose Dispatch moved to another process now gets `consumer_fenced` instead of silently acking the new worker's Delivery. Run mailboxes already worked this way.
- **Schema v37:** `dispatch_contexts` records its creator (`creator_handle`, `creator_pane_key`), so a coordinator's context-only self-dispatch is bookkeeping rather than a nesting parent; before this, one self-dispatch made every later `worker-start` from that coordinator fail the depth cap. Pre-v37 rows keep counting (fails closed).
- **Dispatch-mailbox ownership is checked, not inferred.** A `check` from a process whose pane no longer holds the Dispatch, or whose last Attempt was abandoned/failed and moved to another terminal, gets `consumer_fenced` instead of an empty inbox that reads as "no mail yet". `--peek`/`--all` stay readable. A paneless caller still gets `stable_pane_required` with the rebind recovery.
- **Liveness certification is stricter:** a `process_exited` stage whose termination reason is `unknown` (a stop that was issued but never observed) projects `unverifiable`, not `exited`. Federated `worker-show` carries the execution host's verdict and host kind instead of a local guess. A live, ready worker with nothing pending has `nextAction: none` rather than pointing at the `worker-show` that produced it.
- **Wire:** `workerShow` keeps `dispatch.task_id` next to `taskId` for shipped CLIs. `ask --json` uses the standard `{ok, result}` envelope like every sibling verb.
- **Migration start-version detection** treats the two v32 recovery columns as versioned. Before this, every shipped database stamped below 32 resolved to the v6 floor and replayed the whole chain (the v23 backfill synthesized 68 phantom retained workers on a real v30 profile). Verified on a copy of a real 62 MB v30 profile: starts at 30, no row delta, integrity ok, 11 ms.
- **Skill guide** rewritten as a ≤200-line kernel plus seven references, to the outcome-first standard (Result / Done / Safe failure first, conditions not case lists, one done bar, references loaded at the point of use). The canonical loop uses `worker-start --spec`, names `worker-list` for completion accounting, documents `--retry-request` / `request-show` / `--wait-submit`, and requires positive evidence before any stall action. The other seven guides get the same treatment in stablyai#18724, split out so this PR stays orchestration-only.
- **`rpc/methods/orchestration-*`** (126 flat files) regrouped into `orchestration/{worker,federation,messaging,runs,gates}/`.
## Why
User reports showed the same boundary failures: false `agent_prompt_stalled` causing duplicate sends (stablyai#15180), coordinators unable to trust screen scrapes, cold-parked terminals receiving a pointer without the submit, settled workers accumulating as live tabs and auto-resuming after restart, and no way to tell a stalled worker from a working one.
## Linked issues
Fixes stablyai#15180. Fixes stablyai#17935 (orchestration skill description is 866 characters; a guard now caps every bundled skill at 1,024). Supersedes stablyai#17651 (fence folded in). Advances stablyai#16660, stablyai#16522, stablyai#14907, stablyai#13047.
## Review record
This PR was reviewed adversarially after revival: eight independent lenses (lifecycle, mailbox, send, worker, federation, transcript, complexity, live ergonomics), each required to prove findings with a failing test. That produced 16 proven blockers, all fixed with red-then-green regression tests, followed by two re-review rounds and a third fix wave that caught 3 regressions introduced by the fixes and 7 fixes that missed their target; all closed. A final pass (five lenses incl. a live built-runtime smoke, then a re-review of the fix wave) found and fixed seven more, chiefly the stale-worker mailbox steal, the self-dispatch depth wedge, and the unproven-exit certification. Three independent Codex (gpt-6-astra) passes followed: the first found nothing new, the second found and fixed 3 defects (task-status reachability, WSL-local host classification, peer-capability epoch), the third found and fixed 6 (production PTY controller never installed settled writes, ambiguous in-flight pointer failures allowed duplicate replay, SSH/relay deadlines cut off a valid `--wait-submit`, stop-vs-exit race during inspection, and two release-recovery paths for vanished or exited terminals). The full record (findings, proof tests, triage, declines with reasons) is archived outside the repo.
**Rework after the live smoke.** A first live cross-host run on the shipped adhoc build (this Mac, a paired Windows host on the same build, a paired Mac on 1.4.195, and an SSH host) found a P1: a running local worker read `unverifiable`/`missing_status` because the fleet snapshot rows lacked the terminal handle the matcher keyed on. A 59-row failure table over every bug fixed during review showed the same two classes recurring: a fact dropped in transit through optional fields, and two authorities for one fact. Two blind designs (Opus, Codex) converged on the same mechanisms, and the scoped tranches landed here with red-then-green seam tests from the real producer to the real consumer, faults injected only at the transport or hook-ingest boundary:
- **Settlement (data-loss class):** one three-valued `WriteSettlement` (`accepted | refused{reason} | unverifiable{reason, bytesHandedToTransport}`) from the SSH multiplexer through daemon client, providers, controller, to pointer staging. No boolean, no rejection-as-third-state. The two silent degrades that fabricated a handoff are deleted; a provider that cannot settle refuses before any effect. Pointer text and Enter share the contract; a partial flush is `unverifiable`, never `refused`.
- **Evidence identity (false-liveness class):** fleet agent-status evidence is a tagged union (`binding: worker | pane | unresolved{reason}`, `clock: observed | delivery`) minted once at ingest, so a hook row captured on one process incarnation can never bind to a later dispatch on the same pane. The matcher's `!worker.paneKey ||` defaults are gone. One host-scope parser replaces two.
- **Small pre-merge items:** `capability_unsupported` from an old peer is no longer relabelled `host_unavailable`; a producer census test asserts every agent-status consumer path projects a pane-only hook row as `live`.
Two ergonomics defects the second live run surfaced on a real database are fixed here too: a pre-v3 dispatch already marked `completed` projected as `outcome_unknown` / `requiresAction: true` forever (three copies of the outcome ladder disagreed on legacy rows; now one resolver, legacy `completed` reads `succeeded` with nothing to act on, legacy `failed` stays actionable on the failure), and an unscoped `worker-list` enumerated the entire database (now defaults to the Run bound to the calling terminal, `--run` overrides, and the receipt's additive `scope` field says which).
A third live round on the shipped adhoc build of `b082443e1f` (same four hosts) plus an unscripted run in the user's own prompt style (a plain Claude Code shell, `/orchestration`, three workers, zero errors, bound-Run default confirmed) found two more branch defects, fixed with red-then-green tests: a worker freshly started on a paired server projected `unverifiable`/`host_indeterminate` with `requiresAction` for ~3 minutes, including after its own `worker_done`, because the host's federation observation returned `missing_liveness_verdict` for any PTY the liveness register had not yet swept (the host now reads a connected pane it owns locally as `live`; disconnected or SSH-scoped panes stay `unverifiable`); and six pre-v3 completed rows still carried an `input` category because settling through the task-status path or `failDispatch` never closed the Dispatch's pending question threads (both paths close them now, and schema v38 closes threads already pending on settled rows). The guide's `worker-start` examples now show `--model sonnet`, since an omitted model inherits the launcher's default.
A Codex adversarial pass on the tranche diff found one real design hole (identity minted at read time instead of ingest, now closed) and two daemon settlement paths that threw instead of settling (fixed). Two `@ts-nocheck` runtime mixins on these paths were extracted into checked modules; the repo-wide `@ts-nocheck` count is unchanged at 171.
Deletions during review: ~1,900 lines (write-only ledger, unread columns, dead v1 archive path, test harnesses shipped in prod, duplicated liveness and state-machine copies, self-capability checks that were compile-time true).
## Testing
- `pnpm typecheck:tsc:node|cli|web` clean
- `pnpm run check:code-quality:changed` 0 findings; `check:react-doctor:changed` 0
- `pnpm verify:bundled-skill-guides`, `verify:skill-bundle-manifest`
- full `pnpm test` on the integrated head: 72,332 pass / 292 skipped; the only failures were three non-PR files (two zsh live-shell suites hit a node-pty spawn-helper ENOENT while a concurrent native rebuild ran, 44/44 in isolation; `release-checkout.unit.test.ts` is a known 30 s load timeout that passes in isolation on `origin/main` too).
- CI on 70b4811 (rerun, pre-Codex): the only reds are five SSH e2e specs plus `terminal-send-agent-prompt-submit:198`, each shown failing identically on main (main's E2E workflow is red on its last 40 runs). The terminal-send spec is root-caused and fixed separately in stablyai#18707. The Windows hook-service flake (stablyai#17721) and the federation load flake did not recur.
- Skills: `pnpm exec vitest run` over the skill gate files plus `src/cli`, `config/scripts`, `src/main/skills` pass; live smoke on the built CLI of `skills get orchestration` and `--full` (7 references).
- live headless runtime (`orca-dev serve`, isolated profile): canonical loop, stop, release, archive read, retry rejection, stale-handle check, SIGKILL-and-replay all verified with receipts
- Live cross-host smoke on the shipped adhoc build of `0d465e7931` (this Mac and a paired Windows host on the build, a paired Mac left on 1.4.195, an SSH host): local, paired-new, paired-old and SSH loops all settle; running workers read `live` on every host and `exited` after release; the old peer reads `capability_unsupported` and refuses release honestly. Injected 10 s relay stall with a send in flight: delivered exactly once after recovery, zero duplicates. Every liveness field across 104 receipts is only `live` / `unverifiable` / `exited`.
- Final live cross-host smoke on the shipped adhoc build of `b082443e1f` (same hosts): every loop settles; 942 of 948 legacy completed rows read settled with `requiresAction: false` before the question-thread fix and all of them after; `worker-list` scope reads `bound` / `flag` / `all` correctly; 122 JSON receipts carry only `live` / `unverifiable` / `exited`. Unscripted prompt-style run: clean.
- Confirmation smoke on the shipped adhoc build of `2da076d4e9` (this Mac and the paired Windows host, both updated): a freshly started Windows worker reads `live` on the first fleet poll and on all 20 that follow, with no `host_indeterminate` at any point, and `exited` after release; all 948 legacy completed rows read `requiresAction: false` with `nextAction: none` after schema v38; every verdict across 60 receipts is `live` / `unverifiable` / `exited`.
- Not physically exercised: WSL hosts, the renderer notification bell (headless has no renderer), same-session fence via a real pane close (renderer-only state), restart mid-delivery on a real app (covered by e2e only).
## Notes
- Remote-wire additions are optional fields or `method_not_found`-negotiated methods; one new Electron-only IPC channel (`agentStatus:legacyWorkerTerminalResumeFence`) never crosses the wire.
- SSH contact loss remains `unverifiable`; the execution host stays authoritative.
- Intentional wire projection change: an SSH host scope with an empty `targetId` now projects host id `ssh` instead of an empty string (remote-wire-compatibility rule 3, old clients decode the same field). A fleet pane key without a terminal handle is now `unidentifiable` rather than matched by pane key alone.
- Found live but pre-existing on main, filed separately: a relay daemon-start collision during transport loss rewrites the endpoint credential and wedges the surviving relay (host needs a manual kill); `terminal create` on a reconnecting SSH host reports an opaque `No PTY provider for connection`; `terminal list` reports `orphaned:false` and `terminal close` reports `ptyKilled:true` for a pane whose relay is gone (orchestration's own projection reads `unverifiable` correctly at the same moment).
- Downgrade after this PR is not a supported path: main opens a v37 database and early-returns (its inserts still work against the v36/v37 defaulted columns), but its one-outstanding-Delivery-per-Run index is a no-op against the branch's mailbox-scoped index of the same name.
- Known follow-ups (not blockers): `worker-list` materializes every dispatch row per call; a positive "agent absent" signal distinct from PTY liveness is a product decision left open (a headless fake agent never reaches `live`, so its `nextAction` stays `inspect`); a context-only self-dispatch still lists as `role: worker` in `worker-list`; `dispatch` task-not-found / task-not-ready / inject-rejected still surface as `runtime_error`; task and inbox receipts still expose raw row columns. Deferred skill product decisions live on stablyai#18724.
…st standard (stablyai#18724) <!-- orca-pr-loc --> <!-- Programmatic LoC summary. Do not edit by hand; rewritten on every commit. --> | | Files | Added | Deleted | Net | | :--- | ---: | ---: | ---: | ---: | | Test | 6 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$544 | $\color{#cf222e}{\Huge{\mathbf{−}}}$49 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$495 | | Prod | 36 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$1719 | $\color{#cf222e}{\Huge{\mathbf{−}}}$1703 | $\color{#1a7f37}{\Huge{\mathbf{+}}}$16 | <!-- /orca-pr-loc --> ## ELI5 Orca ships eight skill guides that agents read before running the CLI. Seven of them (everything except `orchestration`, which stablyai#16904 rewrites) were command catalogs that had drifted from the binary. This PR rewrites them so an agent reads the outcome, the done bar, and the safe-failure rule first, loads reference material only at the step that needs it, and never sees a command or flag the installed CLI does not define. ## What changed - **Seven guides rewritten** to one standard: outcome spine first (Result / Done / Safe failure), conditions instead of case lists, one done bar, one autonomy envelope, references loaded at the point of use via `skills get <topic> --full`, every runnable invocation spelled `ORCA`. `orca-cli` is 424→260 always-loaded lines with three references (browser, automations, publishing); `orca-per-workspace-env` is 794→397 with five (provider-vercel, ssh-host, docker-ssh, windows-scripts, failure-modes). - **Defects fixed in shipped guides:** `emulator camera` (no such command), iOS `permissions` (backend refuses it), Android pane described as "in development" (shipped in June), `relayGracePeriodSeconds: 0` documented as immediate teardown (it is unbounded), doctor `ok: true` hiding `warn`, an SSH exemplar setting both `jumpHost` and `proxyCommand`, a provisioned-root fetch from `origin`, the Linear unconfirmed-write rule keyed on four verbs when ten emit it. Linear and emulator descriptions dropped embedded commands and angle-bracket placeholders (651→329, 732→404 chars). - **Generator bundles references.** `skill-guides/<name>/references/*.md` is appended to `--full`; `skills get` help says compact by default, full with references. - **Stubs single-authored.** The resolver ladder, placeholder rule, and older-binary fallback shared by all eight installable `SKILL.md` files come from one `skill-stubs/_shared/cli-resolution.md` fragment composed by the generator. Projections were byte-identical before the content fixes. - **Guards:** every `ORCA <cmd>` and flag in every guide and reference resolves against `COMMAND_SPECS` (this found the camera defect); descriptions ≤1024 chars with no angle-bracket tokens; reference routing checked both directions; an always-loaded size ratchet (300 lines) that guides may leave but never join. `orchestration` (440 lines on main) is recorded as an exception until stablyai#16904 lands its kernel. ## Relationship to stablyai#16904 Split out of stablyai#16904 so that PR carries only the orchestration guide. On main, `terminal send` has no `--wait-submit` / `--retry-request` and the orchestration kernel still carries the resolver ladder and worktree-selector rule, so this branch pins `accepted: true` for handoff receipts and leaves the orchestration pins where main has them. The merge in either direction is mechanical: stablyai#16904 rebased on this becomes a one-file `orchestration.md` change plus dropping the two exceptions. ## Standard Compound Engineering's portable skill-authoring guidance (outcome spine, conditions not cases, pinned fragile commands with an ordered hatch, references at point of use). NVIDIA SkillEvaluator Tier 1 (`schema,pii,license,quality,unicode,lint`) was run on every guide; its deterministic checks pass, its template nudges (Instructions/Examples sections, 50–150 char descriptions) do not apply to Orca's stub architecture and were not applied. ## Testing - `pnpm typecheck:tsc:cli` clean; `check:code-quality:changed` and `check:react-doctor:changed` 0 findings - `pnpm verify:bundled-skill-guides` and skill-bundle manifest verify clean - vitest over `config/scripts`, `src/cli/skill-guide-cli-parity.test.ts`, `src/cli/skills.test.ts`, `src/cli/specs/skills.test.ts`, `src/cli/help.test.ts`, `src/main/skills`: 240 files / 2,019 pass - Live smoke on the built CLI of every `skills get <topic>` and `--full`, every emulator, linear, and vm verb named in the guides, and every projection's resolver, GNOME warning, and bounded fallback (done on the stablyai#16904 branch before the split; the guide bodies are identical here except the send-receipt vocabulary noted above) ## Deferred product decisions Merging `orca-emulator` and `orca-emulator-android` into one skill with a platform branch; collapsing `linear-tickets` to a guide alias; a `skills get --reference <name>` selector so a gate table can load one file; a fresh-agent routing eval before trimming the `orca-cli` (1,015 chars) and `orchestration` descriptions, whose quoted triggers each fixed a routing misroute.
…come-first standard (stablyai#18724)" (stablyai#19126) This reverts commit b685c7a.

ELI5
Orca ships eight skill guides that agents read before running the CLI. Seven of them (everything except
orchestration, which #16904 rewrites) were command catalogs that had drifted from the binary. This PR rewrites them so an agent reads the outcome, the done bar, and the safe-failure rule first, loads reference material only at the step that needs it, and never sees a command or flag the installed CLI does not define.What changed
skills get <topic> --full, every runnable invocation spelledORCA.orca-cliis 424→260 always-loaded lines with three references (browser, automations, publishing);orca-per-workspace-envis 794→397 with five (provider-vercel, ssh-host, docker-ssh, windows-scripts, failure-modes).emulator camera(no such command), iOSpermissions(backend refuses it), Android pane described as "in development" (shipped in June),relayGracePeriodSeconds: 0documented as immediate teardown (it is unbounded), doctorok: truehidingwarn, an SSH exemplar setting bothjumpHostandproxyCommand, a provisioned-root fetch fromorigin, the Linear unconfirmed-write rule keyed on four verbs when ten emit it. Linear and emulator descriptions dropped embedded commands and angle-bracket placeholders (651→329, 732→404 chars).skill-guides/<name>/references/*.mdis appended to--full;skills gethelp says compact by default, full with references.SKILL.mdfiles come from oneskill-stubs/_shared/cli-resolution.mdfragment composed by the generator. Projections were byte-identical before the content fixes.ORCA <cmd>and flag in every guide and reference resolves againstCOMMAND_SPECS(this found the camera defect); descriptions ≤1024 chars with no angle-bracket tokens; reference routing checked both directions; an always-loaded size ratchet (300 lines) that guides may leave but never join.orchestration(440 lines on main) is recorded as an exception until feat(orchestration): make multi-agent workflows durable #16904 lands its kernel.Relationship to #16904
Split out of #16904 so that PR carries only the orchestration guide. On main,
terminal sendhas no--wait-submit/--retry-requestand the orchestration kernel still carries the resolver ladder and worktree-selector rule, so this branch pinsaccepted: truefor handoff receipts and leaves the orchestration pins where main has them. The merge in either direction is mechanical: #16904 rebased on this becomes a one-fileorchestration.mdchange plus dropping the two exceptions.Standard
Compound Engineering's portable skill-authoring guidance (outcome spine, conditions not cases, pinned fragile commands with an ordered hatch, references at point of use). NVIDIA SkillEvaluator Tier 1 (
schema,pii,license,quality,unicode,lint) was run on every guide; its deterministic checks pass, its template nudges (Instructions/Examples sections, 50–150 char descriptions) do not apply to Orca's stub architecture and were not applied.Testing
pnpm typecheck:tsc:cliclean;check:code-quality:changedandcheck:react-doctor:changed0 findingspnpm verify:bundled-skill-guidesand skill-bundle manifest verify cleanconfig/scripts,src/cli/skill-guide-cli-parity.test.ts,src/cli/skills.test.ts,src/cli/specs/skills.test.ts,src/cli/help.test.ts,src/main/skills: 240 files / 2,019 passskills get <topic>and--full, every emulator, linear, and vm verb named in the guides, and every projection's resolver, GNOME warning, and bounded fallback (done on the feat(orchestration): make multi-agent workflows durable #16904 branch before the split; the guide bodies are identical here except the send-receipt vocabulary noted above)Deferred product decisions
Merging
orca-emulatorandorca-emulator-androidinto one skill with a platform branch; collapsinglinear-ticketsto a guide alias; askills get --reference <name>selector so a gate table can load one file; a fresh-agent routing eval before trimming theorca-cli(1,015 chars) andorchestrationdescriptions, whose quoted triggers each fixed a routing misroute.