Repository navigation
feat(orchestration): reject a worker-start --model the host's CLI does not list - #19937
brennanb2025 wants to merge 8 commits into
Conversation
…s not list `worker-start --model <id>` previously passed any id straight to the agent launch, so a typo or a retired id produced a terminal that died on startup with no explanation from Orca. Ask the host that will actually run the worker. `resolveWorkerLaunchModelAuthority` reuses the probe the native chat model picker already uses (`discoverRuntimeCommitMessageModels`), which routes local / WSL / SSH from the worktree selector, so the set `worker-start` accepts is the set the picker lists. Three limits keep the gate honest: - It refuses only when the authority's `source` is `live` — the host's CLI actually answered. A seed fallback (probe failed, timed out, or fell back to Orca's own list) accepts the id and lets the agent CLI report: loss of contact is never evidence that a model does not exist there (`docs/reference/ssh-execution-boundary.md`). - Strictness follows `discoveredModelsReplaceSeed`. Claude and `discoveredModelsAreAuthoritative` catalogs replace the seed, so their lists are complete and may refuse. Codex, Gemini and Cursor only extend the seed — their lists depend on the account and are not exhaustive — so they are not probed at all and refuse nothing. - Effort validation stays the catalog's, unchanged. A probe reports membership only, so its generic level list can never narrow a seeded model's menu. The probe is cached per executing host (`local` / `wsl:<distro>` / `ssh:<id>`) rather than per caller, since one machine's CLI list is one fact; failures are never cached, and a dispatch that gives up on its 10s budget leaves the probe running to fill the cache for the next one. The rejection names the agent, the refused id, and the sorted ids the host listed — never a built-in list presented as authoritative.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the full diff (16 files, 1 commit) end to end.
- Worker-start model authority gate —
worker-start --modelnow probes the agent CLI on the executing host and rejects an id that host does not list, naming the accepted ids in the error. - Shared replace-vs-extend policy —
discoveredModelsReplaceSeedandresolveDiscoveredCatalogModelsare extracted so the native-chat picker and the worker-start gate read the same catalog policy; onlyliveanswers (claude + authoritative catalogs) may reject. - Host-keyed discovery cache — probe results are cached per executing host (
local/wsl:<distro>/ssh:<id>) with a 3-minute TTL, no failure caching, and in-flight dedup; a dispatch that exhausts its 10s budget leaves the probe running to fill the cache. - Runtime git surface — a new
resolveRuntimeCommitMessageDiscoveryHostKeymethod, plusprepareLocalWorkerStart/prepareFederationAttachmentWorkerStartbecome async; the resolvedcallerWorktreeIdis reused so a--modeldispatch pays oneshowTerminalround trip instead of two. - Tests —
worker-launch-model-authority.test.tsandworker-start-validation.test.tspin the authority/cache semantics and the placement → selector mapping.
I verified the resolveDiscoveredCatalogModels extraction is behavior-preserving against the original inline branch in native-chat-session-option-enrichment.ts (claude replaces, authoritative merges, otherwise unions), discoveredModelsReplaceSeed matches the picker's discovery gate exactly, and the catalogOrigin === 'probe' guard correctly distinguishes a live CLI answer from a spec fallback. The tests use exact assertions and would fail with the gate removed or loosened.
ℹ️ Cold-start probe latency (mergeable as-is)
The first worker-start --model on a host now awaits a foreground CLI probe before creating the worker, bounded at 10s. The renderer picker's separate enrichmentByAgentHost cache does not warm the new cachedByHost map, so a cold host pays a full listModels round trip on the first dispatch (and a slow WSL/SSH host can stall for the full budget). This is a deliberate, documented tradeoff and the fallback is safe — noting it only for awareness, not as a blocker.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change adds host-specific model discovery targets and host-key resolution for local, remote, repository, and folder-workspace launches. Worker-start validation now applies live model authority, resolved model IDs, aliases, account-aware caching, shared discovery deadlines, and seed fallbacks. Local and federated preparation now awaits asynchronous validation. Claude model metadata carries resolved IDs, and catalog reconciliation is centralized. Tests cover discovery, caching, placement, validation, and dispatch behavior. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to A single hung model-discovery request can cause later worker starts on that host to skip live model validation until restart. Fix this before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e8b8359f-4ca9-4f32-a148-439308547b96
📒 Files selected for processing (16)
src/cli/specs/orchestration-worker-specs.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/rpc/methods/orchestration/federation/federation.tssrc/main/runtime/rpc/methods/orchestration/worker/composed-workers.test.tssrc/main/runtime/rpc/methods/orchestration/worker/local-worker-start.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-start-validation.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-start-validation.tssrc/main/runtime/rpc/methods/orchestration/worker/workers-new-worktree.test.tssrc/main/runtime/runtime-git-command-surface.tssrc/main/runtime/runtime-git-generation-commands.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.tssrc/shared/agent-session-option-catalog.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
…nknown-model-at-worker-start
…nknown-model-at-worker-start
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the incremental delta of 81405ed over the previously reviewed 36015ff.
- Stable CLI aliases accepted alongside the live list — the reject gate now admits the four seeded Claude aliases (
fable/opus/sonnet/haiku) when the host lists them or a bracket-qualified variant, plus each listed model'sresolvedModelfull id, so a valid--model opusis no longer refused when the CLI only listsopus[1m]. - Destination-repo probing —
WorkerLaunchModelDiscoveryTargetnow also accepts{ repoSelector }, sonew-child/new-top-levelplacements (local and federated) probe the host that will actually create the worktree instead of the coordinator's host or none. - Unified discovery budget — the single 10s deadline now covers host-key resolution and the CLI probe together, closing the previously unbounded host-resolve window.
resolveRuntimeModelDiscoveryTarget— a new optional host seam resolvescwd+executionHostIdfrom a repo or folder workspace, decoupling model discovery from an existing Git worktree.
Verified the alias matcher cannot over-admit (the [...] prefix guard prevents family-name prefix collisions, and a non-family id such as claude-opus-5 is still refused against the resolved claude-opus-5[1m]), that only Claude reaches the live gate (grok is authoritative but lacks supportsWorkerLaunchPreferences, so it throws "does not support launch-time model selection" first), and that { repoSelector } never crosses the RPC wire (git.discoverCommitMessageModels still takes a string params.worktree); the new resolvedModel field is additive on non-strict settings schemas. Tests use exact assertions and would fail with the gate loosened.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the incremental delta of 9a09d30 over the previously approved 81405ed (316c5f2 was a pure base merge).
- Command override threaded into the probe —
resolveWorkerLaunchModelAuthoritynow forwardssettings.agentCmdOverrides?.[agent]asagentCmdOverridestodiscoverRuntimeCommitMessageModels, so the gate queries the CLI invocation that will actually run rather than the stock binary. - Terminal-only customization skips rejection — when
getClientSettings()is unavailable orhasExplicitTuiLaunchCustomizationflags default args/env the probe cannot see, the gate is skipped and the id is accepted, since a probe answer that omits that customization is not evidence about the actual launch. defaultadmitted as a launch alias — the Claude catalog gainslaunchModelAliases: ['default'], becauselist_modelspublishesdefaultbut picker discovery drops the mirror row;--model defaultis no longer wrongly refused.- Cache scope widened — the discovery cache is now keyed by
(agent, host, command override)instead of(agent, host), so two different overrides on one host no longer share a single CLI fact.
Verified the empty-override path is safe (planAgentBinary treats '' as "no override", and the ?? fallback in discoverRuntimeCommitMessageModels is bypassed only with the same value the caller already read from the shared settings store), that the common no-customization case still probes (default args/env resolve to {}/undefined, so hasExplicitTuiLaunchCustomization returns false), and that default is only admitted for Claude (it is the sole catalog setting launchModelAliases). Tests pin the override threading, the terminal-customization skip, the distinct-per-override cache, and the default membership.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…nknown-model-at-worker-start
…nknown-model-at-worker-start
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.ts (1)
242-242: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winEvict timed-out discovery promises.
When
withDiscoveryDeadline(pending, deadlineAt)returnsDISCOVERY_BUDGET_EXPIRED,inFlightByScopestill points topending. A later launch with the same scope reuses that promise, returns seed authority after its own deadline, and never starts a new probe. BecauseresolveWorkerLaunchPreferencesrejects only live authority, those launches skip host model validation.Remove the entry when the deadline expires, but only if it still maps to
pending. Also guard the settlement handler before deleting or caching, so a late completion cannot remove or overwrite a replacement. Add a regression test with a first probe that never settles and a second probe that succeeds.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 2e65ba9a-9f63-4785-81a4-4bc221ea2072
📒 Files selected for processing (3)
src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority-account-cache.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the incremental delta of d2f7168 over the previously approved 9a09d30 (the two Merge origin/main commits in between carry no PR-owned changes).
- Discovery cache scoped to Claude account identity — the probe cache key now includes an auth scope derived from
getAccountsSnapshot().claude: the active account id plus itsupdatedAt(re-auth bumpsupdatedAt, so it invalidates membership too), resolved per executing host (activeAccountIdforlocal,activeAccountIdsByRuntime.wsl[distro]for WSL). SSH hosts and non-Claude agents are not account-scoped, since local managed-account state does not govern an SSH host's CLI. When the account identity is unavailable the answer still rejects for the current launch but is not persisted. - Mid-flight account switch discards the answer — the post-probe scope is recomputed and compared against the pre-probe scope; if an account switch or re-auth landed while the probe ran, the answer is dropped and the launch seeds, so a stale list from account A is never applied to account B.
- Account-cache test suite —
worker-launch-model-authority-account-cache.test.tspins account switch, re-auth, WSL distro selection, SSH isolation, unavailable-identity no-persistence, and the mid-flight-switch discard.
Verified resolveDiscoveryAuthScope's host-key handling matches the account subsystem (snapshot().activeAccountId is normalizeClaudeRuntimeSelection().host, so local and .host agree; WSL keys are bare distro names and hostKey.slice(4) strips wsl:), the getAccountsSnapshot().claude shape (accounts carries updatedAt, activeAccountIdsByRuntime models host/wsl only), and that resolveRuntimeCommitMessageDiscoveryHostKey produces the same wsl:<distro> / ssh:<id> vocabulary. The tests use exact assertions and would fail with the scoping removed.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Review complete on Meaningful review fixes now in the branch:
Validation:
Remaining QA gaps:
|

ELI5
Before Orca creates a Claude worker, it now asks the machine that will run that worker which model IDs its installed Claude CLI accepts. A typo is rejected with the accepted IDs instead of allocating a worker terminal that immediately dies.
What Changed
defaultlaunch alias.resolvedModeloptional for mixed-version compatibility and leaves existing effort validation unchanged.Why
The failure mechanism was an unchecked model string reaching irreversible worker allocation. Validation now lives at the execution-owner boundary and runs before database, worktree, or terminal effects. This also prevents local discovery from being treated as authority for a remote worker.
Linked Issue
Supersedes #19682. There is no separate issue for this focused extraction.
Visual Proof
The first image shows the final merged branch rejecting an unknown model and
worker-listreporting zero allocated workers. The next two cover acceptance of a stable alias and a resolved full model ID.Electron validation
Testing
invalid_argument, named the executing host's accepted IDs, and leftworker-listempty; the renderer logged zero errors.pnpm tc, changed-code quality,git diff --check, CLI build, and relay build.AI Disclosure
Review
Independent same-model review/fix/re-review completed clean on the final merged commit. The review explicitly covered root cause, placement ownership, account/cache isolation, failure behavior, resource cleanup, mixed versions, cross-platform/remoting, and performance bounds.
Agent skill upstream boundary
Notes
Checklist
N/Awith reason