Repository navigation
Show a resting Claude chat's effort instead of a blank picker - #23106
Conversation
No client ever called agentSession.requestHandoff or mounted the handoff chrome. Delete the handoff coordinator, the terminal-owner runtime, the proof write path and the unmounted UI. Keep agentSession.handoffStatus, which released desktop clients read for worktree activation, and let records an older build left mid handoff reconcile through the ordinary restart and recovery paths.
Eviction now drains delivered events before quit's resume-offer snapshot. An unbounded wait there sits ahead of the provider stop, so a sink whose journal write stalls kept the child running until the step deadline aborted the eviction. The offer is advisory: bound the drain and stop the child regardless. Co-Authored-By: Claude <[email protected]>
`claudeAuthEnvCarriedForward`, `isPathWithinDirectory` and
`queryWindowsProcessRowsFresh` lost their last caller with the handoff. The
fresh-scan tests now go through `queryWindowsProcessDescendants({ fresh: true })`,
the teardown path that still depends on that contract.
Co-Authored-By: Claude <[email protected]>
Six comments still named the handoff coordinator, a handoff suspend, or a terminal-owned session as live participants in the flows they describe. Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
…ement The removed restart handoff test pinned this branch; nothing else did. Co-Authored-By: Claude <[email protected]>
The handoff removal dropped the per-session queue from `handoffStatus`, so a read landing mid-start reported the reservation (no owner) instead of the settled chat owner, and shipped desktop clients blocked worktree activation on it. The read is queued again, as it was before the removal. Co-Authored-By: Claude <[email protected]>
The gate only refused a write when a PTY had been bound to a chat session, and the only code that ever bound one was the terminal handoff this branch removes. With it gone, every admit/readmit returned "admitted" unconditionally, so the checks on the renderer write path, the runtime controller backstop, terminal.send, agent prompts, preview input and orchestration pointers, the refusal fields on terminal.send and worker-start receipts, the plugin and CLI refusal copy, and the adopted-pane orchestration routing could no longer run. Ordinary writes take the same path in the same order as before. Co-Authored-By: Claude <[email protected]>
…alled appendLegacyTranscriptMessages fed the terminal transcript catch-up and proveClaudeTranscriptBranch backed the terminal owner's exit proof. Both lost their last caller with the handoff. Their tests now go through the live entry points instead: the roster bounds through the legacy import, the pinned-read and growth tests through the ancestry replay the history window uses, and the marker rules through the string proof in their own file rather than the session-file resolver's. Co-Authored-By: Claude <[email protected]>
A send refused because the chat's owner is not settled showed "The session is mid-handoff (<stage>)." in the composer. With the handoff gone, the stages that reach it are a chat that is still starting, or one whose previous agent process has not yet been confirmed stopped. The message now says which of the two it is. The refusal code is unchanged. Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
With the terminal handoff gone, the module named codex-tui-rollout-proof holds only the pinned rollout lookup that structured Codex launches use to resume a thread, so the name described code that no longer exists. Rename the module and its options type. Also drop a mobile allowlist assertion that pinned the removed agentSession.requestHandoff method, which no longer exists to allow.
The handoffStatus reply type still listed the terminal handoff's fields and states (terminal placement, host label, proof retry, queued and waiting phases, the to-terminal direction). No host writes them any more and the only client reader parses the reply as unknown, so they described nothing. The reply on the wire is unchanged.
…t decode Nothing in this build writes a terminal owner (`runtimeKind: 'tui'`) or the handoff's `preparing` / `old-owner-stopped` stages, but the in-memory types still admitted them, so readers across the host kept branches for values no path produces and the compiler could not point at them. The store now validates the on-disk shape, which still accepts those values so an older record is not quarantined, and maps them once while parsing: - `preparing` and `old-owner-stopped` become `recovering` - a `tui` lease becomes `native`; when it records a process it also becomes `conflicted`, the claim every build probes but never stops. A plain native owner would be stopped by restart recovery, here and in older builds. Revisions are taken over the normalized state on both sides of every compare, and the mapped record reaches disk with the store's first transaction, the same way the tab-id backfill does. The in-memory types narrow to what this build writes, and the branches that existed only for the removed values go. Structured-worker identity keeps its verdict for a former terminal owner by refusing a conflicted claim rather than a non-native kind.
…ation A reservation only ever names a native owner now, so the request no longer carries a kind and the reserved lease records `native` directly. The attach params keep `runtimeKind`: agentSession.ensure and create accept it, and the operation fingerprint stored in the ledger covers it.
…at changes nothing else Hiding a tab also committed the visibility index, so the no-op transaction wrote the file even when its open-time revision was wrong. Committing the index first leaves the pending rewrite as the only reason to write.
…ration A write carried the fence of the last frame the pane read, and the host refused it unless that fence was still current. An idle release and the restart after it each move the fence, and the release publishes nothing, so a send after a release was refused "Expected runtime fence 1; the session is at 3", and a Stop queued behind a cold start was refused as stale. Every write already names what it acts on: a send its conversation, a cancel its turn, a prompt answer its item revision, a rewind its epoch; an option is last-writer-wins. So admission stops comparing the client's fence, and the rebase that papered over one restart (admitAtResumedFence, resumedFromFence) goes with it. The writer-lease check stays, and so does the attach's compare-and-swap. Frames now stamp the fence read when each frame is sent instead of a copy each subscriber kept, which went stale on the same release.
A journal write and its delivery to open readers were two calls, and some writers made only the first. A failed start whose lease could not be handed back, a provider revision with no frame behind it, and eviction's settlement were all journaled without reaching an open chat. A journal handle now reports every durable change, and the host's session map binds that report to the session's readers when the handle is set. Writers no longer publish what they append; the per-writer publish calls are deleted.
…dle enters only through the map
…ackfill cannot supply its rewrite The seeded record had no surface tab id, so the next open backfilled one and that rewrite alone made the no-op transaction write. The test passed with the legacy-lease rewrite signal removed.
The handoff removal deleted it alongside the terminal-owner tests, but it covers the surfaced-PTY block that still guards resume, including an agent whose ownership is unknown.
Each commit now delivers itself, so the publish a provider frame still sends afterwards found every reader caught up but still read rows and rebuilt the timeline for each one. A caught-up reader now skips the read.
# Conflicts: # src/main/native-chat/agent-session-wire/structured-agent-session-subscribers.ts
A send to a chat with no running agent restarted the agent inside the send
call, before the message was recorded, so the client waited for the whole
start and a failed restart refused the message. Claude held prompts sent
during startup, and those could settle as "unconfirmed".
A send is now accepted inside the session's serialized queue: one ledger row
and one submission row marked handoverRecorded, published, answered pending.
A per-session delivery loop exists while a message is queued. It starts the
agent through the same serialized attach a hold uses, waits outside the queue
for a Claude child to prove its start, and hands the oldest queued message
over as its own serialized step, writing dispatch{pending} before the adapter
call. A start it needed and did not get writes one error-tone row and rejects
every queued message with the same words; a start Stop cancelled writes none.
Settlement follows from the rows. A queued message is provably unwritten, so a
close, an eviction or an exit rejects it. A handed-over message stays in doubt.
A queued row at or below the sequence a handle found when it opened was left
by an earlier process and is rejected at open, with no latch. Stop withdraws
queued messages with no writer lease and no fence. An attach failure keeps the
conversation open, and the attach adopts its journal. Owed work counts the
loop and queued rows.
A compaction or rewind found prepared when a conversation opens was started
under a child this process no longer has, so the open settles it rather than
leaving it to refuse every send until a view attaches. The open cursor is
scoped to its epoch, because sequences restart when an epoch is replaced.
Deleted: restart-before-admission, recordFailedRestart, the fence rebase,
Claude's startup gate, the attach's forget on failure and its own crash
boundary. Clients without agent-session.accepted-send.v1 get their reply held
until the handover; the desktop and paired desktop lists advertise it.
A child that proved its start and then exited before its message was handed over left the message queued: the exit settlement returned early when nothing else was in flight. Delivery then started another child for it, and a child that died the same way started another, without end and without a row. A retried settlement for an earlier generation, run by the attach that delivery started, did the opposite: with that generation's turn unfinished it rejected the message queued for the child being attached. The settlement now takes the rejection for queued messages from its caller. The unexpected exit and the eviction pass one, and it applies even with no other work in flight; the retry for an earlier generation passes none.
Brings in the stale-turn settlement at the conversation's one open (the restore's separate step is gone), the failed-start predicate the delivery loop now reads, and their tests. Resolutions: the holds and their race test stay deleted, and the hold's last-start-failed gate, the exit recovery ticket and the host's hold/release stay out, because no view starts an agent here. The view-start test views by subscribing instead of holding; the reveal harness stays deleted; the restore and child-record tests keep this branch's API with PR 1's assertions; the stale-turn test reads the journal through the async snapshot.
…) into the conversation-outlives-agent branch The view-start test's two binding moments are kept, with each view a subscription instead of a hold: no view starts an agent here.
…tlement left running An exit whose settlement write failed leaves its turn running in the open journal. PR 1's open now settles it, and this pins the two reads that reach it here: a reader reopening a chat the idle sweep closed, and a read that opens the chat before the restart restore reaches it.
… subscriptions on a loaded runner A subscription reads the conversation before it returns, so under load the two views took longer than the create child's 300 ms start, which then exited before the test checked that it had not. The child now takes a second to fail.
…n acquisition's The journal open skipped the settlement whenever the lease read reserved or live, to leave an acquisition's own open to the acquisition. But a lease a crashed process left in recovery also reads live, until the next acquire resolves it. A send that opened such a chat, from a phone or the CLI after a crash on a host that could not prove the old owner gone, skipped the settlement; when its start then failed, the dead turn stayed running for every reader. The acquisition now says it is the opener, and every other open settles, whatever the lease still claims.
The "view binds while the create is still starting" case gave the create a 300 ms head start and asserted the views bound before it died. On a loaded runner the holds took longer, the create's exit landed first, and the case failed its own precondition. The create's initialize now waits on a gate the test releases once the views are bound.
…ves-agent branch Brings in #22821's crash-mid-turn settlement (the attach marks its open as an acquisition and every other open settles, whatever the lease still claims), main's plain-words refusal copy and the rest of main. Resolutions: the stale-turn test keeps PR 1's probe cases and reads the journal through the async snapshot; the view-start test keeps PR 1's start gate, with each view a subscription instead of a hold. Locale catalogs auto-merged with every key from both sides.
…tup reconcile settles its turn On desktop the chat on screen at relaunch reads before startup reconciles the leases, while the dead process's lease still reads live. The open settles the turn it left running anyway, and the restore that follows finds it settled.
…utlives-agent' into brennanb2025/chat-effort-default-at-rest
After the merge with main, every chat write in the composer path reports its
failure as a typed outcome worded by the refusal-notice table, so the send's
catch sees only a local throw. The {code, message} formatter this branch added
for it has no payload left to format, and its claim to be the one way a chat
words a failure is no longer true. The composer send is main's again.
…t was closed The reopen test checked only that the message reads as not sent; it now also checks the Retry row carries the host's reason.
PR 1 dropped the shared error formatter because its composer caller no longer
needs it. This branch's read transport still receives a stream's raw
{ code, message } failure, so the formatter moves into the read transport, its
only caller, and the pane keeps showing the host's words instead of
[object Object].
A worker's session no longer takes a dispatch hold, and no release clock rests a chat by visibility; the agent-launch comments, the abandon test, the teardown test and the refusal census still said so.
… not a hold The activation-gate test from #22808 put its chat at rest by holding and releasing it, and passed the release-clock grace. This branch deleted both, so the case threw before it reached its assertions. It now moves the host's clock past the idle window and lets the sweep stop the agent and close the conversation, then asserts the same owner answer and activation gate.
…d fails The read transport always hands the pane the host's words, so the error state's "Orca keeps trying to load it" line, which showed only when there were none, was never seen: the pane showed the host's text twice, as its subtitle and on the status line under it. The structured pane now always says its read keeps retrying, and the host's text stays on the status line. The terminal-backed chat is unchanged.
…utlives-agent' into brennanb2025/chat-effort-default-at-rest
…s its live child shows it The resting options read fell back to the catalog's default effort for every provider. A live Codex child answers only the effort its thread reported, which is none when Codex's config names none, so a resting Codex chat showed Medium and then went blank once it started.
…tart persisted The at-rest test built the record by hand, so nothing proved the model id a start persists is the listed row the catalog learns the default under.
Review status: ready for review (head 58ce649)Verdict: ready. Two review loops, readiness checks at the start and end, and live Electron QA on a separate Mac are all done. CI is green on this head. Review loops
Design check
Readiness
Live QASetup: a dev build on a separate Mac, with the experimental structured chat on, a real Claude CLI whose settings name no effort, and the idle stop shortened to 60 s for the test. Screenshots are in the PR body.
Not caused by this PR (possible follow-ups for #22835 or the new-chat defaults)
Residual risks (all display-only, never sent or saved as a pick)
|
There was a problem hiding this comment.
ℹ️ One scope question inline — otherwise this reads clean.
Reviewed changes
One sentence: a structured Claude chat with no running agent now answers its effort from a default learned per model, instead of showing a blank picker.
- Resting read falls back to the learned default —
readStructuredAgentSessionOptionsAtRestanswerssaved.effort ?? catalog.defaultEffortfor Claude chats only, so a stopped chat shows the effort its next start would run; Codex stays pick-only. - Live Claude sessions teach the catalog —
catalogClaudeModelsrecords the child'sapplied.effortasdefaultEfforton every listed row resolving to the applied model, gated so a user's pick is never learned. - Catalog store keeps a known default —
withKnownDefaultEffortspreserves a model's priordefaultEffortthrough a listing that names none (validated against the model's current efforts), persists it, and replaces it when a listing names a different one. - Docs/probe + tests — probe comment clarified,
wireClaudeModelssplit into a per-row helper; new adapter-driven at-rest test and store carry-over test added.
Default (non-structured) chat view is confirmed unchanged: native-chat-session-option-discovery.ts builds Claude effort options from effortLevelIds and ignores defaultEffort. Changed and related suites pass locally (allocated catalog/claude/codex/shared tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| /** A listing that names no default effort for a model keeps the one a live child reported for it, | ||
| * while that model still offers it: Claude's listing never names one, only a running child does. */ | ||
| function withKnownDefaultEfforts( | ||
| models: readonly AgentSessionModelOption[], | ||
| previous: AgentModelCatalogEntry | undefined | ||
| ): AgentSessionModelOption[] { | ||
| return models.map((model) => { | ||
| const known = previous?.models.find((entry) => entry.id === model.id)?.defaultEffort | ||
| return model.defaultEffort === undefined && | ||
| known !== undefined && | ||
| model.efforts.some((choice) => choice.value === known) | ||
| ? { ...model, defaultEffort: known } | ||
| : { ...model } | ||
| }) | ||
| } |
There was a problem hiding this comment.
withKnownDefaultEfforts runs for both agents, so a Codex listing or probe that omits defaultReasoningEffort now keeps the previously learned default rather than clearing it. That value is then applied on a mid-session Codex model switch (codex-structured-session-options.ts:279-284, before the efforts[0] fallback) and can show as the picker's CLI default — a Codex behavior change the PR body's "Codex is unchanged" framing doesn't cover. Is the carry-over meant to be generic, or should it be scoped to agent === 'claude' (the store already receives the agent)?
Technical details
# Codex catalog defaults are carried over too
## Affected sites
- `src/main/native-chat/agent-model-catalog/agent-model-catalog-store.ts:58` — `withKnownDefaultEfforts` is called from `recordSuccess` for every agent; only the fingerprint is agent-scoped.
- `src/main/codex/codex-structured-session-options.ts:279-284` — effort resolution falls back to `model?.defaultEffort` before `model?.efforts[0]?.value`, so a carried default becomes what Codex is told to run.
- `src/main/codex/codex-structured-model-catalog.ts:62` / `codex-configured-launch-defaults.ts:59-68` — Codex defaults are authored per listing, not learned from a running child; a listing that names none may genuinely mean "none".
## Required outcome
- Decide whether a listing that omits a default should preserve the last known one for Codex too. If it should not, carry the value only for `agent === 'claude'`.
## Open questions for the human
- Can Codex's `model/list`/probe legitimately drop a `defaultReasoningEffort` it previously named (e.g. config change or a newer CLI row)? If so, a stale default survives until that model next reports one.#22835 landed on main as one squash commit, so this branch's copies of its individual commits conflicted file by file. The merged tree is main's, plus this branch's own six files.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe change records an eligible CLI-applied effort as a Claude model’s catalog default and retains that default across probe listings when the effort remains offered. At-rest reads use the catalog default when no effort is saved. Codex at-rest reads do not use a model default. Added tests cover catalog persistence, saved and selected efforts, and reported versus displayed options. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Later Claude chats may display an effort chosen in an earlier chat. A Codex model switch could also reuse a stale default if its listing stops naming one. The impact is bounded, but these behaviors warrant correction or explicit acceptance before merge. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to A remembered effort can be shown in another conversation where settings differ. Under a narrower, unconfirmed condition, a remembered value could also influence a later request. No security vulnerability was confirmed. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 943fc1b7-7998-48fc-8f26-7463d4b459a2
📒 Files selected for processing (6)
src/main/claude/claude-model-catalog-probe.tssrc/main/claude/claude-structured-effort-default-at-rest.test.tssrc/main/claude/claude-structured-session-options.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-session-wire/structured-agent-session-options-read.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| * a default only a running child knows, and only while this session has no effort pick. */ | ||
| function catalogClaudeModels(session: ClaudeSession, discovered: ListedModel[]): WireClaudeModel[] { | ||
| const applied = session.options.has('effort') ? undefined : session.appliedOptions | ||
| return discovered.map((listed) => { | ||
| const model = wireClaudeModel(listed) | ||
| const effort = applied?.effort | ||
| const runsApplied = | ||
| applied?.model !== undefined && | ||
| (listed.id === applied.model || listed.resolvedModel === applied.model) | ||
| return effort && runsApplied && model.efforts.some((choice) => choice.value === effort) | ||
| ? { ...model, defaultEffort: effort } | ||
| : model | ||
| }) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '205,285p' src/main/claude/claude-structured-session-options.ts
rg -n 'appliedEffort|selectedEffort|/effort' src/main/claude | head -90Repository: stablyai/orca
Length of output: 3682
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- targeted symbols ---'
rg -n -C 3 'appliedEffort|selectedEffort|defaultEffort|appliedOptions|catalogAccess|recordSuccess|options\.has\('\''effort'\''\)|/effort|effort' src/main/claude src | head -260
printf '%s\n' '--- changed file diff ---'
git diff --unified=35 7a24d3d335e7e03437000d560a52248e180051b9 202f7858f4320cc24f0d08e127e6db9e7912a388 -- src/main/claude/claude-structured-session-options.ts
printf '%s\n' '--- relevant file inventory ---'
git ls-files | rg '(claude|catalog|session|model)' | head -160Repository: stablyai/orca
Length of output: 38933
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions
Length of output: 27338
🏁 Script executed:
#!/bin/bash
set -e
rg -n -C 5 'appliedOptions|selectedEffort|appliedEffort|defaultEffort|catalogAccess|recordSuccess|options\.has\("effort"\)|options\.has\('\''effort'\''\)|/effort' srcRepository: stablyai/orca
Length of output: 45663
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- Claude state and startup ---'
sed -n '1,190p' src/main/claude/claude-structured-session-state.ts
sed -n '105,170p' src/main/claude/claude-structured-session-startup.ts
printf '%s\n' '--- Claude options around read/write and applied state ---'
sed -n '1,205p' src/main/claude/claude-structured-session-options.ts
sed -n '275,430p' src/main/claude/claude-structured-session-options.ts
printf '%s\n' '--- renderer option dispatch and persistence ---'
rg -n -C 12 'recordOutgoingCommand|setOption|persistSelection|dispatchCommand|valueSource' src/renderer/src/components/native-chat/native-chat-pty-session-options.ts src/renderer/src/components/native-chat/native-chat-runtime-send.ts
printf '%s\n' '--- production defaultEffort consumers ---'
rg -n -C 8 'defaultEffort' src/main src/renderer/src --glob '!**/*.test.*'Repository: stablyai/orca
Length of output: 42243
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- outgoing command implementation ---'
rg -n 'recordNativeChatSessionOptionCommand|function persist|const persist|persistSelection|recordOutgoingCommand' src/renderer/src/components/native-chat src/renderer/src --glob '*.ts' --glob '*.tsx' | head -100
printf '%s\n' '--- option surface implementation ---'
rg -n -C 20 'recordNativeChatSessionOptionCommand|function createNativeChatPtySessionOptions|persistSelection|const persist' src/renderer/src/components/native-chat/native-chat-pty-session-options.ts src/renderer/src/components/native-chat --glob '*.ts' --glob '*.tsx' | head -260
printf '%s\n' '--- Claude catalog tests and focused assertions ---'
rg -n -C 12 'defaultEffort|catalog|appliedOptions|reportedOptions|options\.set\('\''effort'\''\)|options\.delete\('\''effort'\''\)' src/main/claude/*test.ts src/main/native-chat/agent-model-catalog/*test.ts | head -320Repository: stablyai/orca
Length of output: 42109
🏁 Script executed:
#!/bin/bash
set -e
sed -n '145,215p' src/renderer/src/components/native-chat/native-chat-pty-session-options.ts
sed -n '1,230p' src/shared/native-chat-session-option-commands.ts
sed -n '105,145p' src/renderer/src/components/native-chat/use-native-chat-session-options.ts
sed -n '545,580p' src/renderer/src/components/native-chat/native-chat-pty-session-options.test.tsRepository: stablyai/orca
Length of output: 12798
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- apply-picks persistence path ---'
rg -n -C 10 "apply-picks|adoptModelAsLaunchDefault|enqueueSessionOptionSettingsWrite|CLIENT_SETTINGS_TARGET" src/main src/renderer/src --glob '*.ts' --glob '*.tsx' | head -360
printf '%s\n' '--- focused effort-default test setup ---'
sed -n '1,215p' src/main/claude/claude-structured-effort-default-at-rest.test.ts
printf '%s\n' '--- all Claude applied/current effort references ---'
rg -n -C 5 'readClaudeSettingsApplied|appliedOptions|effective\.effortLevel|reportedOptions\.effort|effortLevel' src/main/claude --glob '*.ts' --glob '!**/*.test.ts'Repository: stablyai/orca
Length of output: 42164
🌐 Web query:
Claude Code /effort command get_settings applied effortLevel settings API
💡 Result:
If you mean the **Claude Code Agent SDK’s `get_settings` control request**: it returns both configured settings and the *effective effort sent to the model* under `applied.effort`—not necessarily the raw `effortLevel` setting.
```json
{
"subtype": "get_settings"
}
```
Check the response’s `applied.effort` (and `applied.model`) to see what is actually in effect. `effortLevel` can differ because session overrides or model support affect the resolved value. ([git.uniiem.com](https://git.uniiem.com/HoshinoSuzumi/claude-code/src/commit/d22f80399631a7ccc35ebb913476e92832b5e131/src/cli/print.ts?utm_source=openai))
For the SDK, `get_settings` is a **control-protocol request**, not an Anthropic Messages API endpoint. To set effort on a Messages API request, use `output_config.effort`; for an SDK session, you can apply a session-level setting with `applyFlagSettings({ effortLevel: "high" })`. ([platform.claude.com](https://platform.claude.com/docs/en/build-with-claude/effort?utm_source=openai))
If you meant another `get_settings` API or want help debugging a mismatch, share the request/response snippet.
Citations:
- 1: https://git.uniiem.com/HoshinoSuzumi/claude-code/src/commit/d22f80399631a7ccc35ebb913476e92832b5e131/src/cli/print.ts?utm_source=openai
- 2: https://platform.claude.com/docs/en/build-with-claude/effort?utm_source=openai
🏁 Script executed:
#!/bin/bash
set -e
sed -n '1,130p' src/main/claude/claude-structured-effort-default-at-rest.test.ts
sed -n '1,125p' src/main/claude/claude-structured-effort-reporting.test.ts
sed -n '1,120p' src/main/claude/claude-structured-session-options.tsRepository: stablyai/orca
Length of output: 14885
Exclude in-chat effort overrides from the learned catalog default.
A typed /effort command can leave session.options without effort, while get_settings.applied.effort reports the session override. The changed builder then stores that value as defaultEffort. At rest, the options reader uses defaultEffort whenever no saved effort exists, so later chats can inherit the prior session override.
Only learn the default when the applied effort still matches the provider’s unoverridden reported effort.
Suggested fix
function catalogClaudeModels(session: ClaudeSession, discovered: ListedModel[]): WireClaudeModel[] {
- const applied = session.options.has('effort') ? undefined : session.appliedOptions
+ const hasSessionEffortOverride =
+ session.reportedOptions.effort !== undefined &&
+ session.appliedOptions?.effort !== undefined &&
+ session.reportedOptions.effort !== session.appliedOptions.effort
+ const applied =
+ session.options.has('effort') || hasSessionEffortOverride ? undefined : session.appliedOptions
return discovered.map((listed) => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * a default only a running child knows, and only while this session has no effort pick. */ | |
| function catalogClaudeModels(session: ClaudeSession, discovered: ListedModel[]): WireClaudeModel[] { | |
| const applied = session.options.has('effort') ? undefined : session.appliedOptions | |
| return discovered.map((listed) => { | |
| const model = wireClaudeModel(listed) | |
| const effort = applied?.effort | |
| const runsApplied = | |
| applied?.model !== undefined && | |
| (listed.id === applied.model || listed.resolvedModel === applied.model) | |
| return effort && runsApplied && model.efforts.some((choice) => choice.value === effort) | |
| ? { ...model, defaultEffort: effort } | |
| : model | |
| }) | |
| } | |
| * a default only a running child knows, and only while this session has no effort pick. */ | |
| function catalogClaudeModels(session: ClaudeSession, discovered: ListedModel[]): WireClaudeModel[] { | |
| const hasSessionEffortOverride = | |
| session.reportedOptions.effort !== undefined && | |
| session.appliedOptions?.effort !== undefined && | |
| session.reportedOptions.effort !== session.appliedOptions.effort | |
| const applied = | |
| session.options.has('effort') || hasSessionEffortOverride ? undefined : session.appliedOptions | |
| return discovered.map((listed) => { | |
| const model = wireClaudeModel(listed) | |
| const effort = applied?.effort | |
| const runsApplied = | |
| applied?.model !== undefined && | |
| (listed.id === applied.model || listed.resolvedModel === applied.model) | |
| return effort && runsApplied && model.efforts.some((choice) => choice.value === effort) | |
| ? { ...model, defaultEffort: effort } | |
| : model | |
| }) | |
| } |
…ort-default-at-rest

ELI5
A Claude chat that is not running right now showed a blank "Effort" button, even though the next message will run at a real effort level (usually Medium). Now the chat remembers what effort Claude uses for each model when you have not picked one, so a resting chat shows it too.
What Changed
Before: with the experimental structured chat on, a Claude chat whose agent had stopped (idle stop, app restart) showed its effort picker as a blank "Effort". A running chat showed "Medium". The value came back only after the next send started the agent again.
After: the resting chat shows the same effort a running one would, for example "Medium". A user's own effort pick still shows and still wins. Nothing is saved as the user's pick.
Also visible: a new structured Claude chat has no agent before its first send, so its picker is read the same resting way and now shows the learned effort of the model that read names (its saved selection, else the listing's default model). Before, it showed a blank "Effort" until the chat started. Which model that read names for a new chat is unchanged here. A new Codex chat is unchanged: its resting read still answers only a saved effort.
Mechanism: the host keeps one model catalog per account (the list of models and their effort levels, persisted per host). A running Claude child reports what it will apply ("applied" in its settings readback). When the chat has no effort pick of its own, the Claude catalog write-through now records that applied effort as the
defaultEffortof the model the child applied (every listed row that resolves to that model).The catalog store keeps a model's known
defaultEffortwhen a later listing names none (Claude's session-less listing never does), as long as that model still offers that effort. A listing that names a different default replaces it.When no agent is running, the options read answers a Claude chat's effort as the saved pick, else the catalog's
defaultEffortfor the chat's model. That is the same order a running Claude child uses (pick, then what the CLI applies). A resting Codex chat still answers only its saved effort, because a running Codex child shows only the effort its thread reported (none when Codex's config names none); adding the default there would show Medium at rest and blank once the chat starts.Why
Only a running Claude child knows the CLI's per-model default; Claude's model listing carries no default effort, and nothing else on the host names it. The catalog is already the host's per-account, per-model fact store, already persisted, already written through by live sessions, and already carries an optional
defaultEffortthat Codex fills from its app server. So this reuses that field and path rather than adding state.Alternatives rejected:
effective.effortLevel), and that is unchanged here.Differences from the common pattern
Known limits
Follows #22835 (landed on main)
#22835 stopped starting the agent when a chat is merely viewed, which is what exposed the blank picker. It has landed on main, and this PR now targets main directly. It should ship in the same release as #22835 so that release does not show the blank picker.
Scope
defaultEffort.defaultEffortwas already an optional catalog field, and a resting read now fills the existing optionalcurrent.effort. An older client simply shows it, as it already shows a saved pick.Linked Issue
Follow-up to #22835 (found in its live QA).
Visual Proof
Live QA on a separate Mac, dev build with the experimental structured chat on, a real Claude CLI whose settings name no effort, and the idle stop shortened to 60 s for the test. The same steps ran on the base branch (before) and on this PR (after).
Testing
New
claude-structured-effort-default-at-rest.test.tsdrives the real Claude adapter against a fake CLI whose settings readback reportsapplied: { model: claude-opus-5-5[1m], effort: medium }, then reads the chat's options with no agent running:defaultEffort: mediumfor the model it applied (and nothing for a model it did not apply).effort: mediumand the picker snapshot shows Medium.max) wins at rest.{ model: 'opus[1m]' }, no effort) reads back at rest witheffort: medium, so the persisted model id is the listed row the default was learned under.agent-model-catalog-store.test.ts: a learned default survives a later listing that names none (a probe) and an app restart, is replaced by a newer report, and is dropped when the model stops offering it.Each piece was checked by deleting it from the committed code and rerunning (restored from the commit afterward):
expected 'high' to be undefined).{ model: 'opus[1m]' }without effort).expected { model: 'gpt-5.5', effort: 'medium' } to deeply equal { model: 'gpt-5.5' }).Related suites (catalog store/service, Claude applied options, effort reporting, options, option confirmation, catalog probe, Codex options catalog, options-read RPC, at-rest RPC, shared structured options): all pass.
Checks:
tsc -p config/tsconfig.node.jsonclean;oxlinton the changed files clean; the changed-code quality gate has 0 findings in this PR's files (its 1 finding is in a base-branch mobile test). No renderer or React files changed, and no RPC shape changed.Live Electron QA (see Visual Proof): on the base branch, a resting Claude chat with no pick showed a blank "Effort". On this PR, all seven checks passed: the resting chat shows the learned Medium; a pick shows and wins; a model that never ran stays blank; a pick made at rest shows at once and is applied on the next send, and is never learned as the default; Codex is identical to the base branch; after an app restart every chat keeps its value and no agent starts. The persisted catalog carried
defaultEffort: mediumonly for the model that ran, and no chat record gained an effort it was not given.Not run: mobile. The value reaches mobile through the same options read, and no mobile code changed.
AI Disclosure
Written with Claude Code.
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
Author X handle: @BrennanKB5
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)