Skip to content

Name a native-chat model only when it is available or agent-reported - #19852

Closed
brennanb2025 wants to merge 7 commits into
mainfrom
brennanb2025/native-chat-model-name-available-only
Closed

brennanb2025 wants to merge 7 commits into
mainfrom
brennanb2025/native-chat-model-name-available-only

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​488 $\color{#cf222e}{\Huge{\mathbf{−}}}$​27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​461
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​133 $\color{#cf222e}{\Huge{\mathbf{−}}}$​57 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​76

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-5 made 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.ts drops effort for 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:

Source Written by Unlisted id is…
applied seedNativeChatAppliedSessionOptions — a launch flag withheld
dispatched a pick sent but not yet confirmed withheld
reported applyNativeChatReportedSessionOptions — the agent's own report named

So worker-start --model claude-opus-5 shows 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]) through currentModelId, now pinned by a test. Both structured readers still report current.model unchanged — 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: reported cannot 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 truthy current.model: readCodexStructuredSessionOptions throws only when no model resolves at all, so a restored thread whose model/list comes back empty reaches the snapshot with a model in hand. buildNativeChatSessionOptionSnapshot short-circuited on models.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:

models.push({ id: result.current.model, label: result.current.model,
              options: seed.unknownModelOptions ?? [] })

So on main the snapshot's option loop found that row and emitted a settable effort descriptor. Removing the push left the loop reading listedModel?.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 set main reached through the fabricated row, and the same fallback resolveAgentSessionOptionLaunch already applies on main when 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 entering modelChoices.

Probed on origin/main (prod files reconstructed byte-identically) and on this head, for an unlisted model:

case main this PR
structured, thread-reported gpt-unlisted · [model, effort] gpt-unlisted · [model, effort]
structured, restored pick gpt-unlisted · [model, effort] Model · [model, effort]
PTY, header scrape my-custom-model · [model] my-custom-model · [model, **effort**]
PTY, launch flag my-custom-model · [model] Model · [model, **effort**]

The two bolded Model cells 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 on main still works.

The PTY effort row is new, not restored. main never had it: withTrackedNativeChatModel fabricated its row with options: [], 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. currentApply resolved them through the model list alone, so for a model no list carries it returned nothing and threw Unknown session option: effort — the control rendered, claimed settable: true, and failed when clicked. Both sides now read a shared resolveCatalogModelOptions, 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.setOption RPC (use-structured-agent-session.ts:136) and never reach applySetOption, 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: unknownModelOptions carries 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 — setOption and the agent-picker invokeAction codex uses — go through currentApply, so one fix covers all of it.

Files

File Change
src/shared/native-chat-session-option-snapshot.ts Stop fabricating a row in withTrackedNativeChatModel (seed rows still re-added); name the model only when it is listed or agent-reported; source an unlisted model's options from unknownModelOptions; guard the empty-list early return
src/shared/structured-agent-session-options.ts Stop fabricating a row for an unlisted current.model
src/main/claude/claude-structured-session-options.ts Stop fabricating; current.model still reported unchanged
src/main/codex/codex-structured-session-options.ts Stop fabricating; current.model still reported unchanged; report the thread's own confirmations
src/shared/agent-session-option-catalog.ts Add resolveCatalogModelOptions, the single answer to "which options does this model draw"
src/renderer/.../native-chat-session-option-apply.ts Resolve options through that same helper, so a rendered row can be applied

Plus 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 on ps under parallel load and passes in isolation. All three typecheck projects exit 0, run sequentially. oxlint and oxfmt --check clean.

Every behavioural change was ablated by hand at the final head — production change reverted, tests confirmed RED, change restored, restore verified by grep:

Lever reverted RED Proves
withTrackedNativeChatModel fabrication 4 an unlisted id gets no seed-fabricated row
Whole display gate (name every effective id) 8 the gate exists at all
Provenance branch removed (name only listed ids) 3 a reported id is named
Provenance predicate dropped (name any tracked id) 8 the === 'reported' test is load-bearing: the four unconfirmed-unlisted cases go from withheld to named
Empty-list early-return guard 2 the row survives an empty provider list
Shared structured catalog fabrication 2 unlisted current.model gets no row
Claude reader fabrication 2 unlisted current model reported, not listed
Codex reader fabrication 1 unlisted current model reported, not listed
Codex thread confirmation dropped 1 the reader must distinguish thread state from a restored pick
Codex confirms blindly (no substitution filter) 1 a substituted default is never passed on as confirmed
Unlisted model loses unknownModelOptions 5 an unlisted model stays adjustable, on both surfaces
Apply path resolves options through the model list alone 1 the rendered row can actually be applied (terminal only)

