Skip to content

Show the model a native-chat session is actually running, and stop offering raw launch flags - #19791

Closed
brennanb2025 wants to merge 5 commits into
mainfrom
brennanb2025/native-chat-show-actual-model
Closed

brennanb2025 wants to merge 5 commits into
mainfrom
brennanb2025/native-chat-show-actual-model

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​480 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​451
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​118 $\color{#cf222e}{\Huge{\mathbf{−}}}$​95 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

The bug

Four layers fabricated a catalog row — { id: trackedId, label: trackedId, options: [] } — whenever the tracked model id was one neither the CLI-discovered list nor the static seed carried:

  • withTrackedNativeChatModel (src/shared/native-chat-session-option-snapshot.ts)
  • structuredAgentSessionOptionCatalog (src/shared/structured-agent-session-options.ts)
  • readClaudeStructuredSessionOptions (src/main/claude/claude-structured-session-options.ts)
  • readCodexStructuredSessionOptions (src/main/codex/codex-structured-session-options.ts)

Two consequences:

  1. A raw launch flag appeared in the model dropdown as a selectable model. A worker started with worker-start --model claude-opus-5 rendered claude-opus-5 as a pickable option beside Opus, Sonnet and the rest.
  2. The effort picker vanished for that session. The fabricated desktop row carried options: [], so the snapshot found no options under the effective model and dropped the effort row entirely.

The fix

No layer fabricates a row any more. An id neither list carries never becomes a choice — but it is still named as the pill's current value, because the session is demonstrably running it.

The options for such an id come from resolveCatalogModelOptions, a shared resolver: the listed model's own options, falling back to the catalog's unknownModelOptions. Seven call sites read it — the snapshot, the command recorder and emitter, the desktop applier, the mobile hook, and worker-launch-preferences — so the effort row is present and settable for an unlisted model rather than merely rendered.

Two claims from an earlier revision of this description were wrong

A retired seeded alias getting its seed row back is PTY-only. withTrackedNativeChatModel reconciles a seeded alias the host's CLI has retired back into the list, and that is real on the PTY path. On the structured path it cannot happen: structuredAgentSessionOptionCatalog sets catalog.models to the discovered list, so the seed lookup scans the same array and can never find anything, and structuredAgentSessionOptionSnapshot never calls it. Structured Codex with current.model = 'gpt-5.6-sol' (seeded, 7 effort levels) and a list without it yields choices: ['gpt-live'], no seed row, and 5 effort levels from unknownModelOptions rather than the seed's 7. main also gives 5, so this is not a defect — just an inaccurate claim.

"The picker offers exactly the options a launch would resolve" does not hold when listModels succeeds. The launch path resolves against catalog.models while the snapshot resolves against the discovered list, so a probe-discovered id absent from the seed draws different options in each. The two agree only for an id absent from both.

An unlisted id must never become the persisted launch default

modelIsAdoptableAsLaunchDefault decides whether a picker write may also persist model as the -m launch flag for every future session of that agent. Its docstring already said an id with no evidence behind it must not be adopted, but the code only enforced that for catalogs marking their discovered list authoritative — which Claude does not.

On main that hole was reachable through the model row, whose fabricated entry was selectable. This PR closes that door and, by restoring the effort row for an unlisted model, opens an equivalent route through effort: worker-start --model claude-opus-5 → open native chat → change effort → every later Claude native chat launches with that flag. Same hazard, new route.

The guard now refuses any id carried by neither the discovered list nor the catalog seed, in both the discovered and not-yet-discovered branches. Retirement semantics for ids that are seeded or listed are unchanged, and the value stays scoped under that model id so an explicit reselect gets it back.

/model <the model you are running> no longer errors

dispatchStructuredAgentSessionComposerCommand resolved its argument against descriptor.kind.choices only, so typing the very id the pill names returned "… is not an available model for this chat session." It now accepts an argument matching the descriptor's currentValue as a no-op success. Genuinely unavailable ids are still refused.

Codex: narrow the snapshot guard, do not floor on the seed

Removing the Codex fabrication makes an empty model/list reachable alongside a truthy current.model. buildNativeChatSessionOptionSnapshot returned [] for an empty list, which would blank the model pill and the effort pill on a restored thread.

The guard was the defect, so the guard is what changed: it bails only when the list is empty and no model id resolves either. With an empty list and a running model it emits the model row — naming what runs, with an empty choices array — plus the effort row from unknownModelOptions. Both pill helpers already fall back to { value: currentValue, label: currentValue }, so neither surface blanks.

An earlier revision instead floored readCodexStructuredSessionOptions on the Codex seed. That is removed. It contributed nothing it claimed to protect (any single row restores both pills, and the effort row comes from unknownModelOptions); it defeated a host-side guard, since applyValidatedCodexStructuredSessionOption validates a model pick against catalog.models, so an entitlement-gated id like gpt-5.6-sol would have passed and been stored, deferring the failure to turn/start; and it contradicted the catalog's own note that Codex model access depends on auth and the seed is deliberately short. models: [] also arises when modelOption rejects every row, so the floor would have masked a Codex wire-format change behind five hardcoded ids.

The codex app-server returned no available models guard and its test are untouched.

Accepted consequences

  • An empty model picker when model/list returns no usable rows. Newly reachable because the guard was narrowed. Every alternative is worse: blanking both pills hides the model that is actually running, and flooring on the seed offers five entitlement-gated ids and defeats host-side validation. An empty picker that correctly names the running model is the honest degradation, and it is a degenerate state that requires model/list to succeed and return nothing usable.
  • No checked radio in the model dropdown while the pill names an unlisted running model — the intended consequence of not offering the id. An explicit "unavailable" marker is a new UI affordance and belongs in a follow-up, together with the point above.
  • Mixed-version skew: a new client against an old host still sees the raw id offered with no effort row, because the old host's fabricated efforts: [] becomes options: [] and [] ?? x is []. This is main's behaviour, and it cannot be closed by treating an empty options as absent — cursor and gemini have legitimate models with options: [] and neither defines unknownModelOptions.
  • Claude's unknownModelOptions exposes the extended effort ladder for an unlisted model and the host does not enforce a narrower one (readClaudeModelEffortLevels returns null). Inherent to restoring the effort picker at all.
  • Stricter worker-start --model validation is tracked separately in fix(native-chat): show only official model names and require them for worker-start --model #19682; worker-start --model behaves exactly as on main.

Tests

Every ablation below was re-proven at the final head. Each was bracketed: the removed symbol was grepped before and after the run to prove the ablation actually landed, then restored and re-run.

Lever ablated Test Ablated Restored
Launch-default guard never adopts a model no list carries as the launch default (both branches) 2 failed / 32 32 passed
Narrowed snapshot guard names a running model an empty list cannot offer, and keeps its effort row 1 failed / 24 24 passed
Codex seed floor re-added keeps both pills…, refuses a seeded model the account is not entitled to when nothing is listed 2 failed / 9 9 passed
Options resolver in the command recorder + emitter records and persists a typed option under a model no list carries, composes an unlisted model from the launch-safe options 2 failed / 27 27 passed
Composer currentValue acceptance accepts the running model as a no-op even though it is never offered 1 failed / 14 14 passed

Two honesty notes on this table:

  • An earlier revision claimed every behavioural change had a failing-without-it test. That was false for src/shared/native-chat-session-option-commands.ts — reverting it to main left the suite fully green. Both call sites are covered now: ablated to main, the emitter produces /model gpt-unlisted-fast instead of …-high-fast and the recorder returns changed: false.
  • The Codex entitlement test as first written listed one live model, so the floor never engaged and the assertion held with or without it. It was corrected to use an empty model/list, the only state where the floor becomes catalog.models; it is ablation-sensitive now.

No shipped catalog both composes options into the model value and defines unknownModelOptions, so the emitter test pins the shared rule against a catalog shaped that way rather than a live one. The recorder test uses the real Claude catalog, where the widening is observable today.

worker-launch-preferences was converted to the shared resolver as a pure dedup — behaviour-identical by inspection of both branches, with its existing 22 tests unchanged and green.

Verification

  • pnpm tc exit 0; mobile tsc --noEmit exit 0.
  • pnpm run check:code-quality:changed: 0 new findings across 21 changed files, including the type-aware and React Doctor passes.
  • oxlint clean on all 21 changed files.
  • Mobile: src/session 156 files / 1476 tests passed.
  • Root suite: 28 files / 76 tests failed. All were re-run in isolation; 20 files passed, and the remaining 5 files / 6 tests fail identically at the PR base with none of these changes applied, so they are pre-existing and unrelated (real-binary integration, relay/subprocess timing, CLI selector messaging, release-checkout).

Merge Sim added 2 commits September 9, 2026 14:57
Every surface that draws or applies a model's options did its own
`models.find(...)?.options ?? []`, so an id absent from the list it was handed
resolved to no options at all. `resolveAgentSessionOptionLaunch` already knew
better: it falls back to the catalog's `unknownModelOptions`, because these
options are global CLI flags rather than per-model capabilities.

`resolveCatalogModelOptions` is that one answer. The launch resolver, the
command recorder, the desktop applier and the mobile hook adopt it here; the
snapshot follows in the next commit, which is what makes it load-bearing. No
behaviour changes yet — every caller passes a list that already carries the id.

Mobile drops its `activeModels` wrapper with it: it reconciled `catalog.models`
against a record whose model is always one of them, so it never added a row.
Four layers appended a `{ id, label: id, options: [] }` row for a tracked model
id no list carried — the shared snapshot's `withTrackedNativeChatModel`, the
structured catalog builder, and the Claude and Codex structured readers. A
worker launched with `worker-start --model claude-opus-5` therefore offered that
raw launch flag in the model dropdown as if it were a selectable model, and the
`options: []` behind it took the effort picker away for that whole session.

None of them fabricate now. A seeded alias the host's CLI has retired still gets
its seed row back — that is a real model — but an id neither list carries is
never a choice. Its options come from `resolveCatalogModelOptions`, so the
effort row stays present and settable through the picker and the applier alike.

What the composer shows is unchanged and deliberate: the model pill still reads
`currentValue` and the record's own source, so it NAMES the id the session is
running (`nativeChatModelPillLabel` already falls back to the raw id when no
choice matches it). Withholding it would leave a neutral "Model" over a live
session, which is worse than an unfamiliar name.

Codex needed one more thing. Removing its fabrication makes an empty
`model/list` reachable beside a truthy `current.model`, and the snapshot returns
nothing at all for an empty list — blanking the effort pill too. The reader now
floors its list on the seed, the same fallback the Claude reader already
applies, placed after the existing guard so a thread with no model at all still
raises "codex app-server returned no available models".

Stricter `worker-start --model` validation is deliberately out of scope; it is
tracked separately in #19682. `worker-start --model` behaves exactly as before.
@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The change keeps unlisted reported models as current values without adding them to selectable model lists. Claude and Codex readers now return provider-listed models only. Shared option resolution supplies options for listed and unlisted model IDs. Native chat snapshots, commands, actions, labels, effort controls, and launch-default persistence use this behavior. Tests cover provider, shared, mobile, and renderer flows.

Merge Risk: 🟡 Moderate · up to d4ef4

Unlisted Codex models may show effort choices that cannot be applied, leaving affected users unable to change effort. The new mobile empty-picker message is also not translatable. Resolve the effort validation mismatch before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides detailed bug context, implementation changes, consequences, tests, and verification results. However, it omits the required Linked Issue entry and the required Visual Proof se… Add a valid issue reference under Linked Issue, provide before-and-after screenshots or videos for the UI and behavior changes, or state N/A with a reason only if no visual or interaction change exists. Complete the applicable Testing, AI D…
Docstring Coverage ⚠️ Warning Docstring coverage is 19.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 25 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: displaying the running model and preventing raw launch flags from becoming selectable models.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description provides detailed bug context, implementation changes, consequences, tests, and verification results. However, it omits the required Linked Issue entry and the required Visual Proof section for UI and behavior changes. It also does not include the template checklist confirmations.

Resolution

Add a valid issue reference under Linked Issue, provide before-and-after screenshots or videos for the UI and behavior changes, or state N/A with a reason only if no visual or interaction change exists. Complete the applicable Testing, AI Disclosure, Review, Notes, Agent skill upstream boundary, and Checklist sections.

Full details: Docstring Coverage

Explanation

Docstring coverage is 19.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 25 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ 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.

Caution

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

⚠️ Outside diff range comments (1)
src/main/codex/codex-structured-session-options.ts (1)

198-201: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Resolve options for an unlisted current model before validating effort.

When catalog.current.model is not in catalog.models, model is undefined. An effort update then always throws at Line 198, although the snapshot exposes a settable effort picker for that same model. Use resolveCatalogModelOptions here, or derive the effective effort choices through the same resolver used by the snapshot.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 35878a64-eea9-460c-8d78-8480265ff031

📥 Commits

Reviewing files that changed from the base of the PR and between aac38d6 and c07da14.

📒 Files selected for processing (16)
  • mobile/src/session/use-mobile-native-chat-session-options.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/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/shared/agent-session-option-catalog.ts
  • src/shared/agent-session-option-launch.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; 7 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 found.

Reviewed changes

  • Shared resolveCatalogModelOptions resolver — new launch-safe resolver (listed model's own options, else catalog.unknownModelOptions) adopted by the snapshot, both command builders, desktop currentApply, and the mobile hook; also a pure-refactor unification of resolveAgentSessionOptionLaunch / removeOverriddenAgentSessionArgs onto the same helper.
  • De-fabrication across four layers — withTrackedNativeChatModel, structuredAgentSessionOptionCatalog, readClaudeStructuredSessionOptions, and readCodexStructuredSessionOptions no longer invent a { id, label, options: [] } row for an unlisted tracked model, so a raw launch flag is named (pill) but never offered (choice).
  • Codex seed floor — seedCodexModels() placed after the no-model guard so a restored thread with a current.model and empty model/list keeps its model + effort pills.
  • Mobile parity — the hook passes catalog.models directly (the old activeModels() wrapper was a no-op over the full seed) and resolves option apply through the new resolver.

Verified locally: the six changed test files pass (36 node/shared/main + 36 renderer + 40 claude-adapter + 17 mobile hook tests), typecheck:node, typecheck:web, and mobile typecheck are all clean. The seed-alias reconciliation contract (withTrackedNativeChatModel still re-adds a retired-but-seeded alias) and the end-to-end pill-naming contract are both pinned by tests that were ablated against the old behavior.

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

Merge Sim added 2 commits September 9, 2026 16:38
…ex on its seed

An id carried by neither the discovered list nor the catalog seed reached us as a
raw launch flag or a typed `/model`. It is named as the running model, but it is
evidence of nothing, so it must never become the persisted `-m` launch default.

On main that hole was reachable through the model row, whose fabricated entry was
selectable. Removing that row closed it and restoring the effort row for an
unlisted model opened an equivalent route through effort: launch with
`--model claude-opus-5`, change effort, and every later Claude native chat
launches with that flag. Same hazard, new route. `modelIsAdoptableAsLaunchDefault`
now refuses an id neither list carries in both the discovered and the
not-yet-discovered branch; retirement semantics for seeded or listed ids are
unchanged, and the value stays scoped under the model id for a later reselect.

Drop the Codex seed floor. It contributed nothing it claimed to protect: any
single row restores both pills, and the effort row comes from
`unknownModelOptions`. It also defeated a host-side guard, since a model pick is
validated against `catalog.models` and an entitlement-gated seed id would have
passed and been stored, deferring the failure to `turn/start`. The real defect was
the snapshot guard, so narrow that instead: bail only when the list is empty and
no model id resolves either. An empty list with a running model now emits the
model row naming what runs, with empty choices, plus the effort row. Both pill
helpers already fall back to the raw id, so neither surface blanks.

Accept `/model <the model you are running>` as a no-op instead of answering that
it is not available, which contradicted the pill.

Route worker-launch-preferences through the shared options resolver, correct a
stale comment about callers reconciling an unlisted id back into the list, and
cover the two command call sites that had no failing-without-them test.
It listed one live model, so the floor never engaged and the assertion held with
or without it. An empty model/list is the only state where the floor becomes
catalog.models and lets an entitlement-gated seed id past the host guard.

@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 found.

Reviewed changes (delta against the prior pullfrog review at c07da14d38)

  • Removed the Codex seed floor — readCodexStructuredSessionOptions no longer floors an empty model/list onto seedCodexModels(), so a restored thread with a current.model returns { models: [], current } instead of inventing five seeded ids; the no-model guard still raises when nothing resolves.
  • Launch-default guard — modelIsAdoptableAsLaunchDefault returns false for an id neither the discovered list nor the seed carries, so setting effort under a raw worker-start --model flag no longer persists that flag as the launch default.
  • Snapshot empty-list guard relaxed — buildNativeChatSessionOptionSnapshot now returns [] only when the list is empty and no model resolves; a running model still names itself (currentValue + empty choices) and keeps a settable effort row.
  • Composer no-op — dispatchStructuredAgentSessionComposerCommand accepts re-typing the running model as an accepted no-op instead of refusing it.
  • Pure refactor — worker launch-preference effort validation now routes through resolveCatalogModelOptions, verified semantically identical to the findCatalogModel/findCatalogOption chain it replaced.

Verified locally against the full and incremental diffs: the resolver refactor is behavior-neutral, the seed-floor removal is pinned by a test (refuses a seeded model the account is not entitled to…) that only fails with the floor present, and the launch-default and snapshot guards are each covered by ablation-sensitive tests.

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

The model descriptor can now be emitted with no choices when a model is
running but `model/list` comes back empty. Mapping that to rows produced
an empty dropdown with no rows and no explanation.

Render the same muted one-liner the unknown-boolean case already uses, on
desktop and on the mobile sheet. The pill still names the running model.

@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: 89228b39-e16a-41bd-b281-def86b4ebecb

📥 Commits

Reviewing files that changed from the base of the PR and between 538270e and d4ef47e.

📒 Files selected for processing (5)
  • mobile/src/session/MobileNativeChatSessionOptionPickers.test.ts
  • mobile/src/session/MobileNativeChatSessionOptionRows.tsx
  • src/renderer/src/components/native-chat/NativeChatSessionOptionPickers.test.tsx
  • src/renderer/src/components/native-chat/NativeChatSessionOptionPickers.tsx
  • src/renderer/src/i18n/locales/en.json

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

const { currentValue, choices } = descriptor.kind
// Why: a running value with nothing listable behind it would render an empty card.
if (choices.length === 0) {
return <SessionOptionCaption>No choices reported by the agent</SessionOptionCaption>

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 | 🟡 Minor | ⚡ Quick win

Localize the empty-choice caption.

Move this new user-facing string to the mobile localization source and render it through its intent-named localization ID. The hard-coded text cannot be translated.

Based on learnings: use intent-named localization IDs for newly added user-facing strings in TypeScript and TSX files.

Source: Learnings

@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 found.

Reviewed changes (delta against the prior pullfrog review at 538270e4d)

  • Empty model picker gets an explanation — when a running model emits no choices (empty model/list), the desktop DescriptorMenuRows and the mobile DescriptorRows now render a muted "No choices reported by the agent" caption instead of a blank radio group/sheet, mirroring the existing unknown-boolean pattern; the pill still names the running model.

Verified the two new tests pass (desktop 15 tests, mobile 14 tests) and confirmed the noChoices key is enrolled in en.json so verify:localization-extraction stays green.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron UI validation — PASS (1 state blocked)

Tested head d4ef47e5d0 in an isolated worktree; git rev-parse HEAD = d4ef47e5d09dd343438b9d46b0b984e72128c9e1, identical to the PR head ref. Isolated dev instance (private profile + private renderer port), windowless background launch, driven over CDP with Playwright. Renderer ownership proved per attach (/@fs 200 for this worktree, 403 for a peer). No production source was modified.

# State Verdict
1 Listed model: pill names it, dropdown lists official models, effort picker present PASS
2 Unlisted running model: pill names the raw id PASS
3 Same session: raw id absent from the dropdown PASS
4 Same session: effort picker present and settable PASS
5 Empty-state "No choices reported by the agent" BLOCKED
6 Errors / blank panels / console exceptions None found

1. Listed model — no-regression baseline (PASS)

Live structured Claude session. Composer pill names the running model, effort pill reads High.

state1-listed-model-composer.png

Model dropdown lists the six models the provider reported, with the running one radio-selected:

state1-model-dropdown-official.png

Effort picker offers Low / Medium / High / Extra high / Max, High selected:

state1-effort-picker-open.png

2. Unlisted running model is named, not blanked (PASS)

Session whose tracked model is claude-opus-5 — carried by neither the discovered list nor the seed. The pill names it rather than falling back to a neutral Model placeholder. Trigger aria-label is Model claude-opus-5.

state2-unlisted-model-named-in-pill.png

3. The raw id is never offered as a choice (PASS)

Same session, dropdown open: exactly the 6 official models, no claude-opus-5 row, and no radio checked (the running model is deliberately not among the choices). Asserted programmatically — 6 menuitemradios, zero aria-checked="true", and the raw id appears nowhere in the menu text.

state3-dropdown-excludes-raw-id.png

4. Effort picker survives and is settable (PASS)

The picker is present for the unlisted model, drawn off the launch-safe option set, with all five choices:

state4a-effort-picker-present.png

Picking Max actually takes: the pill becomes Effort Max (aria-label="Effort Max") and the transcript records Ran /effort max, so the mid-session command really dispatched — not just a label repaint.

state4b-effort-set-to-max.png

5. Empty-choices empty-state — BLOCKED

Not reachable honestly in this rig. The new label renders only when a descriptor has zero choices, i.e. a model is running while the list is empty. Both Claude paths floor the list before that can happen — the PTY lane falls back to the seed catalog, and the structured Claude reader does discovered.length > 0 ? discovered : seedModels(). Only a Codex model/list returning empty can produce it, which I can't force without a Codex account in that state or editing source. Not reported as a pass or a fail; the PR does carry unit coverage for it on both desktop and mobile.

6. Errors — none

Zero console errors across the whole run, no blank panels, no uncaught exceptions. Only benign FileListingCancelledError from explorer refreshes.


How states 2–4 were staged, and what that does and doesn't prove

I did not run worker-start --model <raw-id>. I seeded the tracked id through the app's own persisted launch-default setting instead. Both routes converge on the same producer (seedNativeChatAppliedSessionOptions) — worker-start reaches it via AgentLaunchPreferences → pane startup — and I confirmed resolveWorkerLaunchPreferences performs no model-membership check at this head, so an unlisted --model is accepted there. I avoided the CLI because it is not worth the risk of a worker-start landing in the developer's live Orca instance rather than my isolated one. The seeded value then flowed through the real launch → record → snapshot → render path untouched.

State 1 is a live structured Claude session. States 2–4 are on the PTY native-chat lane. The snapshot builder and the picker component are shared by both lanes and are exactly what this PR changes, so the rendering evidence carries; I have not exercised the structured lane's own reader against an unlisted current model.

One observation, not a defect claim

Selecting an official model (Sonnet) from the picker dispatched /model sonnet, after which the model pill fell back to the neutral Model placeholder and the effort pill disappeared. I ran a control and it is not this PR's unlisted-model path: the same thing happens on a fresh PTY chat tab with no unlisted model anywhere in play, picking the same fully-listed Sonnet. In my rig no live claude CLI was attached to those PTYs, so nothing could confirm the dispatched value back — that is the likely mechanism. I did not run a main baseline, so I am not asserting this is pre-existing, only that it is not specific to the behavior under review here. Flagging it so someone with a live PTY session can confirm.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status — ready to merge

Reviewed at head d4ef47e5d0 across three adversarial review rounds plus a start- and end-of-session readiness pass. Rounds 2 and 3 returned clean. CI is green at this exact SHA (18 success, 11 skipped, 0 pending).

What changed during review

Round 1 found seven issues; all were fixed and pushed.

Fix Why it mattered
modelIsAdoptableAsLaunchDefault now refuses an id in neither the discovered list nor the seed The one real bug found. Widening the effort row to unknownModelOptions made persist(...) fire for effort on an unlisted model. Changing effort once on a worker-start --model <raw-id> session made that raw id the persisted --model default for every future chat.
Deleted seedCodexModels() and the Codex seed floor; narrowed the snapshot guard to models.length === 0 && !effectiveModelId The floor was proven by ablation to contribute nothing — any single row restores both pills, and the effort pill comes from unknownModelOptions, not the seed. Worse, it defeated a host-side guard: applyValidatedCodexStructuredSessionOption validates against catalog.models, so with the floor in place an entitlement-gated id passed validation and deferred failure to turn/start. Net −31 lines.
Coverage for two untested sites in native-chat-session-option-commands.ts Reverting that file to main left 55/55 green — the PR's riskiest hunk (the write and emit sites) had zero coverage.
worker-launch-preferences.ts moved onto the shared resolver A seventh site hand-inlining the resolver's exact semantics.
/model <the model you are running> is now a no-op success It errored with "… is not an available model for this chat session", contradicting the pill this PR exists to make truthful.
Empty-state line when a descriptor has zero choices (desktop + mobile) The narrowed guard made a blank dropdown panel reachable.
Stale comment corrected Claimed callers still reconcile unlisted ids back into the list.

The PR body previously carried three claims that were provably false; all three have been corrected in place.

Verification

  • pnpm tc 0 · mobile tsc --noEmit 0 · 10 targeted test files 172/172 · mobile suite 518 files / 4239 passed · oxlint, check:code-quality:changed (incl. React Doctor), max-lines ratchet, and all four localization gates green.
  • Lint and i18n invocations were probe-proven sensitive, not merely green: an unused-const oxlint seed produced nothing (a false clean), so a debugger seed was used instead; deleting the new i18n key turns verify:localization-catalog red naming that exact key and line.
  • Every new test is ablation-proven at the final head: restoring the Codex floor fails 2, removing the launch-default guard fails 2, widening the snapshot guard fails 1, the composer branch 1, the commands resolver 2. None are pins.
  • Root-suite failures were checked against a real main baseline (21 files reverted, revert proven landed two ways). No root-suite failure is caused by this PR. Note the suite is non-deterministic under load — two full runs produced different flake sets; every extra failure passes in isolation.
  • Backcompat: the launch-default guard is monotonically restrictive (new = old ∧ (inModels ∨ inSeed)) — it can only flip true→false and can never write a new model id.

UI validation

Electron CDP screenshots posted in this comment — 4 of 5 states pass: the listed-model baseline is clean, the pill names the raw id, the dropdown provably excludes it (6 menuitemradios, 0 aria-checked, id absent from menu text), and the effort picker is present and genuinely dispatches (Ran /effort max). The fifth state (the new empty-state) is blocked, not passed — it needs an empty Codex model/list, which could not be produced without editing source.

One observation during QA — the model pill reverting to a placeholder after a pick — was chased to ground and is pre-existing: Claude's 5s model-switch confirmation observer times out to outcome: 'unknown' with no live CLI attached, and clearModelTruth() nulls effectiveModelId. A three-arm ablation reproduces it identically at main and at this head, and the files carrying that path are byte-identical between them. Worth a separate ticket; not a gate here.

Accepted, not fixed

  • An unlisted running model shows no checked item in the dropdown while the pill names it. Deliberate; an explicit unknown-model marker is a follow-up.
  • New client against an old host still sees the raw id offered — this is main's behaviour, and it cannot be closed by ignoring empty options, since cursor and gemini have legitimate models with options: [] and neither defines unknownModelOptions.
  • Stricter worker-start --model validation remains out of scope (fix(native-chat): show only official model names and require them for worker-start --model #19682).

Outstanding

Mobile emulator QA has not been run — the skill is gated to explicit user invocation. Mobile risk is low: the hook change is a provable no-op, mobile's own suite is 4239 green, and the empty-state is near-unreachable on mobile because catalog.models is non-empty for every shipped catalog.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron validation, pass 2 — closing the two gaps pass 1 could not reach

Head SHA validated: d4ef47e5d09dd343438b9d46b0b984e72128c9e1 (confirmed equal to the PR head at time of testing).

Run on an isolated dev instance (own ORCA_DEV_USER_DATA_PATH, own CDP port, own renderer port, hidden window, CDP screenshots only). The live Orca app was never addressed — see the targeting proof under Gap B. Pass 1's states 1–4 were not re-run; this comment only covers what pass 1 left open.


Gap A — the zero-choice empty state — PASS (staged with a test double at the process boundary; no source edit)

The PR narrows a guard to models.length === 0 && !effectiveModelId, which makes a zero-choice model row reachable and adds the No choices reported by the agent line. Both Claude paths floor the model list, so only an empty Codex model/list reaches it.

How it was staged. A stub codex app-server binary, substituted at the real process boundary — Orca spawned it, handshook with it, and read its wire responses exactly as it would the real one. No file under src/ was modified. The stub answered:

request stub response
initialize {}
thread/start { thread: { id }, model: "gpt-5.9-codex-stub", reasoningEffort: "medium" }
model/list { data: [], nextCursor: null } ← zero choices

The session was created through the real structured lane (orca orchestration worker-start --agent codex), which returned mode: structured / reason: user_default. The stub's own traffic log records the exact frames Orca sent and received, so the mechanism is proven rather than inferred.

Result: the pill still names the running model (gpt-5.9-codex-stub), the picker shows the empty-state line instead of a blank panel, and the Effort pill (Medium) is unaffected. No crash, no throw, pill not blanked, 0 console errors.

Scoped assertion at the moment of capture:

visible Model pill aria-label : "Model gpt-5.9-codex-stub"
open menu text                : "No choices reported by the agent"
choice count                  : 0

gapA-codex-zero-choices-empty-state.png

Worth knowing for future rigs (not a defect in this PR). The one settings-level lever that redirects the codex binary — agentDefaultEnv.codex — disqualifies codex from the structured lane, so it can never be used to stub the structured path. Ablation, same command, only the setting differing:

agentDefaultEnv.codex resulting mode
set terminal — reason: tui_launch_customization
removed structured — reason: user_default

The stub therefore had to be injected through the login-shell PATH probe that structured launch resolution uses, scoped to this instance only (no user-level file was modified).


Gap B — the real worker-start --model entry point — PASS (real launch path, nothing seeded)

How it was staged. The actual command, against the isolated instance:

orca orchestration worker-start --agent claude --model claude-opus-5 \
  --worktree path:<throwaway scratch repo> --from <coordinator handle>

Crucially, the app's persisted launch-default setting nativeChatSessionOptions was {} (empty) for this run — pass 1 seeded it, this pass did not. So the value in the pill can only have arrived via the --model flag through AgentLaunchPreferences. This is execution proof, not a code-path argument.

Start receipt:

mode.mode                : "structured"
launch.effective.model   : "claude-opus-5"
turnStart                : "observed"
state                    : "ready"

Instance-targeting proof (done before the mutating command, not after). The dev instance writes its own CLI shim pinning ORCA_USER_DATA_PATH to the temp profile; orca status through that shim reported pid: 75283, which is a verified descendant of the launcher process this pass started. The user's live Orca was a different pid on a different socket, and was never contacted. The created worker terminal and worktree both belong to the isolated instance's throwaway scratch repo — never the orca repo.

Result: the composer pill names the raw unlisted id claude-opus-5, and the worker completed its turn (ACK).

gapB-worker-start-model-pill.png


The accepted P2 trade-off, now visible — captured for eyeballing

(same real worker-start session; dropdown opened) An unlisted running model means the pill names it while no item in the dropdown is checked. Pass 1 asserted this programmatically; here is what it actually looks like, since it is the most user-visible consequence of the PR:

menu items                 : 6   (role=menuitemradio)
aria-checked="true" count  : 0
raw id present in menu text: false

p2-unlisted-model-no-checked-item.png

The panel reads as an ordinary model list with nothing selected. Whether that is acceptable is a product call — it is exactly the documented trade-off, not a regression.


Minor observation, pre-existing, not caused by this PR

The Claude model dropdown shows two entries both labelled "Fable" (Fable 5.1 · Most capable… and Fable 5 - most capable…), distinguishable only by their description text. Visible in the P2 screenshot. Catalog labelling, outside this PR's scope.

Limits of this evidence

  • Gap A proves the shipped renderer/producer behaviour given a zero-choice model/list on the wire. The stub is not codex; it is a faithful responder at the process boundary, not a model provider.
  • The empty state was exercised on the Codex lane only. On the Claude lane it remains unreachable by design, because that lane floors the list with the seed catalog.
  • Pass 1's states 1–4 were not re-run here.
  • Rig teardown: dev instance stopped, stub removed, scratch repo discarded. Worktree left clean at d4ef47e5d0; both lockfiles untouched.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing in favour of a clean split — this PR had grown to four independent concerns in 26 files, which made it hard to review and hard to reason about.

Re-cut as separate PRs, each doing one thing:

  1. Name a native-chat model only when it is available or agent-reported #19852 — the native chat names a model only when it is one of the available models, so a raw launch flag is neither offered as a choice nor displayed as the model name. 4 production files. (open)
  2. Next — an unlisted model must not become the persisted -m launch default. modelIsAdoptableAsLaunchDefault currently returns !catalog.discoveredModelsAreAuthoritative || …, and Claude is not authoritative, so once models are discovered any id qualifies.
  3. Then — restore the effort picker for a model the catalog cannot name, via a shared launch-safe options resolver. Inert until Name a native-chat model only when it is available or agent-reported #19852 lands, since the fabricated row it would fall back from still exists today.
  4. Then — an empty model dropdown should explain itself instead of opening a blank panel.

Nothing here is lost; each piece lands on its own with its own tests and ablations. Stricter worker-start --model validation remains parked separately in #19682.

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