Repository navigation
Name a native-chat model only when it is available or agent-reported - #19852
brennanb2025 wants to merge 7 commits into
Conversation
The composer echoed back whatever model string a launch was given. Every layer that builds the picker appended a fabricated row for an id no list carried — the shared snapshot, the shared structured catalog, and the Claude and Codex structured readers in main — so `worker-start --model claude-opus-5` made that raw flag both a selectable row in the dropdown and the name on the model pill, though it is only what the user typed, not evidence of what the agent is running. No layer fabricates a row now. A tracked id that matches no available model is neither offered nor named: the pill falls back to the neutral "Model" label, and it resolves to a real name as soon as the agent reports one. Two cases are unchanged. An alias the host's CLI merely stopped listing is still re-added from the seed, so it keeps its row and its name. And a resolved id the CLI reports (`claude-opus-5[1m]`) still maps back onto the listed alias it belongs to (`opus[1m]`) through `currentModelId`, which is now pinned by a test. Both structured readers still report `current.model` byte-identically; only what they list changed. Dropping the Codex fabrication made `models: []` reachable alongside a resolved `current.model` — `readCodexStructuredSessionOptions` refuses only when no model resolves at all — which the snapshot's empty-list short-circuit would have turned into a blank pill. It now short-circuits only when nothing is tracked either. Deliberately left as separate follow-ups: restoring the effort picker for an unlisted model from `unknownModelOptions`, keeping an unlisted model out of the persisted launch default, and explanatory text for an empty dropdown.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughClaude and Codex option readers no longer add unlisted current models to provider catalogs. Shared snapshots now expose only listed models, mark unmatched tracked values as unknown, and name agent-reported unlisted values. Renderer tests verify that unknown models are excluded from choices and use neutral labels. Merge Risk: ⚪ Minimal · up to Unlisted models are no longer selectable unless cataloged, while agent-reported values remain visible and effort controls remain available. The covered behavior is ready to merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the behavior and testing in detail, but it omits or does not follow several required template sections, including ELI5, What Changed, Why, Linked Issue, Visual Proof, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. Resolution Reorganize the description using all required template headings. Add the linked issue, Visual Proof with screenshots/videos or an explicit N/A reason, testing checklist and tested platforms, AI disclosure details or the applicable exemption, Review, Agent skill boundary checkbox, Notes, and the final Checklist. Include explicit ELI5, What Changed, and Why sections. ✨ 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.
✅ No new issues found.
Reviewed changes
The PR removes the fabricated { id, label: id } model row from every layer that built the picker, so the native-chat pill and picker only ever name or offer a model that is genuinely available — a tracked id that maps back to a listed row, a still-seeded alias, or nothing (the neutral "Model" pill).
withTrackedNativeChatModel— drops the fabricated fallback while still re-adding a seed row for a seeded alias.buildNativeChatSessionOptionSnapshot—currentValue/valueSourcenow gate onlistedModel; the empty-list early return requires!effectiveModelId.structuredAgentSessionOptionCatalog/ Claude / Codex readers — stop fabricating an unlistedcurrent.modelrow, withcurrent.modelreporting unchanged.- Tests — 7 files touched, including a new
claude-structured-session-options.test.ts; the empty-list guard and the resolved-id mapping are both pinned with focused tests.
The core invariant holds: cliDefaultModelId always yields an id that is present in models, so the CLI-default path is unaffected, and the tracked-unlisted path now consistently renders valueSource: 'unknown' with no currentValue, which both the desktop and mobile pill labelers already handle. The Codex empty-list edge is correctly guarded and tested.
ℹ️ Nitpicks
src/renderer/src/components/native-chat/native-chat-session-option-labels.test.ts— the pre-existing "falls back to the raw id when the list no longer offers it" test (and its comment) describes builder state the PR removes: the builder now withholds an unlisted id, sonativeChatModelPillLabel's raw-id fallback is only reachable from a hand-built descriptor, never frombuildNativeChatSessionOptionSnapshot. Worth a comment tweak so the file doesn't document opposite behaviors side by side.src/shared/agent-session-option-catalog-claude-codex.ts— the CODEX seed comment "allow unknown persisted ids to pass through" is now partially stale:unknownModelOptionsstill servesagent-session-option-launch.ts/worker-launch-preferences.ts, but the picker pass-through this described is gone.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…y vector A typed `/model` cannot introduce an unlisted id: matchNativeChatCatalogModelId returns only ids drawn from the list it is handed, so a never-seen id either collapses to a catalog id (claude `/model claude-opus-5` -> `opus`) or matches nothing (codex). It can only re-assert an id already in the record. The origins that do enter verbatim are the launch flag and an agent report -- applyNativeChatReportedSessionOptions writes `values.model` with no catalog matching. Say that instead, so the comment is true of the code as written and does not lean on the reconciled row that #19852 removes. Comment only; no behaviour change.
Gating the displayed name purely on "is this id one of the available models" withheld a name the agent itself had confirmed. Claude prints a custom model in its own header, and the screen parser passes that raw name through on purpose — `claude-terminal-session-options` drops `effort` for a custom model while keeping its name, because a model with no catalog options is still a model that is running. That lands as `source: 'reported'` with a value no catalog carries, and the pill then read the neutral "Model" for a model Claude was displaying by name. The rule now keys on provenance as well as the list: name the model when it is an available model, or when the record's source is `reported`. Only an unconfirmed unlisted id is withheld — a launch flag lands as `applied`, a typed pick as `dispatched`, and neither is evidence of what the agent is running. So `worker-start --model claude-opus-5` still shows the neutral pill, and the real name appears as soon as the agent reports one, which is the whole point. The choice list is unchanged: an unlisted id is never offered as a pickable row whatever its source, so no raw string re-enters the picker. `reported` cannot distinguish "the agent told us" from "the agent echoed back what we sent"; for a header scrape that distinction does not matter, since the CLI renders what it is actually running.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The incremental delta adds the second half of the rule: a model id the picker cannot offer is still named when the agent itself reported it, while an unconfirmed id stays withheld.
buildNativeChatSessionOptionSnapshot— introducednameableModelId(listedModel || modelTracked?.source === 'reported'), socurrentValue/valueSourcenow gate on that whilechoicesremain available-models-only. Asource: 'reported'id is named but never offered;applied/dispatchedunlisted ids rendervalueSource: 'unknown'with nocurrentValue(the neutral pill).- Tests — corrected the withheld-case fixtures to use the sources the state layer actually writes (
appliedfor a launch flag,dispatchedfor Codex) and added focused tests for the reported-but-unlisted naming and thedispatched → reportedtransition, plus an end-to-end pill assertion in the labels suite. - Comments/docstrings — rewritten to state the two-halves rule (offered vs named) explicitly.
The provenance split is sound: applyNativeChatReportedSessionOptions only sets reported from agent output (terminal header scrape, or the Claude structured reader's confirmed flag), so the pill never echoes unconfirmed user input. Both the desktop (nativeChatModelPillLabel) and mobile (mobileModelPillLabel) labelers already fall back to currentValue when no choice matches, so a named-but-unlisted model renders correctly on both platforms. Verified the touched suites locally (76 + 37 tests green).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
`reported` means we read the value off the agent, not that the agent acknowledged a write of ours: `applyNativeChatReportedSessionOptions` yields it whenever `confirmed` is omitted, which the PTY path always does. That is the right reading for a header scrape — the CLI renders what it is running — but the comment now states the limit instead of implying a stronger guarantee. Also pins the record source behind the Codex empty-`model/list` case. Codex's reader emits no `confirmed` ids, so even a model its thread genuinely runs records as `dispatched` and stays unnamed, where the equivalent Claude case is named. Asserting the source makes that a stated consequence rather than an unexplained expectation, and reddens the day the reader starts confirming. And the raw-id label fallback now says it is the shape the builder emits for a reported-but-unlisted model, with the end-to-end test above driving exactly that descriptor through the builder — so it is no longer a hand-fed descriptor documenting a branch nothing could reach.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The incremental delta documents what reported proves and pins why Codex stays unnamed — no production behavior changed since the prior review.
- Clarified
reportedsemantics —buildNativeChatSessionOptionSnapshot's doc comment now states thatreportedmeans "read off the agent," not "acknowledged a write," and that the PTY path omitsconfirmedso every scraped value records asreported. - Fixed the stale labels-test comment — the "falls back to the raw id" test now explains that its descriptor is the builder's reported-but-unlisted shape rather than a hand-fed fixture, addressing the prior nitpick.
- Pinned the Codex
dispatchedcontract —structured-agent-session-options.test.tsnow assertssource: 'dispatched'for a Codex empty-list model, so it reddens when the reader starts emittingconfirmedids and the name can be turned on deliberately.
Both comments check out against the code (applyNativeChatReportedSessionOptions sets reported when confirmed is omitted; applyStructuredAgentSessionOptions passes result.current.confirmed ?? []), and the new assertion is load-bearing, not a tautology.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Withholding unlisted ids regressed Codex. On main the reader fabricated a row for an unlisted `current.model`, so the pill named it; dropping that fabrication left the name to provenance, and Codex reported none — `readCodexStructuredSessionOptions` emitted no `confirmed` ids, so `result.current.confirmed ?? []` recorded even a model the thread was genuinely running as `dispatched`. Probed against origin/main: a resumed thread on `gpt-unlisted` rendered `gpt-unlisted` there and `Model` here. That is the bug this branch fixes for Claude, recreated for Codex. `input.current` cannot answer it alone: it merges two sources. `session.options` holds a pick restored from a previous session or a write of ours the thread has not echoed, while `session.reportedOptions` has one writer — the opened or resumed thread — and is the agent's own state. Only `readLiveCodexSessionOptions` knows which answered, so it now says, and the reader passes it on. `confirmed` is an existing optional wire field whose absence already means "unconfirmed", so a host that predates this sends nothing and old clients read exactly what they read now. A model the reader substitutes because nothing was current is never confirmed: that id is our choice, not a report.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The incremental delta closes the Codex gap the prior review left as a documented follow-up: the Codex structured reader now reports confirmed ids, so a model the opened or resumed thread itself reports (rather than a pick we restored, or a default we substituted) records as reported and keeps its name even when unlisted.
readLiveCodexSessionOptions— now computesconfirmedfrom which ofmodel/effortfell through tosession.reportedOptions(the opened thread's own state) instead of a pending value insession.options.readCodexStructuredSessionOptions— now acceptsconfirmedand drops a'model'confirmation whenever it substituted the model rather than read it, so a default is never passed on as the agent's report.- Tests — added Codex cases pinning thread-confirmed vs restored-pick vs substituted-default, and the shared/PTY suites now pin the empty-list outcomes (
valueSource: 'reported'and named vs'dispatched'and withheld).
The provenance is trustworthy: session.reportedOptions has a single writer (reportedCodexThreadOptions(opened), drawn from the app-server's thread/start/thread/resume reply), while session.options holds restored picks and unechoed writes, so the confirmed split lands exactly where the display rule needs it. confirmed remains an existing optional wire field, so older hosts read what they read today.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Withholding unlisted ids took the structured path's effort picker with them. On main `structuredAgentSessionOptionCatalog` pushed a row carrying `options: seed.unknownModelOptions ?? []`, so the snapshot's option loop found it and emitted a settable effort descriptor. Dropping that push left the loop reading `listedModel?.options ?? []`, which is empty for a model no list carries. Probed against origin/main: a structured Codex session on an unlisted model rendered `["model","effort"]` there and `["model"]` here. The options now fall back to `catalog.unknownModelOptions`, which is the same set main reached through the fabricated row and the same fallback `resolveAgentSessionOptionLaunch` already applies when it cannot resolve a model. Reaching it here rather than through a row keeps the two questions separate: the model is still absent from `modelChoices`, so it is adjustable without being offered. Unnameable is not unadjustable. This also gives the PTY path an effort row it did not have on main, where `withTrackedNativeChatModel` fabricated its row with `options: []`. That is a gain rather than a restoration, and it removes the asymmetry where the same unlisted model was adjustable over the structured transport and inert over the terminal one.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The incremental delta closes the second regression the PR body describes — the structured effort picker that vanished when the fabricated unlisted-model row was removed — with one production line and its tests.
buildNativeChatSessionOptionSnapshot— the option loop now sources an unlisted model's options fromcatalog.unknownModelOptions(listedModel?.options ?? catalog.unknownModelOptions ?? []), so an unlisted-but-running model keeps its effort picker from the catalog's launch-safe set — the same fallback the launch resolver already applies — while staying absent frommodelChoices.- Tests — four suites now pin the
effortdescriptor (id: 'effort',settable: true) beside the withheld model, replacing the['model']-only expectations that had documented the follow-up as open.
The ?? chain is safe: CatalogModel.options is a required field, so a listed model with an empty options array (e.g. haiku) does not fall through to unknownModelOptions — the fallback applies only when the model is genuinely unlisted. Verified the 7 touched suites green (116 tests), including the PTY suite under the project vitest config.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Drawing an unlisted model's options from the launch-safe set made the snapshot render a settable effort row that the apply path then refused: `currentApply` resolved options through the model list alone, so for a model no list carries it returned nothing and threw `Unknown session option: effort`. The control appeared, claimed to be settable, and failed when clicked — worse than the absent row it replaced. A builder-level assertion could not see it; only applying through the surface could. Both sides now read `resolveCatalogModelOptions`, so the set that renders a row and the set that services it cannot drift apart. It mirrors the fallback `resolveAgentSessionOptionLaunch` already applies, so the picker offers exactly the options a launch of that id would resolve. Only the terminal surface needed this. Structured sessions set options over the `agentSession.setOption` RPC and never reach `applySetOption`, which is why the structured half of this branch worked without it — reverting this change reddens the terminal test alone. `unknownModelOptions` carries exactly one entry, `effort`, and only for claude, codex and grok; gemini and cursor declare none and so draw no rows for an unlisted model. Both entry points into the resolution — `setOption` and the agent-picker `invokeAction` codex uses — go through `currentApply`, so one fix covers all of it.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The incremental delta fixes the apply path so a rendered row can actually be serviced, and factors the option-resolution rule into one shared helper.
resolveCatalogModelOptions— new shared helper inagent-session-option-catalog.tsthat returns a model's ownoptionswhen listed, otherwise the catalog's launch-safeunknownModelOptions, mirroring the fallbackresolveAgentSessionOptionLaunchalready applies.native-chat-session-option-snapshot.ts— the option loop now reads through the shared helper instead of the inlinelistedModel?.options ?? catalog.unknownModelOptions ?? []; behavior is byte-identical to the prior commit.native-chat-session-option-apply.ts—currentApplyresolves a non-model option throughresolveCatalogModelOptionsinstead of the model list alone, so an unlisted model's effort row (which the snapshot already renders assettable) is actually resolvable rather than throwingUnknown session option: efforton click.native-chat-pty-session-options.test.ts— a new test drivessetOption('effort', 'high')on an unlisted model through the full surface, asserting the/effort highdispatch and thesettable/currentValuestate.
The fix is sound: the snapshot and apply paths now read the same source, so they cannot disagree about which rows exist. resolveCatalogModelOptions's ?? chain preserves the prior guard — a listed model with options: [] does not fall through to unknownModelOptions, so only genuinely unlisted ids inherit the launch-safe set. All five touched suites pass locally (the PTY suite under the renderer config).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The incremental delta (commit c022d28, "Keep unlisted model controls coherent") closes the last render/apply asymmetries the prior reviews left open and tightens the Codex provenance rule. All changes are in production paths already exercised end-to-end by the new tests.
readLiveCodexSessionOptions— tightenedconfirmed:effortis now confirmed only when the model is confirmed and the effort still equals the thread's report, and a restored pick whosemodelmatches the opened thread's ownreportedOptions.modelis treated as confirmed instead of unconditionally unconfirmed.supportedEfforts(...)— new helper that resolves an unlisted Codex model's effort set through the sharedresolveCatalogModelOptionsfallback, so thesettableeffort row the snapshot renders for an unlisted model can actually be applied rather than throwingdoes not support.applyValidatedCodexStructuredSessionOption— routes effort validation/resolution throughsupportedEffortsand clearsreportedOptions.model/reportedOptions.efforton every write, which is what makes the equality-basedconfirmedcomputation safe against reusing a stale report after a write.recordNativeChatSessionOptionCommand— iteratesresolveCatalogModelOptions, so a typed/effortunder an unlisted model is held (dispatched) the same way the picker renders the row.commitStructuredAgentSessionOption— skips thedispatchedwrite when the commit repeats an unchanged value, preserving areported-sourced model's name through an effort write (which previously downgraded the pill to the neutral "Model").- Tests — new Codex cases for the restored-match confirmation, the substituted-default non-confirmation, and the catalog-safe effort on an unlisted model, plus PTY/shared assertions for the dispatched-effort echo and the preserved model evidence.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Final review status: ready from code and automated-validation perspectives at c022d28. Meaningful fixes pushed during review:
The iterative independent review and closing readiness pass are clean: no P0/P1/P2 findings remain. Architecture, functional correctness, SSH/folder-workspace behavior, mixed-version compatibility, cross-platform behavior, and performance were checked. No polling, subprocess fanout, unbounded growth, or lifecycle/resource regression was introduced. Validation:
Visual proof gap: the requested Grok Electron lane was blocked by the Grok account quota before an assistant turn, so no rendered flow ran and no screenshots could be attached. No substitute desktop automation or mock evidence was used. No separate mobile, SSH/Linux, or Windows-host runtime lane was needed because this changes shared native-chat logic rather than platform-specific or mobile-native behavior; Windows packaging CI passed. |
|
Closing in favour of fixing the root cause instead. This PR changed which model name the composer shows. But the underlying problem is that Orca accepts a model id the provider does not list at all — and we now have measurements showing such a session is inert, not merely mislabelled:
So the right fix is to refuse the id up front rather than to render it more carefully afterwards. That work is tracked separately: rejection at One change from this PR must survive it. This branch deletes the One thing the root-cause fix cannot cover. Validation stops a bad id entering; it does not stop a valid id going stale — a retired alias, an account losing entitlement, a CLI downgrade, an unreachable host (where we deliberately refuse nothing), or a model retired inside the authority cache window. Measured: Codex Also worth recording, since it was measured here and is easy to assume otherwise: #19854 stays open and is unaffected: it stops an unlisted id becoming the persisted |
…#19854) * fix(native-chat): never adopt an unlisted model as the launch default `modelIsAdoptableAsLaunchDefault` is the sole gate on whether a model id may become the persisted `-m` launch flag for future native chats. For a catalog that does not set `discoveredModelsAreAuthoritative` — Claude and Codex — `!catalog.discoveredModelsAreAuthoritative` short-circuited the discovered branch to `true` for any id at all. So a raw launch flag (`worker-start --model claude-opus-5`) is seeded verbatim into the session record, and the first option write or model re-pick adopted it as the durable default. Every later native chat with that agent then launched `-m claude-opus-5` — an id neither the host CLI's list nor the catalog seed carries. Both branches now sit behind one precondition: the active model list or the catalog seed must carry the id. Ids that are carried keep their existing behaviour, including the authoritative-retirement and tracked-model rules. * docs(native-chat): state the launch-default precondition by id, not by vector A typed `/model` cannot introduce an unlisted id: matchNativeChatCatalogModelId returns only ids drawn from the list it is handed, so a never-seen id either collapses to a catalog id (claude `/model claude-opus-5` -> `opus`) or matches nothing (codex). It can only re-assert an id already in the record. The origins that do enter verbatim are the launch flag and an agent report -- applyNativeChatReportedSessionOptions writes `values.model` with no catalog matching. Say that instead, so the comment is true of the code as written and does not lean on the reconciled row that #19852 removes. Comment only; no behaviour change. --------- Co-authored-by: Merge Sim <sim@local>

What this changes
The rule in one sentence: the native chat names a model when it is one of the available models, or when the agent itself reported it — and withholds only an unlisted id that no agent has confirmed.
The native chat's model pill echoed back whatever model string a launch was given. Every layer that builds the picker appended a fabricated row for an id no list carried, so
worker-start --model claude-opus-5made that raw flag both a selectable row in the model dropdown and the name on the pill — even though it is only the string the user typed, not evidence of what the agent is running.The rule now has two halves, and they are separate questions:
What may be offered as a choice: only an available model — the catalog's, or one a host probe discovered. An unlisted id is never a pickable row, whatever its provenance.
What may be shown as the name: an available model, or any id whose record source is
reported— i.e. one the agent itself confirmed. Only an unconfirmed unlisted id is withheld, and the pill then renders the neutral "Model" label.That second half matters because the agent is the ground truth. Claude prints a custom model in its own header, and the screen parser passes that raw name through deliberately —
claude-terminal-session-options.tsdropseffortfor a custom model while keeping its name, on the reasoning that a model with no catalog options is still a model that is running. Gating purely on the list would have inverted that: the neutral "Model" for a model Claude is displaying by name. A custom model, or one newer than Orca's catalog, is exactly where showing the real name matters most.Provenance separates the two cases cleanly:
appliedseedNativeChatAppliedSessionOptions— a launch flagdispatchedreportedapplyNativeChatReportedSessionOptions— the agent's own reportSo
worker-start --model claude-opus-5shows the neutral pill, and the real name appears the moment the agent reports one. Never the user's unconfirmed input; always the agent's confirmed truth.Cases that were already correct and are untouched: an alias the host's CLI merely stopped listing is still re-added from the seed by
withTrackedNativeChatModel, keeping its row, its name and its options; and a resolved id the CLI reports (claude-opus-5[1m]) still maps back onto the listed alias it belongs to (opus[1m]) throughcurrentModelId, now pinned by a test. Both structured readers still reportcurrent.modelunchanged — only what they list changed. In the Claude reader,const model = currentModelId(...)is computed before the deleted push, so the reported value is byte-identical.One honest caveat:
reportedcannot distinguish "the agent told us" from "the agent echoed back what we sent it". For a header scrape that distinction does not matter — the CLI renders what it is actually running — and no code here claims the record can tell them apart.The Codex empty-list edge
Dropping the Codex fabrication makes
models: []reachable alongside a truthycurrent.model:readCodexStructuredSessionOptionsthrows only when no model resolves at all, so a restored thread whosemodel/listcomes back empty reaches the snapshot with a model in hand.buildNativeChatSessionOptionSnapshotshort-circuited onmodels.length === 0, which would have blanked the pill entirely.That is genuinely reachable, so this PR includes the minimal guard: the early return now also requires that nothing is tracked (
models.length === 0 && !effectiveModelId). The model list is honestly empty and offers nothing, but the row survives. The model list is not floored on the seed catalog — that would offer models the account may not have, which is the opposite of the point of this PR.The second regression: the structured effort picker
main's fabricated row was pushed by the shared catalog builder, and it carried options:So on
mainthe snapshot's option loop found that row and emitted a settable effort descriptor. Removing the push left the loop readinglistedModel?.options ?? []— empty for a model no list carries — and the structured path lost its effort picker.Options now fall back to
catalog.unknownModelOptions: the same setmainreached through the fabricated row, and the same fallbackresolveAgentSessionOptionLaunchalready applies onmainwhen it cannot resolve a model. Reaching it at the point the snapshot builds options, rather than through a row, keeps the two questions separate — the model is adjustable without ever enteringmodelChoices.Probed on
origin/main(prod files reconstructed byte-identically) and on this head, for an unlisted model:maingpt-unlisted·[model, effort]gpt-unlisted·[model, effort]gpt-unlisted·[model, effort]Model·[model, effort]my-custom-model·[model]my-custom-model·[model, **effort**]my-custom-model·[model]Model·[model, **effort**]The two bolded
Modelcells are the fix, not a loss: those are unconfirmed values the user supplied, which is exactly what this PR stops echoing. Every agent-confirmed name that worked onmainstill works.The PTY effort row is new, not restored.
mainnever had it:withTrackedNativeChatModelfabricated its row withoptions: [], so an unlisted model was inert on the terminal surface while the structured transport could still adjust it. The fallback lives in shared code and cannot sensibly be keyed on transport — that would encode the accident as a rule — so this PR removes the asymmetry rather than preserving it. If exact parity is preferred over the fix, this is the piece to object to.Exposing that row required the apply path to resolve options the same way.
currentApplyresolved them through the model list alone, so for a model no list carries it returned nothing and threwUnknown session option: effort— the control rendered, claimedsettable: true, and failed when clicked. Both sides now read a sharedresolveCatalogModelOptions, so the set that renders a row and the set that services it cannot drift apart.Only the terminal surface needed that. Structured sessions set options over the
agentSession.setOptionRPC (use-structured-agent-session.ts:136) and never reachapplySetOption, which is why the structured half worked without it — and reverting the apply change reddens the terminal test alone, nothing structured.Audited the whole exposure:
unknownModelOptionscarries exactly one entry,effort, and only for claude, codex and grok; gemini and cursor declare none and draw no rows for an unlisted model. Both entry points —setOptionand the agent-pickerinvokeActioncodex uses — go throughcurrentApply, so one fix covers all of it.Files
src/shared/native-chat-session-option-snapshot.tswithTrackedNativeChatModel(seed rows still re-added); name the model only when it is listed or agent-reported; source an unlisted model's options fromunknownModelOptions; guard the empty-list early returnsrc/shared/structured-agent-session-options.tscurrent.modelsrc/main/claude/claude-structured-session-options.tscurrent.modelstill reported unchangedsrc/main/codex/codex-structured-session-options.tscurrent.modelstill reported unchanged; report the thread's own confirmationssrc/shared/agent-session-option-catalog.tsresolveCatalogModelOptions, the single answer to "which options does this model draw"src/renderer/.../native-chat-session-option-apply.tsPlus tests, including a new
claude-structured-session-options.test.ts.Testing
117 tests across the 7 touched test files pass. Broader sweep over native-chat / session-option / Claude / Codex: 5564 passed, with one unrelated real-binary integration test (
claude-tui-resume-real-binary) that fails onpsunder parallel load and passes in isolation. All three typecheck projects exit 0, run sequentially.oxlintandoxfmt --checkclean.Every behavioural change was ablated by hand at the final head — production change reverted, tests confirmed RED, change restored, restore verified by grep:
withTrackedNativeChatModelfabrication=== 'reported'test is load-bearing: the four unconfirmed-unlisted cases go from withheld to namedcurrent.modelgets no rowunknownModelOptionsThe fourth lever is the one that proves the rule is not vacuous: replacing
source === 'reported'with a bare truthiness check reddens every withheld case, so the comparison is doing real work rather than decorating a condition that would hold anyway.Codex had to report its confirmations, or this PR would have regressed it
Withholding unlisted ids initially broke Codex. On
mainthe Codex reader fabricated a row for an unlistedcurrent.model, so the pill named it. Removing that fabrication left the name to provenance — and Codex reported none:readCodexStructuredSessionOptionsemitted noconfirmedids, soresult.current.confirmed ?? []recorded even a model the thread was genuinely running asdispatched.Probed against
origin/mainwith its prod files reconstructed byte-identically, running the full producer chain (reader → catalog → record → snapshot → pill) for a resumed thread ongpt-unlisted:origin/maingpt-unlistedModelgpt-unlistedThat was the exact bug this branch fixes for Claude, recreated for Codex — a user-visible loss, so it is fixed here rather than deferred.
input.currentcannot answer the question alone, because it merges two sources:session.optionsholds a pick restored from a previous session or a write of ours the thread has not echoed, whilesession.reportedOptionshas exactly one writer —reportedCodexThreadOptions(opened), the opened or resumed thread — and is the agent's own state. OnlyreadLiveCodexSessionOptionsknows which one answered, so it now says so and the reader passes it on. A restored pick stays unconfirmed and unnamed; a model the reader substitutes because nothing was current is never confirmed either, since that id is our choice, not a report.confirmedis an existing optional field onAgentSessionOptionsResult, documented so that its absence means "unconfirmed". A host that predates this sends nothing and old clients read exactly what they read today, so this is a host filling in a defined field, not a wire change.Deliberately out of scope
modelIsAdoptableAsLaunchDefault— an unlisted model still becoming the persisted launch default.NativeChatSessionOptionPickers.tsx, and theen.jsonkey it needs.worker-start --modelvalidation is untouched: nothing undersrc/main/runtime/rpc/methods/orchestration/changed, so that flag behaves exactly as onmain.