Skip to content

Show a resting Claude chat's effort instead of a blank picker - #23106

Merged
brennanb2025 merged 133 commits into
mainfrom
brennanb2025/chat-effort-default-at-rest
Sep 28, 2026
Merged

brennanb2025 merged 133 commits into
mainfrom
brennanb2025/chat-effort-default-at-rest

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​296 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​296
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​56 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​46

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 defaultEffort of the model the child applied (every listed row that resolves to that model).

The catalog store keeps a model's known defaultEffort when 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 defaultEffort for 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 defaultEffort that Codex fills from its app server. So this reuses that field and path rather than adding state.

Alternatives rejected:

  • Saving the applied effort on the chat's record: it would read back as the user's pick and pin an effort nobody chose past a later settings change. Claude start deliberately does not persist the applied effort today. It persists an effort only when a Claude settings file names one (effective.effortLevel), and that is unchanged here.
  • A new per-chat "last effort" field: a second copy of a fact that is per model, not per chat, and a permanent persisted field.
  • Reading Claude's settings files from disk: duplicates the CLI's own resolution (env over settings over its built-in default) and can disagree with it.
  • Showing the catalog default in the picker instead of in the options read: the picker only shows a CLI default when no model is tracked, and a resting chat always tracks its model, so it would need a new client rule on both desktop and mobile. Answering on the host covers every client, including older ones.

Differences from the common pattern

  • The common pattern keeps a model's default effort on the provider-level model list (a snapshot per provider, not per session), and a thread keeps only the user's own selection; the picker shows selection, else that default. This PR matches that ownership: the default lives on the host's per-account model catalog, the chat record keeps only the pick.
  • Deviation: in the common pattern the default is authored (a shipped, remotely refreshed model manifest, or a fixed rule such as "high if supported, else medium"). Here it is learned from a running Claude child's applied value, because the installed CLI and its settings decide it and a fixed rule can be wrong for this user.

Known limits

  • A resting Claude chat stays blank, exactly as before this PR, until some Claude chat on that account has run once with no effort pick. Until then nothing on the host knows the CLI's default.
  • A default learned from one project's Claude settings can show at rest in another project until that chat starts. The learned value is "what the CLI runs when no effort is sent" for the account, and a project-level Claude settings effort feeds into it. It is display only: it is never sent, never saved as a pick, and never gates anything, and the chat's next start shows the true value.

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

  • Structured chat only, behind the experimental structured chat setting: only a structured Claude session writes to the catalog, and the resting options read is part of the structured session host.
  • The default chat view is unchanged: its model discovery reads the host catalog but builds its Claude effort options from the effort list only and ignores defaultEffort.
  • Terminals are unchanged: nothing here touches terminal panes or the terminal-backed agents.
  • Fast mode is unchanged.
  • SSH and remote hosts: the catalog and the resting read both live on the host that runs the agent, so each host learns and answers its own default. Folder workspaces behave the same as git worktrees (nothing here depends on git).
  • Wire: no new field and no RPC shape change. defaultEffort was already an optional catalog field, and a resting read now fills the existing optional current.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).

Screenshot
Before: resting Claude chat, effort picker blank before
After: live chat, no pick, shows Medium live
After: same chat idle-stopped, still Medium at rest
After: a chat with its own pick (High) keeps it at rest pick at rest
After: switching a resting chat to a model that never ran shows blank "Effort" (nothing learned for it yet) other model
After: picking Low at rest shows at once, and the next send runs Low picked at rest
after send
After: Codex chat at rest is the same as before Codex
After: app restart, no agent started, values kept chat with pick
chat with no pick
After: new Claude chat before its first send new chat

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

