Skip to content

fix(native-chat): show only official model names and require them for worker-start --model - #19682

Closed
brennanb2025 wants to merge 11 commits into
mainfrom
brennanb2025/model-picker-official-ids
Closed

brennanb2025 wants to merge 11 commits into
mainfrom
brennanb2025/model-picker-official-ids

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​910 $\color{#cf222e}{\Huge{\mathbf{−}}}$​89 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​821
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​453 $\color{#cf222e}{\Huge{\mathbf{−}}}$​112 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​341

ELI5

Native chat only ever shows official model names now. A tracked model id that neither the agent CLI nor Orca's built-in list knows no longer appears in the composer as if it were a model; the pill reads "Model" and the effort picker stays available.

worker-start --model refuses an id only where the executing host's list is a complete one — Claude, whose CLI publishes its whole list — naming the accepted ids. Where the list is not complete (Codex and Cursor, whose models depend on the account) or the host could not be listed at all, the id is passed through and the agent CLI reports its own error. A probe that could not run, or a list that was never exhaustive, is not evidence that a model does not exist.

Follow-up to #19431, which made structured workers honour --model; that opened a path for an unofficial id (for example claude-opus-5) to be seeded into a structured session and echoed by the picker.

What Changed

Display (shared + renderer + mobile)

  • withTrackedNativeChatModel no longer fabricates a { id, label: id, options: [] } row for an id outside the discovered and seed lists; a seed alias the CLI no longer lists still keeps its seed row.
  • buildNativeChatSessionOptionSnapshot emits currentValue only when a listed row backs it and stamps valueSource: 'unknown' otherwise, so the pill withholds the raw string. New resolveCatalogModelOptions supplies the model's own options or the catalog's unknownModelOptions, so effort stays settable for a session running an unmatched id. Typed /effort under an unmatched model and the renderer's option apply path route through the same resolver.
  • The structured route stopped fabricating the same row on all three layers: structuredAgentSessionOptionCatalog, readClaudeStructuredSessionOptions, readCodexStructuredSessionOptions. current.model still reports what the session runs. Legitimately picked models are unaffected: main already maps the init frame's resolved id (claude-opus-5[1m]) back to the listed opus[1m], now pinned by a test.
  • readCodexStructuredSessionOptions floors its list on the Codex seed when model/list answers nothing. It is the only producer that can return models: [] beside a truthy current.model — its guard throws only when no model resolves at all, and input.current.model short-circuits it — so a restored thread whose list came back empty would have lost the model pill and the effort pill with it. Same floor readClaudeStructuredSessionOptions already applies (discovered.length > 0 ? discovered : seedModels()), scoped to the empty-list case so a thread with neither a listed nor a current model still raises codex app-server returned no available models. The shared snapshot's []-for-an-empty-catalog semantics are untouched, and no client-side floor is needed: every released host guarantees a non-empty list beside a current model, because origin/main's readers fabricate a row for an unlisted current id — the very fabrication this PR removes.
  • Mobile uses the shared resolver and drops a local model-list copy that became an identity.

Input contract (main + CLI)

  • New worker-launch-model-authority.ts: the official ids per executing host. Reuses the model probe the chat picker already uses (discoverRuntimeCommitMessageModels, which routes local / WSL / SSH from the worktree selector). Order: 3-minute per-host cache → live probe (10 s dispatch budget, probe keeps running to fill the cache, failures never cached, concurrent dispatches share one in-flight probe) → seed. A probe answer with catalogOrigin: 'spec' counts as seed.
  • Only a live answer may refuse an id. A seed fallback carries no membership at all. Tying rejection to the seed made a dispatch's verdict a function of probe timing — a cold SSH host refused --model opus[1m], the id this PR's own CLI help advertises, and the byte-identical retry succeeded once the probe had cached — and it asserted "this model does not exist" out of a loss of contact, which inverts docs/reference/ssh-execution-boundary.md. The Codex seed says as much itself: it is deliberately short and expects unknown ids to pass through.
  • Rejection is gated on whether discovery REPLACES the seed. discoveredModelsReplaceSeed(agent, catalog) is the single place that decides, and both the picker's merge (resolveDiscoveredCatalogModels) and the reject gate read it, so the offered and accepted sets cannot drift. Claude replaces, so claude-opus-5 stays refused; Grok declares its discovery authoritative, so it would too. Codex, Gemini and Cursor merge seed with live precisely because the live list is known not to be exhaustive — CODEX_SESSION_OPTION_CATALOG says so of itself — so refusing against it would turn away models the account genuinely holds, and would make the accept/reject outcome (not just the wording) depend on probe timing. Those agents are not probed at all: nothing would be done with the answer.
  • Effort is validated against the catalog on both paths, exactly as before this PR. The probe reports one generic level list for every Codex model, so letting it narrow the menu refused --effort ultra on gpt-5.6-sol once the probe had answered, while the same command succeeded cold and in the picker.
  • The probe cache is keyed on the executing host (local / wsl:<distro> / ssh:<connectionId>, via the existing commit-message-host-key identity that main and the renderer's cache of this same fact already use) rather than on the calling worktree, so N worktrees on one machine run one probe for one fact. Expired entries are swept rather than retained. A selector this client cannot resolve to a host skips the probe outright.
  • The host-key lookup distinguishes its two failures: an unresolvable selector is ordinary and silent, while a runtime that no longer carries the method arrives as a TypeError and is logged, because that one would make --model validation a permanent no-op with nothing to show for it.
  • prepareLocalWorkerStart / prepareFederationAttachmentWorkerStart became async to await the authority. Placements that create a worktree probe the coordinator's host, since that is where the worktree is made; a federated new-top-level has no host to probe yet. The coordinator's worktree is now resolved once per dispatch and handed to the placement path instead of costing a second showTerminal round trip.
  • CLI help now states which agents enforce and which defer: an id Claude's host does not list is rejected with the accepted ids named; for Codex and Cursor the id is passed through to the agent CLI.

Compatibility

  • Wire: removing a fabricated row from models is a content change, not a shape change. An old client paired to a new host re-adds the row itself, so it sees today's behaviour; a new client on an old host still receives the fabricated row until the host updates. No capability gate needed.
  • Existing error code (invalid_argument) with a more specific message; no new RPC fields.
  • worker-start --model is stricter than before only for Claude, and only where that host's CLI answered. Everywhere else — Codex, Cursor, and any host that could not be listed — the accepted set is unchanged from origin/main: the id and its effort go to the agent CLI, which reports its own error. Codex model access depends on the account, so nothing this PR does can refuse an id the account holds.
  • Effort validation is unchanged from origin/main on both paths.
  • An unofficial id already persisted in settings is still tracked and still launches as --model <id>; only its naming is withheld. Retiring the value is a settings change left out of scope.

Testing

Run at head 66f27e3931.

  • Unit, per changed area: worker-launch-model-authority 19, worker-launch-preferences 26, worker-start-validation 8 (new — the RPC-level worker tests build a runtime with no worktrees, so their host-key lookup throws and every dispatch there takes the seed path; nothing pinned which worktree the probe is asked about), codex-structured-session-options 8. Suites: orchestration worker 37 files / 313 tests; src/shared + src/cli + src/main/codex + orchestration RPC + renderer native-chat — 1161 files / 12459 tests (8 files, 127 tests skipped); mobile (mobile/vitest.config.ts) — 517 files / 4237 tests, 3 skipped. All pass.
  • Two real-binary Claude integration tests fail on this box for environmental reasons and are unrelated to this branch: claude-stream-json-connection.test.ts fails only under a parallel run and passes alone; claude-tui-resume-real-binary.integration.test.ts fails with Command failed: ps -axo ….
  • Ablation — each prod change reverted by hand, test observed red, restored, restore verified by grep or sha256 (never by git checkout <sha> -- <file>, which discards uncommitted work), green re-observed: seed-path rejection reinstated → 2 red; the seeded model's effort menu replaced by the narrower generic one → 4; live membership taken as the whole list for every agent → 1; catalogOrigin: 'spec' accepted as a live answer → 1; probe cache keyed on the worktree selector instead of the host → 1; the Codex seed floor removed → 1; the dispatch budget removed → 1; the abandoned probe no longer filling the cache → 2; the in-flight probe no longer shared → 2; coordinator placements probing the worker's target selector → 4; the probe running with no --model → 1; a federated new-top-level probing a worktree the remote has not made → 1; the wiring-failure log removed → 1; the coordinator's worktree resolved twice → 1; discoveredModelsReplaceSeed forced true (today's blanket strictness) → 2; forced false (nothing ever refused) → 16.
  • Gates: check:code-quality:changed 0 new findings across 31 changed files (native, type-aware, React Doctor); check:max-lines-ratchet OK, no new bypasses; oxlint clean on the changed paths.
  • One mobile test fails and is not this branch's: mock-server-key-pair.test.ts spawns a child that dies with Cannot find package 'tsx', which is absent from this worktree's node_modules. Both the test and its subject are byte-identical to origin/main.
  • pnpm tc is run separately by the author; it is not run here.

Visual Proof

Electron run on two isolated hidden instances (CDP only), this branch vs main at ba888cdbef: #19682 (comment)

Captured before the follow-up commits. All three cases exercise the live-probe path, which is unchanged by them; only the seed-fallback path (where the CLI could not be listed) now behaves differently.

  • worker-start --model claude-opus-5 → invalid_argument, message names the six ids listed by the claude CLI on the executing host; 1.8 s cold, 0.15 s warm from the cache.
  • --model opus[1m] --effort high → structured worker, composer reads Opus (1M context) / High.
  • Unofficial persisted id (claude-opus-5) opening a new Claude chat: on main the pill echoed the raw id and the effort pill was missing; on this branch the pill reads Model, the effort pill High is present, and the dropdown lists only official ids.

…rker-start --model

The composer echoed any tracked model id verbatim: a fabricated catalog row was
appended for ids no list carried (shared snapshot, and the structured-route
readers in main for Claude and Codex), so a worker launched with --model
claude-opus-5 rendered that string as a model and lost its effort picker.

Now no layer fabricates a row. A tracked id outside the discovered and seed
lists renders the neutral Model pill, while its effort picker stays available
from the catalog's unknown-model options so the running session remains
adjustable. Legitimately picked models are unaffected: main already maps the
init frame's resolved id (claude-opus-5[1m]) back to the listed opus[1m].

worker-start --model now accepts only ids the agent CLI lists on the executing
host, probed through the same discovery the chat picker uses (bounded wait,
per-scope cache, seed ids as the fallback), and the rejection names the
accepted ids and which list answered.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one minor inefficiency flagged inline.

Reviewed changes

  • Official-only model naming — withTrackedNativeChatModel, buildNativeChatSessionOptionSnapshot, and the structured Claude/Codex readers stop fabricating a raw-id row for a tracked model no list carries; the pill renders neutral "Model" and effort stays settable via the new resolveCatalogModelOptions.
  • worker-start --model authority — new worker-launch-model-authority.ts gates --model on the executing host's CLI list (live probe with 10s budget → 3-min cache → seed), and resolveWorkerLaunchPreferences validates membership and per-model effort levels with named-accepted-ids errors.
  • Async propagation — prepareLocalWorkerStart / prepareFederationAttachmentWorkerStart became async to await the authority; placements that create a worktree probe the coordinator's host, federated new-top-level validates against the seed only.

The display and input sides hang together cleanly, and the effort-menu narrowing in liveWorkerLaunchModelAuthority (intersect CLI-advertised levels with the catalog menu) is well-covered by the new tests.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

effort: args.effort,
...(catalog
? {
authority: await resolveWorkerLaunchModelAuthority({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For agents whose catalog lacks supportsWorkerLaunchPreferences (grok, gemini), this probes the host before resolveWorkerLaunchPreferences throws does not support launch-time model selection, wasting a discovery round trip on a path that immediately rejects. Gate the authority resolution on the same condition resolveWorkerLaunchPreferences enforces (catalog.supportsWorkerLaunchPreferences && catalog.modelApply.launchArgs, see worker-launch-preferences.ts:73) so the probe only runs when the result will be used.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: fc0b50d7-53d3-437d-95f9-945176bc9653

📥 Commits

Reviewing files that changed from the base of the PR and between 1028d76 and f4a75f6.

📒 Files selected for processing (2)
  • src/shared/structured-agent-session-options.test.ts
  • src/shared/structured-agent-session-options.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/shared/structured-agent-session-options.test.ts
  • src/shared/structured-agent-session-options.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The change stops session and worker-launch flows from fabricating selectable rows for unlisted models. Catalog options now use shared fallback resolution. Claude and Codex retain unlisted models as current runtime values without offering them as choices. Worker launches validate model identifiers and effort levels against seeded or host CLI-discovered authority. Local and federated worker-start preparation now resolves authority asynchronously. Tests and CLI documentation use official model identifiers and describe the updated validation behavior.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to f4a75

This change preserves controls for unlisted running models, but Codex may present an effort option that cannot be applied when fallback catalog data is in use. That inconsistent session behavior should be resolved before merge; worker-start fallback documentation also remains incomplete.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 31 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the two primary changes: official native-chat model names and worker-start model validation.
Description check ✅ Passed The description is detailed and covers the change, rationale, testing, compatibility, and visual proof. It references issue #19431, but it does not include the template's explicit Linked Issue, Review…
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ad0875f8-1d9e-4c71-a7df-eabfacc5d8f3

📥 Commits

Reviewing files that changed from the base of the PR and between 210ac1f and 91480bb.

📒 Files selected for processing (27)
  • mobile/src/session/use-mobile-native-chat-session-options.ts
  • src/cli/specs/orchestration-worker-specs.ts
  • src/main/claude/claude-structured-session-adapter.test.ts
  • src/main/claude/claude-structured-session-options.test.ts
  • src/main/claude/claude-structured-session-options.ts
  • src/main/codex/codex-structured-session-options.test.ts
  • src/main/codex/codex-structured-session-options.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation.ts
  • src/main/runtime/rpc/methods/orchestration/worker/composed-workers.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-validation.ts
  • src/main/runtime/rpc/methods/orchestration/worker/workers-new-worktree.test.ts
  • src/renderer/src/components/native-chat/native-chat-pty-session-options.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-apply.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-labels.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-labels.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/native-chat-session-option-commands.test.ts
  • src/shared/native-chat-session-option-commands.ts
  • src/shared/native-chat-session-option-snapshot.test.ts
  • src/shared/native-chat-session-option-snapshot.ts
  • src/shared/structured-agent-session-options.test.ts
  • src/shared/structured-agent-session-options.ts

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

'Current and existing worktrees never rerun setup; a fresh agent terminal is created unless --terminal is explicit.',
'When reusing --terminal, pass --worktree for that terminal; current means the coordinator worktree.',
'--model supports Claude, Codex, and Cursor opaque provider model ids; --effort requires --model. Neither can combine with --terminal.',
'--model must be an id the agent CLI itself lists on the executing host (Claude, Codex, and Cursor), such as sonnet or opus[1m]; unknown ids are rejected and the error names the accepted ones. --effort requires --model and must be a level that model lists. Neither can combine with --terminal.',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document the seeded catalog fallback.

Line 37 says that every accepted model ID must be listed by the host CLI. Remote new-top-level starts and unavailable discovery instead validate against the seeded catalog. State that host discovery is used when available and that built-in catalog IDs are the fallback accepted set.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron visual proof — official model names (@91480bbaa3)

Two isolated dev instances, hidden renderers, CDP + Playwright only. ORCA_BACKGROUND_LAUNCH=1, separate profiles, separate CDP/renderer ports. Ownership proven per instance via window.api.app.getIdentity() and a /@fs probe (this worktree 200, main repo 403).

Fixture: an empty local git repo registered through window.api.repos.add, structured native chat enabled.

A. worker-start --model rejects an unofficial id

orca-dev orchestration worker-start --from <term> --run <run> --spec "noop" \
  --worktree current --agent claude --model claude-opus-5 --effort high --json

Exit 1, error.code = invalid_argument, message verbatim:

Agent claude does not accept model claude-opus-5. Accepted ids (listed by the claude CLI on the executing host): claude-fable-5-1[1m], fable, haiku, opus[1m], sonnet, sonnet[1m]. Orchestration mutation request ID: 1030a350-a7b0-4337-bd2e-4ebdb6bc8354.

The message names the accepted ids and attributes them to the CLI on the executing host, not the built-in list.

Cache holds. Same command run twice back to back:

run outcome wall time
cold exit 1, invalid_argument 1798 ms
warm exit 1, invalid_argument 147 ms

A (accept). Official id launches structured

Same command with --model 'opus[1m]' exits 0:

"state": "ready",
"mode": { "mode": "structured", "preferred": "structured", "reason": "user_default" },
"launch": { "requested": { "agent": "claude", "model": "opus[1m]", "effort": "high" },
            "effective": { "agent": "claude", "model": "opus[1m]", "effort": "high" } }

That worktree's Claude Chat composer renders the CLI's label for the id, Opus (1M context), with effort High.

A-accept-opus1m-pill.png

B / C. Neutral pill for an unofficial persisted id

Seeded through updateSettings using the persisted PersistedNativeChatSessionOptions shape (flat, defined in src/shared/native-chat-session-options.ts), which is the settings shape rather than the in-memory tracked record:

{ "claude": { "model": "claude-opus-5", "valuesByModel": { "claude-opus-5": { "effort": "high" } } } }

Then a new Claude chat opened from the tab strip on each instance.

Before — the composer shows the raw claude-opus-5, and the effort pill is absent entirely:

C-before-raw-claude-opus-5.png

After — neutral Model pill, and the High effort pill is back:

B-after-neutral-model-pill.png

The recovered effort pill is a bigger win than expected: on the before build the unofficial id suppressed the effort control too.

Dropdown lists official models only, no claude-opus-5:

B-after-dropdown-official-only.png

Pane is genuinely structured, not a PTY:

{ "xterms": 1,
  "tabs": [ { "contentType": "terminal",      "label": "Terminal 1" },
            { "contentType": "agent-session", "label": "Claude Chat" },
            { "contentType": "agent-session", "label": "Claude Chat" } ] }

The single .xterm is Terminal 1. Both chats are agent-session.

Two findings

1. The new source file is binary to git, so its diff is unreviewable.

src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.ts shows as Bin 0 -> 6495 bytes in git diff --stat, and as - for both counts in --numstat. The file holds one literal NUL byte at offset 4906 (line 141), used as a cache-key delimiter between the agent and the worktree selector.

The delimiter choice is sound, but writing the raw byte into the template literal instead of an escape makes git classify the whole file as binary. Nobody can review this file's diff, and blame and review tooling are blind to it. Replacing the raw byte with the two-character escape sequence yields an identical runtime string and restores the text diff. Worth fixing before merge, since 6.5 kB of new validation logic is currently landing unreviewed.

2. Two dropdown entries are both labeled "Fable".

claude-fable-5-1[1m] and fable both render as Fable, separated only by description text ("Fable 5.1 · Most capable…" versus "Fable 5 - most capable…"). Both are official per the CLI, so this is not a regression introduced here, but the picker gives no way to tell them apart at a glance. Visible in the dropdown screenshot above.

Logs

Console logs across both sessions: no errors or warnings after filtering the known noise. Both dev logs contain only benign, identical entries, a ws-transport port fallback and a cancelled file listing. Nothing attributable to this branch.

Not covered

Only the claude agent, only a local execution host, only an existing worktree (--worktree current). No SSH or remote host, no new-worktree path, no Codex or other agent, and no mid-session model switch.

A literal NUL in the template made git treat the module as binary, hiding
6.5 kB of new validation logic from review. Agent ids never contain a
space, so the scope key stays unambiguous.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Addressed the binary-file finding from the proof run: worker-launch-model-authority.ts used a literal NUL byte as the cache-key delimiter, which made git treat the whole module as binary. Replaced with a space in 880d8a3 (agent ids never contain one, so the scope key stays unambiguous); the file now diffs as 181 text lines against main. Scanned all 27 files in the PR for NUL bytes: none remain. The duplicate "Fable" labels come from the Claude CLI listing both fable and claude-fable-5-1[1m] with the same display name; not changed here.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this incremental commit. The prior review's one open thread (probing the host before resolveWorkerLaunchPreferences rejects agents lacking supportsWorkerLaunchPreferences) is untouched by this commit and remains open.

Reviewed changes

  • Cache-key separator, NUL → space — resolveWorkerLaunchModelAuthority now keys cachedByScope/inFlightByScope with `${agent} ${worktreeSelector}` instead of a NUL-joined scope. This un-hides the module from git's binary-diff heuristic (the literal NUL made the file render as binary, hiding the new validation logic) and is behavior-preserving: every TuiAgent id is space-free, with multi-word ids hyphenated (claude-agent-teams, qwen-code), so the space delimiter is unambiguous.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Merge Sim added 4 commits September 9, 2026 13:22
The model authority fell back to Orca's static seed whenever the probe could
not answer inside the 10s dispatch budget, then refused anything the seed did
not carry. That made a dispatch's verdict a function of probe timing — a cold
SSH host refused `--model opus[1m]`, the id the CLI help documents, and the
byte-identical retry succeeded once the probe had cached — and it asserted "this
model does not exist" from a loss of contact, which inverts the execution-host
boundary. The Codex seed says so itself: it is deliberately short and expects
unknown ids to pass through.

Only a `live` answer may now refuse an id; a seed fallback carries no membership
and lets the agent CLI report the error. This also disarms two ways the probe
silently fails (a folder workspace, an unknown worktree), which previously
surfaced as a model error for a worktree fault.

Two more divergences between a cold and a warm dispatch go with it:

- Effort is a flag Orca emits, not a host fact, so the catalog decides it on
  both paths again. The probe reports one generic level list for every Codex
  model, so narrowing to it refused `--effort ultra` on `gpt-5.6-sol` — which
  the seed path and the picker both accept.
- Membership now runs through the same three-way policy the picker uses
  (`resolveDiscoveredCatalogModels`), so `worker-start` cannot refuse a seeded
  id the picker offers in the same session.

The probe cache is re-keyed on the executing host (`local` / `wsl:<distro>` /
`ssh:<id>`) instead of the calling worktree, so N worktrees on one machine run
one probe for one fact, and expired entries are swept rather than retained.
`buildNativeChatSessionOptionSnapshot` short-circuits on an empty model list.
That used to be unreachable with a model in play: both producers guaranteed a
row for the tracked id — the PTY path fabricated one, and the structured catalog
pushed `current.model` in. Withholding unofficial ids removed both guarantees,
and `readCodexStructuredSessionOptions` only refuses when there is no current
model, so a restored Codex thread whose `model/list` came back empty lost the
model pill and the effort pill with it.

Fixed at the one consumer rather than at each producer: the list is empty, but a
tracked id still names what the session runs, so its options row is drawn from
`unknownModelOptions`. The model pill stays neutral and offers nothing, which is
the honest reading of an empty list.
A local `--model` dispatch resolved it twice — once to name the host the model
probe asks, once to place the worker — and each is a `showTerminal` round trip
for the same answer. The probe path now hands the id it already paid for to the
placement path, which still resolves it itself when no probe ran.
An empty `models` correctly yields an empty snapshot — that is what an empty
catalog means, and other callers rely on it. The reachable defect is narrower:
`readCodexStructuredSessionOptions` is the only producer that can return
`models: []` beside a truthy `current.model`, because its guard throws only when
no model resolves at all and `input.current.model` short-circuits it. A restored
thread whose `model/list` came back empty therefore lost the model pill and the
effort pill with it.

The Codex reader now falls back to the seed for its list, the same floor
`readClaudeStructuredSessionOptions` already applies (`discovered.length > 0 ?
discovered : seedModels()`). Scoped to the empty-list case so a thread with
neither a listed model nor a current one still raises "codex app-server returned
no available models" rather than offering five ids the account may not hold.

Reverts the earlier change to the shared snapshot function, which widened
semantics every caller shares to fix one producer's bug.

Also covers the probe mechanisms behind the timing fix, which had no tests: the
10s dispatch budget, the abandoned probe still filling the cache, one in-flight
probe shared across racing dispatches, and same-host reuse.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
src/cli/specs/orchestration-worker-specs.ts (1)

37-37: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document the seed-authority fallback

When the executing host cannot be listed, resolveWorkerLaunchModelAuthority() returns source: 'seed', and resolveWorkerLaunchPreferences() skips model-membership rejection. An unknown --model ID can then reach the agent CLI. Update this note to describe the fallback; only source: 'live' rejects unknown IDs and reports accepted IDs.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: d089e337-3f64-4993-b662-359c193fae18

📥 Commits

Reviewing files that changed from the base of the PR and between 880d8a3 and 668b579.

📒 Files selected for processing (15)
  • src/main/runtime/orca-runtime-git.ts
  • src/main/runtime/rpc/methods/orchestration/worker/composed-workers.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-validation.ts
  • src/main/runtime/runtime-git-command-surface.ts
  • src/main/runtime/runtime-git-generation-commands.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/native-chat-session-option-snapshot.test.ts
  • src/shared/native-chat-session-option-snapshot.ts
  • src/shared/structured-agent-session-options.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this delta — nothing needs to change. I'm not approving only because the prior review's single open ℹ️ thread (the wasted host probe before resolveWorkerLaunchPreferences rejects grok/gemini for lacking supportsWorkerLaunchPreferences) is untouched by these three commits and stays open for the author.

Reviewed changes

  • Reworked the model authority to membership-only — resolveWorkerLaunchModelAuthority now returns modelIds resolved through the shared resolveDiscoveredCatalogModels policy, and a seed fallback (host never listed) no longer refuses an id — only a live answer may reject, so loss of contact with a host stops masquerading as "this model does not exist".
  • Reverted effort validation to the catalog — resolveWorkerLaunchPreferences no longer narrows effort to the probe's generic level list (which refused --effort ultra on a warm Codex cache while the cold path and picker accepted it), matching origin/main on both paths.
  • Re-keyed the probe cache on the executing host — the cache/in-flight maps key on `${agent} ${hostKey}` instead of the worktree selector, deduping N worktrees on one machine and skipping the probe for selectors this client cannot resolve.
  • Kept the options row on an empty provider list — buildNativeChatSessionOptionSnapshot no longer blanks the model and effort pills when a provider lists no models but a model is still tracked.
  • Resolved the coordinator worktree once per dispatch — prepareLocalWorkerStart returns the already-resolved callerWorktreeId so startLocalWorker skips a second showTerminal round trip.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this incremental commit.

Reviewed changes

  • Floored the Codex model list on the seed — readCodexStructuredSessionOptions now returns seedCodexModels() when model/list answers empty (mirroring the Claude reader's existing seedModels() fallback), and the shared snapshot's empty-list special case reverts to the simpler models.length === 0 → []. Both structured readers now floor on a non-empty seed, so buildNativeChatSessionOptionSnapshot is never handed an empty list alongside a running model — the two new tests pin both the restored-thread-with-empty-list and the neither-model-nor-current throw cases.

The one prior ℹ️ thread remains unchanged by this commit and stays open.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 4f05ad14-7e3c-4928-9546-cb01400242fa

📥 Commits

Reviewing files that changed from the base of the PR and between 668b579 and 1028d76.

📒 Files selected for processing (6)
  • src/main/codex/codex-structured-session-options.test.ts
  • src/main/codex/codex-structured-session-options.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-launch-model-authority.test.ts
  • src/shared/native-chat-session-option-snapshot.test.ts
  • src/shared/native-chat-session-option-snapshot.ts
  • src/shared/structured-agent-session-options.test.ts
💤 Files with no reviewable changes (1)
  • src/shared/structured-agent-session-options.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

// The seed is the floor, the same one the Claude reader falls back to.
return {
models,
models: models.length > 0 ? models : seedCodexModels(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep effort validation compatible with the seeded fallback.

If model/list is empty and current.model is unlisted, this returns seed models but preserves the unlisted current model. The snapshot then shows a settable effort option. On apply, applyValidatedCodexStructuredSessionOption cannot find that current model in catalog.models and rejects every effort value.

Preserve enough fallback authority to validate the resolved effort options for the running model, or mark the effort option as not settable in this state. Add an apply-path test for an empty response and an unlisted current model.

Merge Sim added 3 commits September 9, 2026 13:47
`structuredAgentSessionOptionCatalog` runs on the client, over a result a host of
any version published — both `use-structured-agent-session.ts` and mobile's
`use-mobile-structured-agent-options.ts` hand it straight off the
`agentSession.options` wire. It mapped `result.models` through unchanged, so an
empty list reached the snapshot, which correctly returns `[]` for an empty
catalog, and the model pill and effort pill both vanished.

On `origin/main` that was unreachable: this function unconditionally pushed
`current.model`, so the list was never empty. Withholding unofficial ids removed
that push, so the exposure is this PR's. Flooring only the host-side readers
closes it for new hosts; a new client paired with an older host still hits it,
which is the divergence `docs/reference/remote-wire-compatibility.md` covers
when a host changes what it publishes.

The floor uses `seed.models`, the catalog the client already passes in, so it
holds for Claude and any future structured agent rather than one provider. The
reader-side floors stay as defence in depth.
Reverts f4a75f6. It guarded a mixed-version pairing that does not exist.

Every released host already guarantees a non-empty `models` beside a current
model, by the same fabrication this PR removes: `origin/main`'s Codex reader
pushes a `{ id: current.model, … }` row whenever the current id is unlisted, and
its Claude reader both floors on the seed and pushes. A successful reply from
either therefore never carries an empty list. The only builds that could publish
one are this PR's own unreleased intermediate commits, which no host runs.

So the floor was unreachable, and the wire test standing behind it pinned a
payload no host can send — which would read to the next person as evidence that
it can. The Codex reader's own floor stays; that one closes a case the provider
can genuinely produce.
The `no authority at all` case is not the contract F1 changed: an omitted
authority was permissive before and after, so the arm went green under ablation
and read as coverage it never provided. In production the authority is always
supplied when a model is present — `resolveWorkerLaunchPreferences` returns
early otherwise — so the case is reachable only from a test.

What discriminates is a seed authority accepting an id it does not carry, which
the remaining case asserts. Re-ablated: reinstating seed-path rejection now
fails both seed tests instead of one.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this incremental commit. The prior review's open thread — probing the host before resolveWorkerLaunchPreferences rejects agents lacking supportsWorkerLaunchPreferences (grok/gemini) — is untouched by this commit and stays open.

Reviewed changes

  • Client-side seed floor in structuredAgentSessionOptionCatalog — the model list now floors on [...seed.models] when the host published an empty models array, so a host that predates the readers' own seed floor can no longer blank the model/effort row for a restored thread; the raw-id row factory for an unlisted current.model is dropped entirely (the record still tracks it as valueSource: 'unknown').
  • Wire-compat test for the empty-list case — a new it.each over Codex and Claude asserts the options row survives an empty published list, the pill withholds the raw id, and effort stays settable.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this delta. The prior review's open thread — probing the host before resolveWorkerLaunchPreferences rejects agents lacking supportsWorkerLaunchPreferences (grok/gemini) — remains untouched and stays open.

Reviewed changes

  • Reverted the client-side model-list floor — structuredAgentSessionOptionCatalog is back to result.models.map(discoveredModel) with no seed floor. The revert is sound: no released host can publish models: [] beside a truthy current.model, since origin/main's readers fabricate a row for an unlisted current id (Claude floors on seedModels(), Codex throws when nothing resolves), and this PR's readers floor on seed host-side. The empty-list seed floor was unreachable defense.
  • Dropped the non-discriminating test arm — the authority: undefined arm of the it.each accepted any id with or without the fix (no authority means no rejection), so it was theatre; the surviving SEED_WORKER_LAUNCH_MODEL_AUTHORITY arm still discriminates against seed-path rejection.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

… cannot run

The RPC-level worker tests never reach a live authority: their harness builds a
runtime with no worktrees, so the host-key lookup throws, is swallowed, and every
dispatch takes the seed path. Nothing pinned which worktree the probe is asked
about, so a refactor that probed the WORKER'S target instead of the
COORDINATOR'S would have stayed green while asking the wrong machine which
models exist.

Eight unit tests over `prepareLocalWorkerStart` and
`prepareFederationAttachmentWorkerStart`, observing the selector at the host-key
seam: `current` / `new-child` / `new-top-level` resolve to the coordinator's own
`id:<worktreeId>`, an exact selector passes through untouched, no `--model`
probes nothing, a federated attachment probes the remote worktree it names, and
a federated new-top-level probes nothing because the remote has not made it yet.

The host-key catch also swallowed a wiring failure indistinguishably from an
unresolvable selector. Only the first makes `--model` validation a permanent
no-op, and it is the one that arrives as a TypeError, so it now says so. An
unresolvable worktree stays silent: that is ordinary.
@brennanb2025

brennanb2025 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Electron UI validation — native chat model picker + worker-start --model

Validated at head 0d5af91524. The screenshots were captured at 1028d76add; production code is byte-identical between the two (git diff --name-only 1028d76add 0d5af91524 → only worker-launch-preferences.test.ts), so the images stand for the current head.

Rig: isolated Orca dev instance built from this branch, fresh profile, ORCA_BACKGROUND_LAUNCH=1 (window never shown), driven entirely by Playwright over CDP against the hidden renderer. macOS. Instance ownership confirmed via app.getIdentity() (devRepoRoot = this worktree) and a private renderer port; the orca CLI used below is the dev wrapper pinned to that instance's profile (it lists exactly one repo — this one), never the developer's real Orca.

The authority on this host. The live Claude CLI answers the list_models control request with:

default, opus[1m], claude-fable-5-1[1m], sonnet, sonnet[1m], fable, haiku

claude-opus-5 is not among them, and it is not in the built-in seed (fable/opus/sonnet/haiku) either — so it is a genuinely unofficial id on this machine, which is what makes it a valid probe for claims 1–3.


1. Unofficial tracked id → neutral "Model" pill, effort still present and settable — VERIFIED

Seeded nativeChatSessionOptions.claude.model = "claude-opus-5" (exactly the shape a stale persisted selection takes), then opened a native chat session through the real New-tab → Claude path.

The composer reads Model (aria-label="Model") — not the raw id — with the effort pill High (aria-label="Effort High") beside it.

01-raw.png

This is specifically the unnameable model state, not an empty one. Two independent readings pin it:

  • The effort pill's mere presence proves a tracked model exists — buildNativeChatSessionOptionSnapshot returns early with no effort descriptor when effectiveModelId is null.
  • Every entry in the model dropdown reports aria-checked="false", so the effective id is none of the official ones. Since defaultModelId is by construction drawn from the listed models, the effective id can only be the tracked one — claude-opus-5.

The effort picker is genuinely settable, offering the launch-safe set (unknownModelOptions) rather than nothing:

03-effort-menu.png

Selecting Max applied cleanly — the pill became Effort Max while the model pill stayed neutral Model.

2. Model dropdown lists only official ids — VERIFIED

Six entries, all from the live CLI list, none checked. claude-opus-5 does not appear:

02-dropdown.png

3. worker-start --model <unofficial> rejected, error names the accepted ids — VERIFIED

With a worktree selector whose host the probe can list:

code: invalid_argument
Agent claude does not accept model claude-opus-5. Accepted ids (listed by the claude CLI
on the executing host): claude-fable-5-1[1m], fable, haiku, opus[1m], sonnet, sonnet[1m].

06-rejection.png

Worth calling out because it is the module's central promise: the accepted set and the picker's set are identical — the same six ids, observed independently from the dropdown and from the rejection message. default is filtered out of both, consistently.

4. Unlistable host → id accepted and passed through, never rejected against a built-in list — seed branch VERIFIED / probe-failure cause COULD NOT EXERCISE

I could not manufacture a real probe failure on this machine (see below), so I exercised the same seed branch through a host selector the runtime cannot resolve, which also yields SEED_WORKER_LAUNCH_MODEL_AUTHORITY. To get a verdict without ever launching a worker, I paired the unofficial model with a deliberately invalid --effort: the model gate runs before the effort gate, so whichever error comes back names the branch that ran.

--worktree result
A real worktree (host listable → live) Agent claude does not accept model claude-opus-5. Accepted ids: … — model rejected
B unresolvable selector (→ seed) Agent claude model claude-opus-5 does not support effort bogus-effort. — model accepted
C unresolvable selector, valid --effort high selector_not_found — model and effort both passed validation; failure is downstream at worktree resolution

So the seed branch does accept an unofficial id and carry it into the launch plan, and only a live answer refuses. What I did not exercise: probe failure or timeout as the specific cause. Both the Claude and Codex CLIs are installed and listable on this box, and a PATH-shim claude stub was defeated — Orca resolves the probe through a login shell, so the stub was never invoked (its invocation log stayed empty) and the rejection still carried the real CLI list. I am reporting that as COULD NOT EXERCISE rather than inferring it from the branch equivalence.

Separately confirmed, and relevant to "a rejection must never claim a built-in list as authoritative": a Codex rejection listed 13 ids (codex-auto-review, gpt-5.2, … gpt-6-astra, gpt-reserve) — a strict superset of the 5-model built-in seed, i.e. demonstrably the live CLI answer and not the seed being passed off as authoritative.

5. --model opus[1m] --effort high still launches a structured worker — VERIFIED

worker-start returned ok: true with requested == effective (model: "opus[1m]", effort: "high"), and the launched worker's composer reads Opus (1M context) / High (sidebar shows opus[1m]):

05-opus1m-worker.png


Incidental observation (pre-existing, not this PR)

The dropdown renders two entries both labelled "Fable" — fable and claude-fable-5-1[1m]. Both come back from the CLI with displayName: "Fable", so the collision originates upstream and this PR only surfaces it faithfully. It is indistinguishable to a user picking between them; may be worth a follow-up.

Gaps

  • No before/after ablation against main; I validated the fixed behaviour only, and did not re-capture the old raw-id pill.
  • Dev build over CDP only — a packaged build was not exercised.
  • macOS local host only: Windows, Linux, SSH/remote and folder-workspace paths untested, as is the mobile surface.
  • Claim 4's probe-failure/timeout cause untested, as detailed above.

`worker-start` rejected any id outside the live list for every agent, which
contradicts what the catalogs say about themselves. The Codex seed is explicit:
"Keep this seed short and allow unknown persisted ids to pass through instead of
claiming a complete list." The picker merges seed with live for exactly that
reason — the account, not the CLI, decides what Codex can run — so refusing
against that list turns away models the account may genuinely hold, and makes
the accept/reject outcome, not just the wording, depend on probe timing.

Rejection is now gated on whether discovery REPLACES the seed. Claude's CLI
publishes its whole list, so `claude-opus-5` stays refused, which is the point of
this PR. Grok's catalog declares its discovery authoritative, so it would too.
Codex, Gemini and Cursor defer to the agent CLI's own error.

`discoveredModelsReplaceSeed` is the single place that knows, and both the
picker's merge and the reject gate read it, so the offered and accepted sets
cannot drift. An agent that only extends is not probed at all: nothing would
be done with the answer.

CLI help said `--model` must be an id the CLI lists for Claude, Codex and
Cursor. It now says which agents enforce and which pass the id through.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status — ready to merge at 66f27e3931

Full review loop complete: two independent code-review passes, an opening and closing readiness checklist, and Electron UI validation. Two blockers and several should-fixes were found and fixed; the PR now does something meaningfully different from where it started, so the summary below is worth reading before merging.

What was wrong, and what changed

Blocker — the seed fallback rejected ids it had no business rejecting. When the model probe couldn't answer within its 10s budget, validation fell back to the static seed and refused anything outside it. Three consequences: opus[1m], the id this PR's own CLI help advertises, is absent from the Claude seed (fable, opus, sonnet, haiku), so the documented example failed exactly when the fallback engaged; the same command could be accepted or refused depending on host load, with no user-visible cause; and it inverted the rule in docs/reference/ssh-execution-boundary.md by treating loss of contact as proof a model doesn't exist. The seed catalog forbids this in its own comment — "allow unknown persisted ids to pass through instead of claiming a complete list."
→ Rejection is now gated on a live answer. An unlistable host passes the id through to the agent CLI, and no error can present a built-in list as authoritative.

Blocker — effort narrowing regressed seeded models. Intersecting the catalog's effort menu with the probe's thinkingLevels meant codex --model gpt-5.6-sol --effort ultra was accepted on main and on the seed path but refused once the probe answered.
→ The probe's levels no longer reach effort validation; the catalog decides on both paths, byte-identical to main.

Strictness now follows each catalog's own replace-vs-extend semantics. Blanket strictness contradicted the union agents: the picker merges seed ∪ live for Codex/Gemini/Cursor because the live list isn't exhaustive, so refusing against it rejected models an account may genuinely have. A single discoveredModelsReplaceSeed(agent, catalog) predicate now drives both the merge policy and the reject gate — Claude and authoritative agents enforce, the rest defer to the CLI. worker-start --agent claude --model claude-opus-5 is still refused, which is the point of the PR.

Also fixed: an empty Codex model/list blanked both the model and effort pills on a restored thread (now floored on the seed, mirroring the Claude reader); the authority invented a third model-merge policy instead of reusing the picker's (now one shared function); the probe cache was keyed by caller rather than host, so N worktrees on one machine meant N CLI spawns (now keyed on the existing local/wsl:<distro>/ssh:<id> identity, with expired entries swept); a duplicate resolveDispatchCallerWorktreeId round-trip per dispatch; and a blanket catch {} that could have made --model validation a permanent silent no-op (now discriminates a wiring failure from an ordinary unresolvable selector).

Validation

  • Typecheck: node / cli / web all exit 0 at 66f27e3931, run sequentially.
  • Tests: 1161 files / 12459 tests pass across orchestration, shared, cli, codex and renderer native-chat. Mobile: 517 files / 4237 tests pass — one unrelated failure in mock-server-key-pair.test.ts, caused by tsx being absent from this worktree's node_modules; that test and its subject are byte-identical to main.
  • Ablations: every fix has a test proven to fail without it, restores verified by sha256 rather than git checkout. The extraction of resolveDiscoveredCatalogModels was proven a pure refactor empirically — a differential test against main's inline ternary across 5 agents × 9 discovered shapes, 47/47 passing, with each of its three branches independently ablated to red.
  • Coverage gap closed: worker-start-validation.ts had none, and because the RPC harness builds a runtime with no worktrees, every RPC-level test silently took the seed path — so a refactor probing the worker's target instead of the coordinator's would have stayed green. Eight new tests pin the placement→selector mapping; that ablation now goes 4 red.
  • Lint: oxlint 0, max-lines ratchet OK, no NUL bytes, pnpm-lock.yaml untouched across every commit.
  • Electron UI validation: fix(native-chat): show only official model names and require them for worker-start --model #19682 (comment) — 5 inline screenshots on an isolated hidden instance over CDP. Four claims verified; the probe-failure path is honestly labelled COULD NOT EXERCISE, since both CLIs are listable on that host. Captured at 0d5af91524; the only later change affects non-Claude agents, so the Claude-facing evidence stands.

Follow-ups — none blocking

  1. WSL cache staleness (P2): the host key collapses every worktree in a distro to wsl:<distro>, but the WSL probe runs with cwd set, so two worktrees with different per-directory toolchains could share one cache entry for up to 3 minutes. TTL-bounded, and strictly better than the caller-keyed cache it replaces.
  2. RPC harness (P2): rpc-test-harness.ts builds an OrcaRuntimeService with no worktrees, so RPC-level tests can't exercise a live authority. Worth fixing at the harness level.
  3. Mobile (P2): an unofficial id shows the neutral "Model" pill with no probe to recover the name. Informational; mobile gained a settable effort row it never had.
  4. Pre-existing, spotted during QA: fable and claude-fable-5-1[1m] both render as "Fable" in the dropdown, because the CLI returns that displayName for both.

Residual design note worth stating plainly: a 10s probe still sits on the dispatch path, so a slow host adds latency. It no longer changes the outcome — an unreachable host defers to the CLI rather than refusing — but it is the one place host load converts into wall-clock cost on a dispatch.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this incremental commit. The prior review's single open ℹ️ thread — probing the host before resolveWorkerLaunchPreferences rejects agents lacking supportsWorkerLaunchPreferences (grok/gemini) — is untouched by this commit and stays open.

Reviewed changes

  • Placement → probe-selector coverage — new worker-start-validation.test.ts pins, at the host-key seam, which worktree the model probe is asked about: current / new-child / new-top-level resolve to the coordinator's own id:<worktreeId>, an exact selector passes through untouched, no --model probes nothing, a federated attachment probes the remote worktree it names, and a federated new-top-level probes nothing.
  • Host-key failure taxonomy — resolveWorkerLaunchModelAuthority now distinguishes the two failures its host-key lookup can produce: a TypeError (a runtime that no longer carries resolveRuntimeCommitMessageDiscoveryHostKey, which would silently no-op --model forever) logs, while an unresolvable selector stays silent as ordinary.

Both changes are coverage or diagnostics only; no control-flow change. The TypeError heuristic is sound — resolveWorktreeSelector throws only plain Errors (selector_not_found, selector_ambiguous, worktree_execution_host_unresolved), so the sole TypeError source is the missing-method wiring gap this commit intends to surface.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No new issues in this incremental commit. The prior review's single open ℹ️ thread — probing the host before resolveWorkerLaunchPreferences rejects an agent that lacks supportsWorkerLaunchPreferences — is partially addressed here (Gemini now skips the probe) but remains open for Grok, which is still probed (see body). Not resolved; not re-raised inline.

Reviewed changes

  • Complete-list-only rejection — new discoveredModelsReplaceSeed(agent, catalog) in agent-session-option-catalog.ts becomes the single place that decides whether a host's probe answer replaces the seed's membership (Claude, or discoveredModelsAreAuthoritative) or merely extends it (Codex, Cursor, Gemini). Both the picker's merge (resolveDiscoveredCatalogModels) and the reject gate read it, so offered ↔ accepted sets cannot drift.
  • No probe for merge-only agents — resolveWorkerLaunchModelAuthority now returns seed immediately when discoveredModelsReplaceSeed is false, so Codex/Cursor/Gemini are never asked and never refuse; their id goes through to the agent CLI.
  • Faithful picker refactor — resolveDiscoveredCatalogModels is rewritten over the same predicate and is behavior-identical to the inline ternary it replaced (Claude → [...discovered]; authoritative → mergeDiscoveredAuthoritativeModels; otherwise mergeCatalogModels).
  • Help text — orchestration-worker-specs.ts now names which agents enforce (Claude) and which defer (Codex, Cursor).

This is a real correctness improvement over the previous commit, which rejected Codex/Cursor ids against an account-shaped, incomplete list and so could turn away models the account genuinely holds depending on probe timing. Tests are discriminating (the new refuses ... and not for the one that extends it pins both halves), and the ablation in the PR body covers both forced-true and forced-false of discoveredModelsReplaceSeed.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Parking this in favour of a smaller PR: #19791

Holding this rather than merging it. The display half of this PR withholds the model name — when the tracked id isn't in the official list it sets valueSource: 'unknown', omits currentValue, and the pill renders a neutral "Model". The session keeps running that model and the UI doesn't say which one.

The requirement is the opposite: the composer should show the model that is actually running. So this isn't a scope trim — it reverses one of this PR's display decisions, which is awkward to do inside a PR whose main body is the validation subsystem.

#19791 does the narrow version against main:

  • stops fabricating the { id, label: id, options: [] } row in all four places, so a raw launch flag is no longer offered as a selectable model;
  • keeps currentValue/valueSource exactly as main has them, so the pill names the running model (nativeChatModelPillLabel already falls back to the raw id when no choice matches — that file isn't even in the diff);
  • keeps the effort picker alive for an unlisted model via a shared options resolver;
  • floors the Codex reader's list on the seed, after its existing guard, so removing the fabrication can't blank both pills on an empty model/list.

worker-start --model keeps working exactly as it does on main — no probing, caching, or host-key logic.

This PR is not wasted

It's in good shape and the work stands on its own merits for when strict validation is wanted:

  • rejection correctly gated on a live answer, so an unreachable host defers to the CLI instead of asserting a model doesn't exist;
  • strictness following each catalog's own replace-vs-extend semantics through a single discoveredModelsReplaceSeed predicate, so what the picker offers and what worker-start accepts cannot drift;
  • the effort-narrowing regression fixed;
  • resolveDiscoveredCatalogModels consolidating two divergent copies of the model-merge policy — proven a pure refactor by a differential test across 5 agents × 9 shapes, each branch independently ablated;
  • host-keyed probe cache with expiry sweeping, and placement→selector test coverage that didn't exist.

Known follow-ups if this is picked back up: the WSL host-key cache can serve a stale list across worktrees in one distro (TTL-bounded); rpc-test-harness.ts builds a runtime with no worktrees, so RPC-level tests silently take the seed path and can't exercise a live authority.

Leaving this open and unmerged.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by #19937, which ports the validation half onto current main.

Two reasons this branch could not simply be rebased:

  1. It carries a rejected display change. Alongside the validation, this branch changes which model name the native chat shows — and in the stricter "name it only if it is in the list" form, which withholds the name of a model the agent itself reported. That behaviour was rejected, and a successor PR carrying an improved version of it was closed too. feat(orchestration): reject a worker-start --model the host's CLI does not list #19937 excludes the display half entirely; its diff touches no snapshot, structured-reader, pill-label, option-apply, or mobile file.
  2. It was 55 commits behind main, so every ablation recorded here had expired against the current base. feat(orchestration): reject a worker-start --model the host's CLI does not list #19937 re-proves the load-bearing ones at its own head, with shasum -a 256 -c confirming each restore byte-identical after the final commit rather than at an intermediate state.

What carried over unchanged — this was a good design and the review rounds on it stand:

  • Rejection only when the authority's source === 'live'. A host that cannot be listed refuses nothing, because loss of contact is not evidence a model is absent (docs/reference/ssh-execution-boundary.md).
  • Strictness follows discoveredModelsReplaceSeed(agent, catalog) — Claude and authoritative catalogs enforce; Codex/Gemini/Cursor treat the live list as non-exhaustive and are not probed at all.
  • Probe cache keyed by executing host (local / wsl:<distro> / ssh:<id>) with expiry sweeping, not by caller.
  • Effort validation stays the catalog's, identical to main.
  • The rejection message names the accepted ids and can never present a built-in list as authoritative.

One addition in #19937: discoveredModelsReplaceSeed's doc comment previously described itself as "the one place in the tree that decides". That invites a specific mistake — routing Codex's app-server model/list through it would delete the existing rejection in applyValidatedCodexStructuredSessionOption, since that function already treats model/list as complete while the predicate is false for Codex. The comment now scopes itself to CLI-probe (listModels stdout) membership and names model/list and supportedModels() as separate authorities.

Also worth recording from work done on this branch: a session started on an unlisted model is inert, not merely mislabelled. Measured against real binaries — Claude returns is_error: true with zero tokens on every turn; Codex returns a 400. That is the evidence that refusing the id up front is the right fix rather than rendering it more carefully. And list_models membership is not proof a model runs: Claude synthesizes a "Custom model" row for an arbitrary startup flag, advertising effort levels it can never honour.

Closing unmerged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant