Repository navigation
fix(native-chat): show the Codex and Claude model picker the moment a chat opens - #22756
Conversation
… chat opens A new structured chat showed no model picker until its session had been created, spawned, initialized and had answered a model listing — and the picker then listed the models a second time. Codex's listing often goes to the network, so the picker took 0.6-2 s to appear. - Keep a host-owned model catalog per agent and account home, persisted on success only and refreshed in the background once it ages out. A new read-only agentSession.modelCatalog RPC answers from it without a live session; sessions reuse it instead of listing again. - Render the picker while the launch is still provisional, showing the saved default. A pick made before the session exists is held and applied once it publishes; only the host's acceptance saves it as the default. - Mark the model and effort set in the user's Codex config as the listing's default (config/read), so the first frame names what the chat will run. - Resolve the account a record-less read would use without running launch preparation, which writes and syncs account state.
…ng launch settles
A pick made while a chat launches had no fence to go to, so the pane held it and flushed it after publish; every other sender (the outbox, the launch prompt) then needed its own gate to wait for that flush. The launch now keeps those picks in its own state, applies them against the create receipt's fence before it counts as published, and every sender follows publish by construction. The pane flush, the outbox gate and the module-wide held-pick registry are gone. The launch also snapshots the saved selection its create seeds when the intent is built, so a pick in another chat no longer relabels one still launching, and a pick the host refuses is reported the way a refused mid-session pick is.
…replace The catalog's default is the account's, read without a working directory, but a chat runs in its worktree, where a project config (Codex's .codex/config.toml between the project root and the worktree, or a Claude .claude settings file that sets a model) picks the model instead. The picker named the account default there while the chat ran the project's model. A new chat's catalog read now names its worktree. The host checks that workspace for such config (existence only for Codex, the model key for Claude) and, when any is present or the workspace is not a local directory, serves the listing with no default, so the picker names nothing until the chat reports its model.
…instead of being refused
…e global fetch name
…ved session options
Review status: ready for review at 1bfece2Seven review loops ran on this PR. The last one came back clean. Live Electron QA passed on the final head. CI is running. What the review changed (all pushed)
Live QA (hidden dev builds, macOS,
|
| Scenario | Result |
|---|---|
| New Codex chat | PASS. The picker appears with the composer and names the configured model and effort (0.23 s vs 0.55 s on main). The live report matches. |
| Model and effort picked during launch, then a real turn | PASS. Codex's own rollout shows the picked model and effort ran. |
| New Claude chat, no saved choice | PASS. No name for about 1 s while Claude starts, then "Opus (1M context)" (from the user's settings), confirmed by the turn. Never shows "Sonnet". |
| New Claude chat, saved choice | PASS. The saved model shows from the first frame. |
| Pick during Claude startup | PASS. Applied, with no error. |
| Reopened chat after restart | PASS. It never showed a wrong model. The saved default was deliberately set to a different model to catch this. |
Repo with its own .codex/config.toml |
PASS. No name before the report, then the project's model. |
| Leftover processes / console errors | PASS. None. |
New Claude chat, whose settings choose Opus:
| main | this branch |
|---|---|
![]() |
![]() |
Codex model and effort picked during launch, after the turn:
Reopened chat: no name while it reconnects, then its real model.
| reconnecting | reconnected |
|---|---|
![]() |
![]() |
Repo with its own Codex config:
| before the report | after |
|---|---|
![]() |
![]() |
Gates
pnpm tc.- The affected suites, by explicit file list: 2185 tests in the final loop.
- Every audit and ratchet test under src/main, src/shared, src/cli and src/relay.
- Changed-lines quality gate, full oxlint on touched files, and React Doctor.
- Every fix has a test shown to fail when the fix is removed.
- The PR adds no lockfile change and no docs.
Known and accepted
- In a repo whose
.codex/config.tomlonly sets hooks or MCP, a new Codex chat still names nothing before the first report, because the check looks only for the file. - A mobile or paired-web client can send in the short gap between the host starting the chat and the desktop applying a pick made during launch. The pick would need to travel with the create request to close this; that's a possible follow-up.
- Mobile doesn't re-read options when Claude finishes starting. This is the same as
main. - Not run on Windows or Linux. Structured sessions only run on the local machine by design, and paths and child processes go through the shared helpers.
|
CI update: all 21 checks pass on 1bfece2 (10 skipped by path filter). The PR is ready for review. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe change adds host-side Claude and Codex model-catalog discovery, caching, persistence, and RPC access. Renderer model pickers can use host catalogs and apply launch-seeded defaults. Structured-session launches now hold option picks made before publication and apply them against the launch receipt. Provider option reads and writes also account for reported Claude settings and startup state. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to The faster model picker introduces several issues that should be fixed before merging.
Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The change affects account-specific choices at chat startup and adds a way to read them from another client. It is not yet clear that every read is restricted to the intended account. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 36.54% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 104 functions across 50 files. (45 skipped: 45 over the file limit.)
✨ 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.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7c23524b-db91-475a-81c0-2794981ce892
⛔ Files ignored due to path filters (1)
src/shared/rpc-contract/rpc-params-catalog.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing (95)
src/main/claude/claude-model-catalog-probe.test.tssrc/main/claude/claude-model-catalog-probe.tssrc/main/claude/claude-structured-applied-options.test.tssrc/main/claude/claude-structured-launch-resolution.tssrc/main/claude/claude-structured-options.tssrc/main/claude/claude-structured-session-acquisition.tssrc/main/claude/claude-structured-session-adapter.tssrc/main/claude/claude-structured-session-options.tssrc/main/claude/claude-structured-session-startup-gate.tssrc/main/claude/claude-structured-session-startup.test.tssrc/main/claude/claude-structured-session-startup.tssrc/main/claude/claude-structured-session-state.tssrc/main/claude/claude-structured-session-test-support.tssrc/main/codex-accounts/runtime-home-read-only-launch-resolution.test.tssrc/main/codex-accounts/runtime-home-service-home-routing.tssrc/main/codex-accounts/runtime-home-service-launch.tssrc/main/codex-cli/codex-read-only-app-server-args.tssrc/main/codex/codex-app-server-session.tssrc/main/codex/codex-configured-launch-defaults.test.tssrc/main/codex/codex-configured-launch-defaults.tssrc/main/codex/codex-model-catalog-probe.test.tssrc/main/codex/codex-model-catalog-probe.tssrc/main/codex/codex-structured-acquire-catalog.tssrc/main/codex/codex-structured-launch-resolution.tssrc/main/codex/codex-structured-model-catalog.tssrc/main/codex/codex-structured-session-acquire.tssrc/main/codex/codex-structured-session-options-catalog.test.tssrc/main/codex/codex-structured-session-options.tssrc/main/codex/codex-structured-session-state.tssrc/main/native-chat/agent-model-catalog/agent-model-catalog-fingerprint.tssrc/main/native-chat/agent-model-catalog/agent-model-catalog-persistence.tssrc/main/native-chat/agent-model-catalog/agent-model-catalog-service.test.tssrc/main/native-chat/agent-model-catalog/agent-model-catalog-service.tssrc/main/native-chat/agent-model-catalog/agent-model-catalog-store.test.tssrc/main/native-chat/agent-model-catalog/agent-model-catalog-store.tssrc/main/native-chat/agent-model-catalog/agent-project-model-override.test.tssrc/main/native-chat/agent-model-catalog/agent-project-model-override.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adapter-router.tssrc/main/native-chat/agent-session-wire/structured-agent-session-adapter.tssrc/main/native-chat/agent-session-wire/structured-agent-session-claude-options-round-trip.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host-types.tssrc/main/rate-limits/codex-fetcher.test.tssrc/main/rate-limits/codex-fetcher.tssrc/main/runtime/mobile-rpc-allowlist.test.tssrc/main/runtime/orca-runtime-get-worktree-ps.tssrc/main/runtime/orca-runtime-preserved-branch-cleanup.tssrc/main/runtime/orca-runtime-resolve-recovered-structured-tui-transcript.tssrc/main/runtime/orca-runtime-state-fields.tssrc/main/runtime/orca-runtime-structured-agent-session-create-intent.test.tssrc/main/runtime/rpc/methods/structured-agent-session-gate-classification.test-fixture.tssrc/main/runtime/rpc/methods/structured-agent-session-options-read.test.tssrc/main/runtime/rpc/methods/structured-agent-session-options-read.tssrc/main/runtime/rpc/methods/structured-agent-session-schemas.tssrc/main/runtime/rpc/methods/structured-agent-session.test.tssrc/main/runtime/rpc/methods/structured-agent-session.tssrc/main/runtime/runtime-rpc/runtime-rpc-mobile-method-allowlist.tssrc/main/runtime/structured-agent-account-home.tssrc/main/runtime/structured-agent-model-catalog-wiring.tssrc/main/runtime/structured-agent-session-runtime.test.tssrc/main/runtime/structured-agent-session-runtime.tssrc/main/runtime/structured-claude-runtime-adapter.tssrc/main/startup/main-process-runtime-service.tssrc/renderer/src/components/native-chat/NativeChatStructuredSession.launch-lifecycle.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test-harness.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.tssrc/renderer/src/components/native-chat/use-host-model-catalog-upgrade.tssrc/renderer/src/components/native-chat/use-native-chat-provisional-launch.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-provisional-launch.tssrc/renderer/src/components/native-chat/use-native-chat-session-options.tssrc/renderer/src/components/native-chat/use-structured-agent-session-mutate.tssrc/renderer/src/components/native-chat/use-structured-agent-session-option-state.tssrc/renderer/src/components/native-chat/use-structured-agent-session-options.test.tsxsrc/renderer/src/components/native-chat/use-structured-agent-session-options.tssrc/renderer/src/components/native-chat/use-structured-agent-session-provisional.test.tsxsrc/renderer/src/components/native-chat/use-structured-agent-session.tssrc/renderer/src/lib/launch-structured-agent-session.tssrc/renderer/src/lib/structured-agent-session-launch-cancellation.test.tssrc/renderer/src/lib/structured-agent-session-launch-options.test.tssrc/renderer/src/lib/structured-agent-session-launch-options.tssrc/renderer/src/lib/structured-agent-session-launch-registry.tssrc/renderer/src/lib/structured-agent-session-launch-reload.tssrc/renderer/src/lib/structured-agent-session-launch-resume-identity.test.tssrc/renderer/src/lib/structured-agent-session-launch.tssrc/shared/agent-session-option-catalog-types.tssrc/shared/agent-session-wire.tssrc/shared/native-chat-session-option-snapshot.tssrc/shared/rpc-contract/structured-agent-session-params.tssrc/shared/structured-agent-session-model-catalog-application.test.tssrc/shared/structured-agent-session-options.test.tssrc/shared/structured-agent-session-options.tstests/e2e/cross-version-wire/structured-agent-session-host-fixture.tstests/e2e/cross-version-wire/structured-agent-session-surface-manifest.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| catalog: unknown[] | ||
| ): StructuredAgentSessionStartedOptions['reportedOptions'] { | ||
| const { current } = claudeStructuredSessionOptionsFrom(session, catalog) | ||
| if (session.options.has('effort') || session.reportedOptions.effort !== undefined) { |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Do not persist an effort that only came from settings.
When get_settings supplies an effort, applyClaudeStartupFacts copies it into session.reportedOptions.effort. This condition then returns current even if nobody selected an effort for the session. Startup persists that settings-derived effort as a session option, so a reopened chat can retain it after the user changes Claude settings. Distinguish an explicit or provider-reported session effort from the settings-derived value. Keep the latter in appliedOptions for display only.
| const run = deps.runSession ?? runCodexAppServerSession | ||
| const listing = await run( | ||
| { | ||
| command: spawnCmd, | ||
| args: spawnArgs, | ||
| cliPath: command, | ||
| env: { ...definedEnv(environment), CODEX_HOME: accountHomePath }, | ||
| timeoutMs: CODEX_MODEL_CATALOG_PROBE_TIMEOUT_MS | ||
| }, | ||
| (rpc) => fetchCodexModelCatalogListing({ connection: rpc }) | ||
| ) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
rg -nP -C4 '\brunCodexProcessWithHomeLock\s*\(' --type=ts
rg -nP -C4 '\bresolveCodexHomeProcessLockKeyForSpawnEnv\b' --type=ts
rg -nP -C3 'readCodexRateLimitsViaRpc|HomeLock' src/main/rate-limitsRepository: stablyai/orca
Length of output: 13279
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- probe ---'
cat -n src/main/codex/codex-model-catalog-probe.ts
printf '%s\n' '--- lock implementation ---'
cat -n src/main/codex-cli/codex-home-process-lock.ts
printf '%s\n' '--- app-server session definition and callers ---'
rg -n -C6 'runCodexAppServerSession|discoverModelsLocal|runCodexProcessWithHomeLock' src/main --type=ts
printf '%s\n' '--- rate-limit fetcher and RPC probe ---'
sed -n '1,190p' src/main/rate-limits/codex-fetcher.ts
sed -n '1,180p' src/main/rate-limits/codex-rpc-rate-limit-probe.ts
printf '%s\n' '--- OAuth conflict references ---'
rg -n -i -C5 '5370|refresh token|oauth|auth\.json|process lock|home lock' src/main --type=tsRepository: stablyai/orca
Length of output: 45650
🏁 Script executed:
#!/bin/bash
set -e
cat -n src/main/codex/codex-model-catalog-probe.ts
cat -n src/main/codex-cli/codex-home-process-lock.ts
rg -n -C8 'runCodexAppServerSession|discoverModelsLocal|runCodexProcessWithHomeLock' src/main --type=ts
sed -n '1,190p' src/main/rate-limits/codex-fetcher.ts
sed -n '1,180p' src/main/rate-limits/codex-rpc-rate-limit-probe.ts
rg -n -i -C5 '5370|refresh token|oauth|auth\.json|process lock|home lock' src/main --type=tsRepository: stablyai/orca
Length of output: 45660
Serialize the model-catalog probe per Codex home.
The probe starts an Orca-managed Codex process with CODEX_HOME=accountHomePath, but it calls runCodexAppServerSession without the home lock. The lock exists because concurrent Orca-spawned processes can consume the same rotating OAuth refresh token twice and invalidate the stored credential.
Suggested fix
import { runCodexAppServerSession } from './codex-app-server-session'
+import {
+ resolveCodexHomeProcessLockKeyForSpawnEnv,
+ withCodexHomeProcessLock
+} from '../codex-cli/codex-home-process-lock'
...
- const listing = await run(
- {
+ const invocation = {
command: spawnCmd,
args: spawnArgs,
cliPath: command,
env: { ...definedEnv(environment), CODEX_HOME: accountHomePath },
timeoutMs: CODEX_MODEL_CATALOG_PROBE_TIMEOUT_MS
- },
- (rpc) => fetchCodexModelCatalogListing({ connection: rpc })
+ }
+ const listing = await withCodexHomeProcessLock(
+ resolveCodexHomeProcessLockKeyForSpawnEnv(invocation.env),
+ () => run(invocation, (rpc) => fetchCodexModelCatalogListing({ connection: rpc }))
)| held: id === 'model' ? { model: encoded } : { ...held, [id]: encoded } | ||
| } | ||
| notifyStructuredLaunchListeners() | ||
| return new Promise((resolve) => replies.set(id, resolve)) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Settle held picks when the launch is cancelled.
If a user closes the tab while creation is pending, cancelStructuredAgentLaunch cancels the launch before it receives a receipt. The application loop never runs, so the promise returned at Line 74 never settles. Resolve the outstanding replies when the launch is cancelled.
| seed | ||
| } = state.selection | ||
| // A pick made while this one was in flight superseded it and stays held for the next pass. | ||
| const settled = current === encoded |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Match an option reply to the pick that started its write.
If a user picks the same encoded value again while its first write is in flight, the new pick replaces the reply but leaves an identical value in held. Line 119 treats the first write as settlement of the new pick. If that write fails transiently, the new pick receives its refusal and is never sent. Track a pick identity or generation instead of comparing only encoded.
| onVisibilityChanged: undefined, | ||
| callers | ||
| callers, | ||
| selection: { seed: intent.seedOptions, held: {} } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
cat src/renderer/src/lib/structured-agent-session-launch-reload.ts
rg -n 'held|seedOptions|restore' src/renderer/src/lib/structured-agent-session-launch.ts src/renderer/src/lib/structured-agent-session-launch-registry.ts src/renderer/src/lib/launch-structured-agent-session.tsRepository: stablyai/orca
Length of output: 3390
🏁 Script executed:
set -e
printf '%s\n' '--- reload and launch definitions ---'
sed -n '1,360p' src/renderer/src/lib/structured-agent-session-launch.ts
printf '%s\n' '--- registry definitions and persistence ---'
sed -n '1,340p' src/renderer/src/lib/structured-agent-session-launch-registry.ts
printf '%s\n' '--- intent and seed resolution ---'
sed -n '1,230p' src/renderer/src/lib/launch-structured-agent-session.ts
printf '%s\n' '--- focused references ---'
rg -n -C 4 'persistStructured|PersistedStructured|selection\.held|selection|publish|promptDelivery|lifecycle|restorePersistedStructuredLaunchState|settle|reconcil' src/renderer/src/libRepository: stablyai/orca
Length of output: 45666
🏁 Script executed:
set -e
sed -n '1,360p' src/renderer/src/lib/structured-agent-session-launch.ts
sed -n '1,340p' src/renderer/src/lib/structured-agent-session-launch-registry.ts
sed -n '1,230p' src/renderer/src/lib/launch-structured-agent-session.ts
rg -n -C 4 'persistStructured|PersistedStructured|selection\.held|selection|publish|promptDelivery|lifecycle|restorePersistedStructuredLaunchState|settle|reconcil' src/renderer/src/libRepository: stablyai/orca
Length of output: 45664
🏁 Script executed:
rg -n -C 8 'type Persisted|interface Persisted|persistStructuredLaunchState|getPersistedStructuredAgentLaunchRecord|restorePersistedStructuredLaunchState|selection|publish|promptDelivery' src/renderer/src/lib/structured-agent-session-launch-registry.ts src/renderer/src/lib/structured-agent-session-launch.ts src/renderer/src/lib/structured-agent-session-launch-reload.ts src/renderer/src/lib/launch-structured-agent-session.tsRepository: stablyai/orca
Length of output: 43880
🏁 Script executed:
set -e
printf '%s\n' '--- recovery ---'
sed -n '1,360p' src/renderer/src/lib/structured-agent-session-launch-recovery.ts
printf '%s\n' '--- callers and prompt delivery ---'
sed -n '1,380p' src/renderer/src/lib/structured-agent-session-launch-callers.ts
sed -n '1,360p' src/renderer/src/lib/structured-agent-session-launch-prompt.ts
printf '%s\n' '--- restore and recovery call sites ---'
rg -n -C 6 'restorePersistedStructuredLaunchState|retryStructuredAgentSessionLaunch|launchAndReconcile|reconcileUnknownLaunch|markStructuredAgentSessionLaunchPublished|promptDeliveryResult|structuredLaunchStates' src/renderer/srcRepository: stablyai/orca
Length of output: 42261
🏁 Script executed:
set -e
printf '%s\n' '--- persisted record type ---'
rg -n -C 8 'StructuredAgentLaunchPersistedRecord|writeStructuredAgentLaunchRecord|readStructuredAgentLaunchRecord' src/renderer/src/lib/structured-agent-session-launch-persistence.ts
printf '%s\n' '--- outbox consumers ---'
rg -n -C 8 'structured-agent-session-outbox|readStructuredAgentSession|dispatchStructured|agentSession.send|mutateStructuredAgentSessionLaunchPrompt' src/renderer/src/components src/renderer/src/lib src/renderer/src/runtime
printf '%s\n' '--- publication marker ---'
rg -n -C 12 'markStructuredAgentSessionLaunchPublished' src/renderer/srcRepository: stablyai/orca
Length of output: 41863
🏁 Script executed:
set -e
sed -n '1,280p' src/renderer/src/components/native-chat/structured-agent-session-outbox-dispatch.ts
sed -n '1,190p' src/renderer/src/components/native-chat/structured-agent-session-outbox-storage.ts
rg -n -C 8 'useStructuredAgentSession|outbox-dispatch|drainStructured|dispatchStructuredAgent|readStructuredAgentSessionLaunchOutbox|fence' src/renderer/src/components/native-chat src/renderer/srcRepository: stablyai/orca
Length of output: 45668
🏁 Script executed:
set -e
rg -l 'dispatchStructuredAgentSessionOutboxEntry|readMountedStructuredAgentSessionOutbox' src/renderer/src
for f in $(rg -l 'dispatchStructuredAgentSessionOutboxEntry|readMountedStructuredAgentSessionOutbox' src/renderer/src | grep -v 'test'); do
echo "--- $f ---"
rg -n -C 12 'dispatchStructuredAgentSessionOutboxEntry|readMountedStructuredAgentSessionOutbox|useStructuredAgentSessionOutbox|fence|outbox' "$f"
doneRepository: stablyai/orca
Length of output: 21032
Preserve held selections before dispatching the launch prompt.
The launch record does not persist held selections. A reload therefore restores no model pick.
The launch can publish the host session before applyStructuredLaunchHeldOptions completes. The prompt remains in the persisted outbox. After reload, useStructuredAgentSessionOutbox reads that entry and can call agentSession.send as soon as a session fence is available. It does not wait for the held selections to be restored or applied.
Persist and restore held selections, or block launch outbox dispatch until selection reconciliation completes. Otherwise, the first prompt can run with the original model instead of the model selected before reload.
There was a problem hiding this comment.
Important
The new Codex model-catalog probe spawns a Codex app-server under the account home without the per-home process lock every other Orca Codex spawn already takes, so it can race a token rotation and permanently invalidate the stored OAuth credential. One inline comment with the suggested fix; everything else reviewed cleanly.
Reviewed changes
- Host model catalog. New
agent-model-catalog/store + service + file persistence: per(agent, account-home, wslDistro)fingerprint, 10 min freshness, 30 s failure hold, success-only, coalesced save flushed at quit. - Session-less probes.
createCodexModelCatalogProbe(short-lived read-only app-server, plugins disabled) andcreateClaudeModelCatalogProbe(one-shot CLI listing), both built on the launch invocation resolvers so a probe lists under the same binary/env as a real session. agentSession.modelCatalog. Additive read RPC answered from the host store without a session queue, wired through the capability gate, cross-version manifest/fixtures, and the mobile allowlist.- Configured defaults. Codex
config/readre-points the listing default at the user's configured model/effort, and a project.codex/config.tomlwithholds the default; Claude namesget_settings.applied.modelbefore the first turn with applied effort kept display-only. - Launch-owned early picks.
structured-agent-session-launch-options.tsholds pre-publish picks andpublishWithHeldOptionsapplies them against the create receipt fence before any send;markStructuredAgentSessionLaunchPublishednow defers to that settlement whilepending. - Renderer. Seed catalog from the first frame, host-catalog upgrade while starting, latched launch view, picker locked between publish and attach, Claude re-read once it starts; live listings write through to the store pinned to the spawn account.
ℹ️ Picker open can now spawn a provider CLI and write a new state file
Part of the latency win is operational: a cold picker read starts a short-lived Codex app-server (or a Claude CLI listing) from the main process, and the store persists to a new agent-model-catalog.json under the profile state directory. The visible-only guard, the in-flight join, and the 30 s failure TTL keep this bounded, so this is a release-notes/ops note rather than a defect — but the trigger is as ordinary as opening a chat, so it is worth calling out.
Technical details
# New process spawns and on-disk state introduced by a picker render
## Affected sites
- `src/main/native-chat/agent-model-catalog/agent-model-catalog-service.ts` — a record-less `read` kicks a probe when the key is cold/stale.
- `src/main/codex/codex-model-catalog-probe.ts` — spawns a Codex app-server.
- `src/main/claude/claude-model-catalog-probe.ts` — runs a one-shot Claude CLI listing.
- `src/main/native-chat/agent-model-catalog/agent-model-catalog-persistence.ts` — writes `agent-model-catalog.json` under the profile state dir.
## Required outcome
- Release notes mention the new background listing on first picker open and the new state file.
- Confirm the privacy/data-retention posture for a new persisted file (model ids and account-home fingerprints only; no credentials) is acceptable.
## Open questions for the human
- Should the probe be gated behind an explicit setting for users running metered provider billing?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| ...CODEX_SHORT_LIVED_PROBE_APP_SERVER_ARGS | ||
| ]) | ||
| const run = deps.runSession ?? runCodexAppServerSession | ||
| const listing = await run( |
There was a problem hiding this comment.
This probe spawns a Codex app-server with CODEX_HOME set but does not take the per-home process lock. Every other Orca-spawned Codex process serializes on the account home precisely because concurrent spawns can consume one OAuth refresh-token rotation twice and permanently invalidate the stored credential — see codex-fetcher.ts:240, source-control-local-generation.ts:71, and commit-message-model-discovery.ts:175. Because a picker open is what triggers this spawn, it can land alongside a rate-limit refresh or a commit-message run on the same home.
Technical details
# Serialize the model-catalog probe per Codex home
## Affected sites
- `src/main/codex/codex-model-catalog-probe.ts:51-60` — `runCodexAppServerSession` is invoked directly, outside `withCodexHomeProcessLock`.
- `src/main/codex-cli/codex-home-process-lock.ts:5-9` — states the invariant: two Orca spawns refreshing the same home can invalidate the credential.
- `src/main/rate-limits/codex-fetcher.ts:238-240` — the existing pattern for a short-lived probe.
## Required outcome
- The probe's app-server run serializes on the same key the rate-limit and commit-message spawns use, so a model listing cannot race a token rotation on that home.
## Suggested approach (optional)
- Import `resolveCodexHomeProcessLockKeyForSpawnEnv` and `withCodexHomeProcessLock` from `../codex-cli/codex-home-process-lock`.
- Build the invocation object, then `withCodexHomeProcessLock(resolveCodexHomeProcessLockKeyForSpawnEnv(invocation.env), () => run(invocation, (rpc) => fetchCodexModelCatalogListing({ connection: rpc })))`.
- Note the lock only serializes Orca's own background spawns (live session panes do not take it), which matches the existing rate-limit/commit-message behavior.
## Open questions for the human (optional)
- Is holding the home lock for up to the 15 s probe deadline acceptable, or should the probe yield to a waiting user-triggered spawn?| seed | ||
| } = state.selection | ||
| // A pick made while this one was in flight superseded it and stays held for the next pass. | ||
| const settled = current === encoded |
There was a problem hiding this comment.
settled compares only the encoded value, so re-picking the same value while its first write is in flight makes that first write's outcome resolve the newer reply and remove it from held without a second attempt. If the first write fails transiently, the re-pick is silently dropped. Tracking a per-pick identity (or generation) alongside the value would separate the two. Narrow, but cheap to make exact.








ELI5
Before this PR, the only way the app could learn which models a chat can use was to ask the running chat itself. So the model picker stayed empty until the chat had fully started, which often took half a second to two seconds. This PR gives the app its own saved copy of each account's model list, so the picker can appear the moment a chat opens. It also makes sure the name the picker shows is the model the chat will really run, and that a model you pick while the chat is still starting is the one your first message uses.
What Changed
User-visible before and after
The architecture change
Before: the model list had no owner. It only existed as the answer to a question asked of a live chat session (
agentSession.options), and that session only exists after it has spawned, finished its handshake, and listed models from the provider (often over the network). Every reader paid that cost, the answer was thrown away between readers, and the renderer also hid the picker until the session's create call returned.After: three pieces, each with one clear owner.
1. A model catalog the host owns (
src/main/native-chat/agent-model-catalog/)agentSession.modelCatalog. It answers without a live session and without waiting in the session's command queue, which is what lets the picker show while the chat is still starting. A chat's picker only asks while the chat is visible, so hidden tabs restored at startup start nothing.agentSession.optionsnow serves its model list from this store too, so a session lists models at most once at start (zero times when the store is warm) instead of on every read.2. The launch owns picks made before the chat exists (
src/renderer/src/lib/structured-agent-session-launch*.ts)3. The name shown is what will run (host)
Orca sends no model when you haven't chosen one, so your agent's own config decides. The picker therefore shows what the agent reports it will run, never a guess:
config/read) and marks those as the default. If the repo has its own.codex/config.tomlbetween its root and the chat folder (which could change the model), or the configured model isn't in the list, the picker names nothing until the chat reports.get_settings→applied), which already appliesANTHROPIC_MODELand your Claude settings. Claude never uses the list's "default" row as a name.Unchanged: panes on SSH, WSL, or a paired remote runtime keep their own per-host listing, since a local store can't speak for another machine. Terminal-based (PTY) chat panes on this machine read the new store instead of running their own CLI listing.
Why
The root cause was structural: the model list existed only as a side effect of a running session, so the picker could never be faster than session startup plus a provider fetch. Alternatives considered:
Compatibility and known limits
agentSession.modelCatalog(with an optionalworktreefield) is new and additive. A new client on an old host getsmethod_not_found, orforbiddenthrough the mobile allowlist, and falls back to today's behaviour. Old clients keep callingagentSession.options, which still returns models (now possibly up to 10 minutes old, refreshed behind it)..codex/config.tomlexists; it doesn't read it, honour customproject_root_markers, or check folder trust. Each gap errs toward naming nothing, including repos whose config only sets hooks or MCP servers.Linked Issue
None.
Visual Proof
Opening a new Codex chat. The clock counts from the click on New tab → Codex.
Before (main): the picker appears only after the session has started and listed models.
codex-picker-before.webm
After (this PR): the picker appears with the composer, already showing the configured model and effort.
codex-picker-after.webm
Same moment (349 ms after the click), hidden dev builds:
New Claude chat whose settings choose Opus, after start:
Time from clicking New tab → Codex until the picker names the model, 3 runs each:
Testing
config/readkeeps the list;get_settings.applied.modelfollowsANTHROPIC_MODEL> settings > default; the list's default row ignores both). Codex 0.156.1:config/readreturns the configured model and effort..codex/config.toml;pnpm tc, affected suites, every audit and ratchet test, the changed-lines quality gate, oxlint, React Doctor. CI green.AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — typecheck, oxlint, the changed-code gate, audits, and the affected suites pass locally; CI is green