New claude-structured-effort-default-at-rest.test.ts drives the real Claude adapter against a fake CLI whose settings readback reports applied: { model: claude-opus-5-5[1m], effort: medium }, then reads the chat's options with no agent running:

  • A live child's applied effort teaches the catalog defaultEffort: medium for the model it applied (and nothing for a model it did not apply).
  • At rest, the options read answers effort: medium and the picker snapshot shows Medium.
  • A saved pick (max) wins at rest.
  • The record the start actually persists ({ model: 'opus[1m]' }, no effort) reads back at rest with effort: medium, so the persisted model id is the listed row the default was learned under.
  • A resting Codex chat with no saved effort still answers none, even when its catalog names a default.
  • A restored or mid-session effort pick is never learned as the default.
  • The start still persists no effort, and the resting read writes nothing to the chat's record.

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

  • Write-through learning deleted: 3 tests fail (learns, shows at rest, and the other-chat half of the pick test).
  • Pick guard deleted: the pick test fails (expected 'high' to be undefined).
  • Store carry deleted: the store test fails, and so does the pick test (the picked session's listing erases the learned default).
  • Resting fallback deleted: the at-rest test fails ({ model: 'opus[1m]' } without effort).
  • Claude-only guard on the resting fallback removed: the Codex test fails (expected { model: 'gpt-5.5', effort: 'medium' } to deeply equal { model: 'gpt-5.5' }).
  • Start's display-only effort strip deleted: the no-save test fails.

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.json clean; oxlint on 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: medium only 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

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Author X handle: @BrennanKB5

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

brennanb2025 and others added 30 commits September 24, 2026 23:36
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]>
…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]>
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.
…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.
@brennanb2025
brennanb2025 marked this pull request as ready for review September 28, 2026 02:47
@brennanb2025

brennanb2025 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

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

  • Loop 1 fixed one real bug: the resting read also filled in the catalog default for Codex chats. A running Codex chat shows only the effort its session reported, which is none when Codex's config names none. So a resting Codex chat would have shown "Medium" and then gone blank once it started. The resting fallback now applies to Claude only, and a test covers the Codex case (db501c1). Loop 1 also tightened the resting test so it reads back the record the start actually saves (58ce649).
  • Loop 2 was clean: no code changes. It corrected two sentences in the PR body: how a new chat's picker behaves, and when a Claude start saves an effort.
  • No architecture escalation needed: no issue came up twice, and there were only two loops.

Design check

  • What matches the usual pattern: the per-model default lives on the host's model catalog, while the chat record keeps only the user's pick. The picker shows the pick, else that default.
  • Where it deviates (disclosed in the body):
    • The default is learned from what a running Claude child applied, not written by hand in advance.
    • Nothing is shown until some Claude chat on that account has run once without a pick.

Readiness

  • Start and end: both PASS with no blockers.
  • Tests: 19 related test files (215 tests) pass. Node typecheck and oxlint on the changed files are clean.
  • CI: one test shard failed on the first attempt. The cause was a temp-folder cleanup race (ENOTEMPTY rmdir) in structured-agent-session-refusal-retry.test.ts, a test from the base branch. The rerun passed, and all checks are green.

Live QA

Setup: 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.

  • Who ran it: grok was out of quota (re-probed 2026-09-28: 402 "usage balance exhausted"), so a Claude seat ran the orchestrated QA. It ran at 58ce649; the commits since then are merges of main only.
  • Before (base branch): a resting Claude chat with no pick showed a blank "Effort". Bug reproduced.
  • After (this PR), 7 of 7 scenarios pass:
    • The resting chat shows the learned Medium, the same as it showed live.
    • A chat with its own pick (High) keeps it at rest.
    • A model that never ran without a pick shows blank "Effort", as the body discloses.
    • A pick made at rest (Low) shows at once, is applied on the next send, and is never learned as the default.
    • Codex behaves exactly as on the base branch.
    • After an app restart, every chat keeps its value and no agent starts.
  • Where the value comes from: the saved catalog carried defaultEffort: medium only for the model that ran. No chat record gained an effort the user didn't pick.
  • Not run: mobile. No mobile code changed, and mobile reads the same options call.