The 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 main the Codex reader fabricated a row for an unlisted current.model, so the pill named it. Removing 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 with its prod files reconstructed byte-identically, running the full producer chain (reader → catalog → record → snapshot → pill) for a resumed thread on gpt-unlisted:

pill
origin/main gpt-unlisted
this PR before the fix Model
this PR now gpt-unlisted

That 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.current cannot answer the question alone, because 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 exactly one writer — reportedCodexThreadOptions(opened), the opened or resumed thread — and is the agent's own state. Only readLiveCodexSessionOptions knows 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.

confirmed is an existing optional field on AgentSessionOptionsResult, 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.
  • Explanatory text for an empty dropdown in NativeChatSessionOptionPickers.tsx, and the en.json key it needs.

worker-start --model validation is untouched: nothing under src/main/runtime/rpc/methods/orchestration/ changed, so that flag behaves exactly as on main.

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

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 58d72dfe-6ce0-4b2c-be37-a84d80e87836

📥 Commits

Reviewing files that changed from the base of the PR and between 97c1df5 and b6e6b86.

📒 Files selected for processing (3)
  • src/shared/native-chat-session-option-snapshot.test.ts
  • src/shared/native-chat-session-option-snapshot.ts
  • src/shared/structured-agent-session-options.test.ts

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


📝 Walkthrough

Walkthrough

Claude 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 b6e6b

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning 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 Discl… 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…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: native-chat models are named only when available or agent-reported.
Full details: Description check

Explanation

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 💡
  • 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.

@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

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/valueSource now gate on listedModel; the empty-list early return requires !effectiveModelId.
  • structuredAgentSessionOptionCatalog / Claude / Codex readers — stop fabricating an unlisted current.model row, with current.model reporting 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, so nativeChatModelPillLabel's raw-id fallback is only reachable from a hand-built descriptor, never from buildNativeChatSessionOptionSnapshot. 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: unknownModelOptions still serves agent-session-option-launch.ts / worker-launch-preferences.ts, but the picker pass-through this described is gone.

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

brennanb2025 pushed a commit that referenced this pull request Sep 10, 2026
…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.
@brennanb2025 brennanb2025 changed the title Show a native-chat model name only when it is one of the available models Name a native-chat model only when it is available or agent-reported Sep 10, 2026

@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

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 — introduced nameableModelId (listedModel || modelTracked?.source === 'reported'), so currentValue/valueSource now gate on that while choices remain available-models-only. A source: 'reported' id is named but never offered; applied/dispatched unlisted ids render valueSource: 'unknown' with no currentValue (the neutral pill).
  • Tests — corrected the withheld-case fixtures to use the sources the state layer actually writes (applied for a launch flag, dispatched for Codex) and added focused tests for the reported-but-unlisted naming and the dispatched → reported transition, 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).

Pullfrog  | View workflow run | Using 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.

@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

The incremental delta documents what reported proves and pins why Codex stays unnamed — no production behavior changed since the prior review.

  • Clarified reported semantics — buildNativeChatSessionOptionSnapshot's doc comment now states that reported means "read off the agent," not "acknowledged a write," and that the PTY path omits confirmed so every scraped value records as reported.
  • 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 dispatched contract — structured-agent-session-options.test.ts now asserts source: 'dispatched' for a Codex empty-list model, so it reddens when the reader starts emitting confirmed ids 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.

Pullfrog  | View workflow run | Using 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.

