Repository navigation
feat(settings): Chat settings control for idle compaction before cache expiry - #30246
Pearcekieser wants to merge 1 commit into
Conversation
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the PR adds Settings rows for two existing keys. The write path clamps values the same way the loader does, the idle trigger reads the live config, and both states are shown in screenshots. Notes
[DESIGN-REVIEWED] c85953d Description read[DESCRIPTION-READ] 4262e864c7b37df072068514a8c93deedd511321076e7027a4c03b28fb3d243c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The base RFC ( Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: let a user turn idle compaction on and set its minimum context from Settings, without editing
[FIRST-PRINCIPLES-REVIEWED] c85953d Description read[DESCRIPTION-READ] 7a6902941b521cea97d45bac37bf20949fc0b25741509ca84cfc72be25a29042 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: the blind reader correctly understood the new switch and the minimum field, would use them, and saw both states. Notes
[UX-REVIEWED] c85953d Description read[DESCRIPTION-READ] 9fb1d87fd74a90f328944a8ad33f6dd23e982c4606fa27ab582053b190da6f9f That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
db84eef to
dc74631
Compare
The three notes are fixed in the same push. The minimum row is dimmed with |
dc74631 to
60a4e8f
Compare
60a4e8f to
527726d
Compare
5e16c3d to
54e3b8d
Compare
|
54e3b8d to
14efc70
Compare
The two notes are fixed in the same push. The minimum field is now "Minimum Context to Summarize (%)" and says "Only idle chats whose context is at least this full are summarized.", which tells it apart from Auto-Compact Threshold. The clamp notice now uses a neutral |
14efc70 to
caef2b6
Compare
caef2b6 to
1e0eb29
Compare
Code change approver recommendation: A person should decideWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 1214 lines, more than the 400 it may approve on its own. This PR adds Phase 2 of the idle-compaction RFC: a Settings switch and a minimum-context field for two config keys that already exist. I found nothing that blocks it. Backend.
Frontend.
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
…e expiry Settings > Chat > Advanced, Context card, gains the Summarize Idle Chats to Save Credits switch (session.idle_compaction) and the Minimum Context to Summarize (%) field (session.idle_compaction_min_context_pct) below Auto-Compact Threshold. The switch row says that the next message costs less, that each summary can cost about as much as one or two messages in that chat even if you never come back, and that it is worth it if you often return to long chats. The field says that only idle chats at least this full are summarized. It is disabled and dimmed while the switch is off, and its row then says to turn on the switch to change it. The switch saves through the shared optimistic config overlay, so a refetch that fails after a good save cannot flip it back. The field writes the stored value into the config cache, skips that write after an unmount, raises the panel's error banner on failure and then refetches the config, because a request can fail after the server stored the value. The PATCH path accepts both keys: the switch takes a boolean only, and the minimum clamps to 40-90 through the loader's own _safe_float and returns a clamp_notice. The field shows a notice that opens with the saved value and says whether the typed value was raised or lowered. The notice uses a new neutral FieldHint tone, because the save worked. Every other FieldHint keeps the warn tone. Both paths are classified as cannot-widen settings for change cards. Strings are in all 12 catalogs, and the settings registry, the agent-facing registry, the UI index and config-baseline.json are regenerated. Settings search keeps finding both rows by "idle compaction". The RFC record and the feature map name Phase 1 as shipped and Phase 2 as in flight.
|
The design for this change is signed off: a maintainer accepted the RFC when #22149 merged. This PR also edits the RFC index and the feature map, so it now waits for a maintainer to approve it. Review result on c85953: no blocking findings. Here is what the review checked:
A note for the maintainer: on #30245, a maintainer said on 2026-11-13 that they would carry this change onto a fresh branch. No such PR is open, and this branch has since been rebased. Please pick one of the two paths. Optional:
|
Problem / Motivation
Goal: a user can turn idle compaction on and set its minimum context from Settings, Chat, Advanced, without editing
config.json.session.idle_compactionandsession.idle_compaction_min_context_pctshipped in #24384 as config keys only. Phase 1 of the accepted RFC (#22149) left the Settings control to Phase 2, so a user must editconfig.jsonto turn the feature on. This PR is Phase 2.Why it matters
The feature is opt-in and costs a model call each time it fires. A user who wants it needs a visible switch that states that cost, and a way to raise the minimum context without editing a file.
Not a goal
What changed (motivation → approach → change)
RFC section 5.1 places the control beside Auto-Compact Threshold. The Chat settings page writes each row by hand, so both rows go into the Context card on Settings, Chat, Advanced, directly below that select.
useIdleCompactionFields.ts(new) holds both rows' saves. The switch saves through the shareduseOptimisticConfigPathsoverlay, so a refetch that fails after a good save cannot flip it back. The minimum field saves on blur or Enter, writes the stored value into the config cache, and skips that write after an unmount. Both failure paths raise the panel's error banner and refetch the config, because a request can fail after the server stored the value.sections_session.py. It changed because the UX review's blind reader did not know what "Cache Expiry" in the old label meant and left the switch off. Its row says: "Summarizes a large chat that has gone idle, so your next message in it costs less. Each summary can cost about as much as one or two messages in that chat, even if you never come back. Worth it if you often return to long chats." The size comes from the RFC's section 6 low cost bound, 2.7 to 4.6 credits per summary against 1.8 to 3.0 credits of input for a warm message at the same context.opacity-40 cursor-not-allowed, and says "Turn on Summarize Idle Chats to Save Credits to change this." The server clamps a value outside 40 to 90 through the loader's own_safe_float. The row then shows a notice that starts with the saved value, for example "Saved 40%. The allowed range is 40% to 90%, so 20% was raised to 40%." The save worked, so the notice uses a new neutralFieldHinttone (text-muted), and every other caller keeps warn. Saves of the field share one mutation scope, so they land in the order the user made them.core_config_schema.pyadds both keys to_EDITABLE_CONFIG.change_card_catalog_kinds.pyclasses both paths as settings that cannot widen access.en.jsonand the 11 translated catalogs, the regenerateden-XApseudolocale, settings registries, UI index andconfig-baseline.json.settingsKeywords.tslets Settings search find both rows by "idle compaction". Theconfiguration.mdandconfig.mdrows name the Settings path.ec2e1a1609), and Phase 2 as in flight. A feature-map row covers the new page file.Backwards compatibility
Compatible. Both keys and their defaults already exist. A config without them loads as before, and the new rows only read and write the same keys
config.jsonholds.Tests
SettingsChatPanelIdleCompaction.test.tsx(new, 26 cases) renders the realChatPanelwith the API mocked. It covers the default and saved states with the dimmed row, the benefit-before-cost text, the switch save while pending and after it settles, a failed switch save, a refetch failure after a good save for both rows, the banner scroll on both failure paths, the in-range save on blur and Enter, the clamp of 20 to 40 and 95 to 90 with the notice text and its neutral tone, the warn tone kept on the time limit notice, the notice cleared when another writer saves a different value, the locked reason while off, save order across a remount, the notice after a language change, an empty field, a failed field save, the refetch after it, the error cleared when that save was stored anyway, and its retry, the unmount guard, the registry entries, and a Settings search for "idle compaction". Each case added for a review finding fails without its fix.test_config_patch_idle_compaction.py(new) covers the PATCH path for both keys, andtest_config_load_bounds_parity.pypins the float bounds to the loader constants.Ran locally after the last code change:
tsc -p tsconfig.app.json, eslint, black 26.10.1,I18N_BASE_REF=origin/main npm run i18n:check,I18N_BASE_REF=origin/main npx vitest run src/i18n/(1,174 passed, all 12 locale style files),gen-ui-index.mjs --check, the settings registry and search tests,docs_lint.py, the feature-map gate andpre_push_gate.py(23 ran, 0 failed). The four full vitest shards, flake8, isort and mypy ran on the first version of the change. The 11 translations follow each locale's style guide but have no native-speaker review yet.Manual verification
A pod on this branch, Settings, Chat, Advanced.
Off, the default. The switch row states what it does, what one summary costs and when it pays. The minimum row is dimmed, disabled and says how to unlock it:
On, then 20 typed and Enter pressed. The server saved 40, and the notice starts with the saved value, in neutral text:
Related Issues
Fixes #30245
Part of #22148
Implements Phase 2 of #22149 (merged RFC).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.