Not caused by this PR (possible follow-ups for #22835 or the new-chat defaults)

  • An effort pick becomes the new-chat default. Picking an effort in any chat also saves it as the default for new chats. New chats then start with that pick saved, so they never rest on the learned default. The effort menu has no "Default" entry to undo this.
  • New chats start an agent at once. Opening a new Claude chat starts an agent right away, before anything is sent. This happens on the base branch too.
  • The model a new chat names is a guess. A new Claude chat's first read names the listing's default model, even though Claude's own settings may choose another one. This PR adds that model's learned effort. It is display-only and never sent.

Residual risks (all display-only, never sent or saved as a pick)

  • Project settings spill over. An effort set in one project's Claude settings is learned for the whole account, so it can show on another project's resting chat until that chat starts. The body discloses this.
  • Typed /effort is untested. Typing /effort as a message, rather than using the picker, has not been traced. It might be learned as the model's default until the next start without a pick.

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

ℹ️ 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 — readStructuredAgentSessionOptionsAtRest answers saved.effort ?? catalog.defaultEffort for 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 — catalogClaudeModels records the child's applied.effort as defaultEffort on every listed row resolving to the applied model, gated so a user's pick is never learned.
  • Catalog store keeps a known default — withKnownDefaultEfforts preserves a model's prior defaultEffort through 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, wireClaudeModels split 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).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +56 to +70
/** 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 }
})
}

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.

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.

@brennanb2025
brennanb2025 changed the base branch from brennanb2025/chat-conversation-outlives-agent to main September 28, 2026 06:48
#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.
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The 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 202f7

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 Review

Security architecture risk: 🟡 Moderate · up to 202f7

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

  • Low · architecture · inferred: A session-derived applied effort is stored per account and can be displayed for another resting session using the same model, even if its settings would produce a different effort.
  • Medium · architecture · inferred: The provider-agnostic retention rule can preserve an old Codex default when a newer listing omits it; a subsequent option write can use that value as the effort sent on a turn. Whether production listings make this transition is unverified.
Security review details

Security Blast Radius

  • inferred — A learned value can reach other sessions under the same account-home catalog, including resting sessions in a different workspace. The inspected identity key does not make it a cross-account value.

Trust Boundaries and Controls

  • observed — The live child supplies applied settings, but catalog promotion requires a matching listed model, an advertised effort, and no effort option in that session. Resting reads prefer the saved option.

Resilience and Maintainability Implications

  • observed — An empty model listing does not replace the catalog. For a nonempty listing, an explicit new default replaces a retained one, and loss of effort support prevents retention.

Hardening Proposals

  • proposed — Consider tying an inferred effort to the settings context that produced it, or withholding it when a resting session’s context cannot be established.
  • proposed — Consider provider-specific retention or provenance checks before allowing an omitted default to influence a later turn option.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 user-facing change: showing a resting Claude chat's effort instead of a blank picker.
Description check ✅ Passed The description is complete and well aligned with the template. It explains the user impact, implementation, rationale, testing, visual proof, scope, limitations, linked issue, and checklist. The full…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 943fc1b7-7998-48fc-8f26-7463d4b459a2

📥 Commits

Reviewing files that changed from the base of the PR and between 7a24d3d and 202f785.

📒 Files selected for processing (6)
  • src/main/claude/claude-model-catalog-probe.ts
  • src/main/claude/claude-structured-effort-default-at-rest.test.ts
  • src/main/claude/claude-structured-session-options.ts
  • src/main/native-chat/agent-model-catalog/agent-model-catalog-store.test.ts
  • src/main/native-chat/agent-model-catalog/agent-model-catalog-store.ts
  • src/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.

Comment on lines +244 to 257
* 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
})
}

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.

🎯 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 -90

Repository: 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 -160

Repository: 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' src

Repository: 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 -320

Repository: 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.ts

Repository: 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.ts

Repository: 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.

Suggested change
* 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
})
}

@brennanb2025
brennanb2025 merged commit 504e749 into main Sep 28, 2026
44 checks passed
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