@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

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 computes confirmed from which of model/effort fell through to session.reportedOptions (the opened thread's own state) instead of a pending value in session.options.
  • readCodexStructuredSessionOptions — now accepts confirmed and 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.

Pullfrog  | View workflow run | Using 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.

@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

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 from catalog.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 from modelChoices.
  • Tests — four suites now pin the effort descriptor (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.

Pullfrog  | View workflow run | Using 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.

@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

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 in agent-session-option-catalog.ts that returns a model's own options when listed, otherwise the catalog's launch-safe unknownModelOptions, mirroring the fallback resolveAgentSessionOptionLaunch already applies.
  • native-chat-session-option-snapshot.ts — the option loop now reads through the shared helper instead of the inline listedModel?.options ?? catalog.unknownModelOptions ?? []; behavior is byte-identical to the prior commit.
  • native-chat-session-option-apply.ts — currentApply resolves a non-model option through resolveCatalogModelOptions instead of the model list alone, so an unlisted model's effort row (which the snapshot already renders as settable) is actually resolvable rather than throwing Unknown session option: effort on click.
  • native-chat-pty-session-options.test.ts — a new test drives setOption('effort', 'high') on an unlisted model through the full surface, asserting the /effort high dispatch and the settable/currentValue state.

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).

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues 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 — tightened confirmed: effort is now confirmed only when the model is confirmed and the effort still equals the thread's report, and a restored pick whose model matches the opened thread's own reportedOptions.model is treated as confirmed instead of unconditionally unconfirmed.
  • supportedEfforts(...) — new helper that resolves an unlisted Codex model's effort set through the shared resolveCatalogModelOptions fallback, so the settable effort row the snapshot renders for an unlisted model can actually be applied rather than throwing does not support.
  • applyValidatedCodexStructuredSessionOption — routes effort validation/resolution through supportedEfforts and clears reportedOptions.model/reportedOptions.effort on every write, which is what makes the equality-based confirmed computation safe against reusing a stale report after a write.
  • recordNativeChatSessionOptionCommand — iterates resolveCatalogModelOptions, so a typed /effort under an unlisted model is held (dispatched) the same way the picker renders the row.
  • commitStructuredAgentSessionOption — skips the dispatched write when the commit repeats an unchanged value, preserving a reported-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.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final review status: ready from code and automated-validation perspectives at c022d28.

Meaningful fixes pushed during review:

  • Unlisted Codex models now use the same bounded effort fallback across host validation, rendering/apply, and typed-command tracking.
  • Restored/thread-reported model provenance is preserved and matched correctly.
  • Successful option writes invalidate stale report evidence, and effort cannot be falsely confirmed for a different restored model.
  • Full structured responses preserve unchanged provider-reported values.

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:

  • 159 targeted tests across 9 files
  • pnpm tc
  • Changed-code quality: 0 findings
  • Formatting and git diff checks
  • CI green: static analysis, typecheck, macOS and Windows packaging, all 8 test shards, aggregate verify, and Pullfrog

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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

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:

  • Claude: session starts, system/init reports the id verbatim, but every turn returns is_error: true with a synthetic error, modelUsage: {}, zero tokens.
  • Codex: turn/completed fires with status: "failed" and a 400 — "The 'gpt-unlisted' model is not supported when using Codex with a ChatGPT account."

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 worker-start (#19682), a Claude structured pre-flight closing the setClaudeStructuredOption asymmetry (it guards effort against the provider list but not model), and Codex seed/restore validation before turn/start.

One change from this PR must survive it. This branch deletes the models.push({ id: input.current.model, … }) injection in readCodexStructuredSessionOptions. That push makes the id already running always present in model/list, so applyValidatedCodexStructuredSessionOption passes any already-seeded id. Any Codex restore/resume validation written on top of today's code would therefore pass with or without the guard working. That deletion needs to land as part of the Codex validation work, or its tests are inert.

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 thread/resume reports a thread's stored model verbatim with no cross-check against model/list. So a session can legitimately run a model the list does not carry, and the picker will still have to decide what to display. That question is deliberately deferred until enforcement lands and we can see what actually still reaches it.

Also worth recording, since it was measured here and is easy to assume otherwise: list_models membership is not evidence a model can run. Claude synthesizes a { description: "Custom model", supportsEffort: true, supportedEffortLevels: [low…max] } row for an arbitrary startup flag — for a model that 400s on every turn and can honour none of those effort levels. Treat provider listing as "offerable", never "runnable".

#19854 stays open and is unaffected: it stops an unlisted id becoming the persisted -m default for future sessions, which is a durability problem rather than a display one.

brennanb2025 added a commit that referenced this pull request Sep 10, 2026
…#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>
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