feat(chat): remember model and effort choices, keep effort across model switches#875
Conversation
…el switches Persist each provider's last explicitly chosen model and effort valueIds under a new acp-config-prefs store key, and restore them in the agent config picker once discovery lands: a persisted model still offered by the selector is re-selected (kicking off model-specific effort discovery when it differs from the default), and a persisted effort is applied whenever an effort selector arrives without a valid explicit selection. Restored values are marked explicit so they are actually sent at launch; ids no longer offered fall back silently to defaults. Switching models no longer discards the effort selection. Both the picker and the session follow-up composer now hold the current effort as a desired value while model-specific options load, then reconcile: keep it when the new options still offer it, otherwise fall back to the selector default (picker: via the persisted preference first). Follow-up model/effort changes also record the preference. The reconciliation lives in a shared reconcileSelectorValue helper in acpConfigSelection.ts, and the pref merge in a pure acpConfigPrefs module; both are unit-tested. Verified with vitest (424 passing) and svelte-check/tsc (clean). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80ffa4caec
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // The effort selection is kept as the desired value; the effort effect | ||
| // reconciles it once the model-specific options arrive. |
There was a problem hiding this comment.
Keep follow-up effort explicit across model switches
When a user replies to an existing session that already has an effort selected, then changes only the follow-up model to another model that still offers that effort, this code keeps showing the old effort value but leaves followupEffortTouched false. In that state followupAcpConfigSelection passes null as the stored effort for model-specific configs, so buildAcpConfigSelection omits the effort and resumeSession receives a model-only requested selection, clearing/not applying the displayed effort. Mark the retained valid effort as explicit or avoid displaying it as selected unless it will be sent.
Useful? React with 👍 / 👎.
Address the four findings from the review of 80ffa4c: - The retained-effort snapshot in AcpConfigPicker is now captured synchronously in discoverEffortOptionsForModel instead of an effect, so the mount-restore path — where discovery lands and the model-specific fetch starts in the same tick — also gets a snapshot and a transient fetch failure restores the previous effort column instead of dropping it. - SessionChatPane's follow-up touched flags are now scoped to the session they were touched in (derived from a touched-session id), so an explicit model/effort choice made in one session no longer survives the state-key reset and silently overrides another session's stored selection when the pane is reused. - Finished the helper consolidation: SessionChatPane imports selectorHasValue/defaultSelectorValue from acpConfigSelection, dropping its private selectorHasValue copy and rewriting initialSelectorValue as the stored-selection check plus defaultSelectorValue. - Effort preferences are now persisted per (provider, model) via a modelEfforts map, with the provider-level effort kept as the fallback, so habits like opus-at-max / haiku-at-low are restored per model. Reads go through a new preferredAcpEffort helper. Verified with vitest (431 passing, 7 new for the pref merge/read logic) and svelte-check/tsc (clean). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
Summary
Makes the agent config pickers remember what the user last chose, and stops model switches from discarding the effort selection.
acp-config-prefspreferences store, keyed by provider id. Only selector valueIds are stored — labels always come from live discovery, so stale ids fall back silently rather than surfacing broken options.AcpConfigPickerfinishes discovery, the persisted model is re-applied if the provider still offers it (marked explicit so it's actually sent at launch), and the model-specific effort options are fetched for it.reconcileSelectorValuehelper — kept if still offered, otherwise falling back to the selector default as display-only. The same behavior applies to the follow-up effort picker inSessionChatPane.Implementation notes
defaultSelectorValue/selectorHasValuemoved out ofAcpConfigPicker.svelteintoacpConfigSelection.tsso they can be shared and unit-tested.acpConfigPrefs.tsmodule (separate frompreferences.svelte.tsso it's testable without the Svelte runtime); patches update fields independently andnullclears one.Testing
reconcileSelectorValue(kept/fallback/empty-selector cases) andmergeAcpConfigPref(create/update/clear/no-mutation).🤖 Generated with Claude Code