Repository navigation
Show the model a native-chat session is actually running, and stop offering raw launch flags - #19791
brennanb2025 wants to merge 5 commits into
Conversation
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.
📝 WalkthroughWalkthroughThe 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 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)
✅ Passed checks (3 passed)
Full details: Description checkExplanation 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 CoverageExplanation 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.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
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 winResolve options for an unlisted current model before validating effort.
When
catalog.current.modelis not incatalog.models,modelisundefined. An effort update then always throws at Line 198, although the snapshot exposes a settable effort picker for that same model. UseresolveCatalogModelOptionshere, 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
📒 Files selected for processing (16)
mobile/src/session/use-mobile-native-chat-session-options.tssrc/main/claude/claude-structured-session-adapter.test.tssrc/main/claude/claude-structured-session-options.test.tssrc/main/claude/claude-structured-session-options.tssrc/main/codex/codex-structured-session-options.test.tssrc/main/codex/codex-structured-session-options.tssrc/renderer/src/components/native-chat/native-chat-pty-session-options.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-apply.tssrc/renderer/src/components/native-chat/native-chat-session-option-labels.test.tssrc/shared/agent-session-option-catalog.tssrc/shared/agent-session-option-launch.tssrc/shared/native-chat-session-option-commands.tssrc/shared/native-chat-session-option-snapshot.test.tssrc/shared/native-chat-session-option-snapshot.tssrc/shared/structured-agent-session-options.test.tssrc/shared/structured-agent-session-options.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Shared
resolveCatalogModelOptionsresolver — new launch-safe resolver (listed model's own options, elsecatalog.unknownModelOptions) adopted by the snapshot, both command builders, desktopcurrentApply, and the mobile hook; also a pure-refactor unification ofresolveAgentSessionOptionLaunch/removeOverriddenAgentSessionArgsonto the same helper. - De-fabrication across four layers —
withTrackedNativeChatModel,structuredAgentSessionOptionCatalog,readClaudeStructuredSessionOptions, andreadCodexStructuredSessionOptionsno 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 acurrent.modeland emptymodel/listkeeps its model + effort pills. - Mobile parity — the hook passes
catalog.modelsdirectly (the oldactiveModels()wrapper was a no-op over the full seed) and resolves optionapplythrough 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.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…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.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (delta against the prior pullfrog review at c07da14d38)
- Removed the Codex seed floor —
readCodexStructuredSessionOptionsno longer floors an emptymodel/listontoseedCodexModels(), so a restored thread with acurrent.modelreturns{ models: [], current }instead of inventing five seeded ids; the no-model guard still raises when nothing resolves. - Launch-default guard —
modelIsAdoptableAsLaunchDefaultreturnsfalsefor an id neither the discovered list nor the seed carries, so setting effort under a rawworker-start --modelflag no longer persists that flag as the launch default. - Snapshot empty-list guard relaxed —
buildNativeChatSessionOptionSnapshotnow returns[]only when the list is empty and no model resolves; a running model still names itself (currentValue+ emptychoices) and keeps a settable effort row. - Composer no-op —
dispatchStructuredAgentSessionComposerCommandaccepts 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 thefindCatalogModel/findCatalogOptionchain 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.
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.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 89228b39-e16a-41bd-b281-def86b4ebecb
📒 Files selected for processing (5)
mobile/src/session/MobileNativeChatSessionOptionPickers.test.tsmobile/src/session/MobileNativeChatSessionOptionRows.tsxsrc/renderer/src/components/native-chat/NativeChatSessionOptionPickers.test.tsxsrc/renderer/src/components/native-chat/NativeChatSessionOptionPickers.tsxsrc/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> |
There was a problem hiding this comment.
🎯 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
There was a problem hiding this comment.
✅ 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(emptymodel/list), the desktopDescriptorMenuRowsand the mobileDescriptorRowsnow 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.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Electron UI validation — PASS (1 state blocked)Tested head
1. Listed model — no-regression baseline (PASS)Live structured Claude session. Composer pill names the running model, effort pill reads Model dropdown lists the six models the provider reported, with the running one radio-selected: Effort picker offers Low / Medium / High / Extra high / Max, 2. Unlisted running model is named, not blanked (PASS)Session whose tracked model is 3. The raw id is never offered as a choice (PASS)Same session, dropdown open: exactly the 6 official models, no 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: Picking 5. Empty-choices empty-state — BLOCKEDNot 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 6. Errors — noneZero console errors across the whole run, no blank panels, no uncaught exceptions. Only benign How states 2–4 were staged, and what that does and doesn't proveI did not run 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 claimSelecting an official model ( |
Review status — ready to mergeReviewed at head What changed during reviewRound 1 found seven issues; all were fixed and pushed.
The PR body previously carried three claims that were provably false; all three have been corrected in place. Verification
UI validationElectron 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 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 Accepted, not fixed
OutstandingMobile 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 |
Electron validation, pass 2 — closing the two gaps pass 1 could not reachHead SHA validated: Run on an isolated dev instance (own 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 How it was staged. A stub
The session was created through the real structured lane ( Result: the pill still names the running model ( Scoped assertion at the moment of capture: Worth knowing for future rigs (not a defect in this PR). The one settings-level lever that redirects the codex binary —
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
|
|
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:
Nothing here is lost; each piece lands on its own with its own tests and ablations. Stricter |











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:
worker-start --model claude-opus-5renderedclaude-opus-5as a pickable option besideOpus,Sonnetand the rest.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'sunknownModelOptions. Seven call sites read it — the snapshot, the command recorder and emitter, the desktop applier, the mobile hook, andworker-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.
withTrackedNativeChatModelreconciles 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:structuredAgentSessionOptionCatalogsetscatalog.modelsto the discovered list, so the seed lookup scans the same array and can never find anything, andstructuredAgentSessionOptionSnapshotnever calls it. Structured Codex withcurrent.model = 'gpt-5.6-sol'(seeded, 7 effort levels) and a list without it yieldschoices: ['gpt-live'], no seed row, and 5 effort levels fromunknownModelOptionsrather than the seed's 7.mainalso 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
listModelssucceeds. The launch path resolves againstcatalog.modelswhile 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
modelIsAdoptableAsLaunchDefaultdecides whether a picker write may also persistmodelas the-mlaunch 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
mainthat 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 errorsdispatchStructuredAgentSessionComposerCommandresolved its argument againstdescriptor.kind.choicesonly, 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'scurrentValueas 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/listreachable alongside a truthycurrent.model.buildNativeChatSessionOptionSnapshotreturned[]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
choicesarray — plus the effort row fromunknownModelOptions. Both pill helpers already fall back to{ value: currentValue, label: currentValue }, so neither surface blanks.An earlier revision instead floored
readCodexStructuredSessionOptionson the Codex seed. That is removed. It contributed nothing it claimed to protect (any single row restores both pills, and the effort row comes fromunknownModelOptions); it defeated a host-side guard, sinceapplyValidatedCodexStructuredSessionOptionvalidates a model pick againstcatalog.models, so an entitlement-gated id likegpt-5.6-solwould have passed and been stored, deferring the failure toturn/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 whenmodelOptionrejects every row, so the floor would have masked a Codex wire-format change behind five hardcoded ids.The
codex app-server returned no available modelsguard and its test are untouched.Accepted consequences
model/listreturns 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 requiresmodel/listto succeed and return nothing usable.efforts: []becomesoptions: []and[] ?? xis[]. This ismain's behaviour, and it cannot be closed by treating an emptyoptionsas absent — cursor and gemini have legitimate models withoptions: []and neither definesunknownModelOptions.unknownModelOptionsexposes the extended effort ladder for an unlisted model and the host does not enforce a narrower one (readClaudeModelEffortLevelsreturnsnull). Inherent to restoring the effort picker at all.worker-start --modelvalidation is tracked separately in fix(native-chat): show only official model names and require them for worker-start --model #19682;worker-start --modelbehaves exactly as onmain.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.
never adopts a model no list carries as the launch default(both branches)names a running model an empty list cannot offer, and keeps its effort rowkeeps both pills…,refuses a seeded model the account is not entitled to when nothing is listedrecords and persists a typed option under a model no list carries,composes an unlisted model from the launch-safe optionscurrentValueacceptanceaccepts the running model as a no-op even though it is never offeredTwo honesty notes on this table:
src/shared/native-chat-session-option-commands.ts— reverting it tomainleft the suite fully green. Both call sites are covered now: ablated tomain, the emitter produces/model gpt-unlisted-fastinstead of…-high-fastand the recorder returnschanged: false.model/list, the only state where the floor becomescatalog.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-preferenceswas 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 tcexit 0; mobiletsc --noEmitexit 0.pnpm run check:code-quality:changed: 0 new findings across 21 changed files, including the type-aware and React Doctor passes.oxlintclean on all 21 changed files.src/session156 files / 1476 tests passed.