Skip to content

feat(web): setting to turn off compacting old Claude threads before sending - #19005

Closed
watson wants to merge 1 commit into
pingdotgg:mainfrom
watson:t3/compact-old-claude-threads-setting
Closed

watson wants to merge 1 commit into
pingdotgg:mainfrom
watson:t3/compact-old-claude-threads-setting

Conversation

@watson

@watson watson commented Oct 13, 2026

Copy link
Copy Markdown

Summary

A Claude thread over 100K tokens compacts before your next message once its prompt cache expires (#17945). With an API key, Bedrock, or Vertex the cache lasts 5 minutes, so a short break summarizes away detail, and the only way to skip it is to click the chip on every send. This adds a Compact old Claude threads switch in Settings → General → Behavior, on by default.

 resumeCompactionTokens =
   activeContextWindow &&
-  !resumeCompactionPermanentlyDismissed &&  // localStorage, set by Claude's "Don't ask again"
-  !nativeResumeCompactionDismissed &&
+  settings.compactOldClaudeThreads &&       // new client setting, default true
   !compactDisabled && …
   shouldOfferResumeCompaction(…)
  • On/off, not a time. Once the cache is cold, resuming re-reads the same history uncached whether you were away 6 minutes or 6 hours, so an idle threshold wouldn't track cost. The real choice is to save tokens or keep detail.
  • Client setting, not Claude provider config. Any change to a provider instance's config rebuilds that instance (ProviderInstanceRegistry reconcile), so a switch there would restart Claude on every toggle. Only the web composer acts on it, and mobile has no compact offer.
  • Removed the hidden dismissal. Answering "Don't ask again" to Claude's native resume prompt set a local-storage flag that nothing in the UI could undo. The switch replaces it. The answer still reaches Claude Code for its own prompt. feat(web): old Claude threads compact on send instead of stacking notices #16631 found that prompt doesn't fire under the v2 orchestrator, so I didn't wire it to the switch.

Evidence

  • Before: Claude thread at 123K tokens, idle a few minutes through an API-key gateway → /compact runs (123K → 10.8K) and the message queues behind it. No setting to stop it.
    After: with the switch off, resumeCompactionTokens is null, so there's no chip and Enter sends with full history. With it on (the default), behavior is unchanged.
  • settings.test.ts: decodeClientSettings({}).compactOldClaudeThreads === true (existing installs keep today's behavior), and false round-trips through settings and patch.
  • vp test run on the 4 touched test files: 251 passed. tsc-rs --noEmit clean for web, contracts, and shared. vp lint on changed files: no new warnings (ChatView has the same 89 as main).

I didn't run the app, so there are no screenshots yet.

Merge Danger

Door: two-way

Anyone who answered "Don't ask again" in Claude's native prompt will see the Compact chip again, because the old local-storage flag is no longer read. They can turn the new switch off.

Blast Radius: composer

Only whether the Compact chip appears changes. Compaction itself, the context meter's Compact context action, and /compact are untouched.

Done by Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

…ending

A Claude thread over 100K tokens compacts before the next send once its
prompt cache expires. With an API key, Bedrock, or Vertex that cache lasts
5 minutes, so short breaks summarize away detail. Add a "Compact old Claude
threads" client setting (on by default) that turns the offer off.

The setting replaces the hidden local-storage dismissal that mirrored
Claude's native "Don't ask again" answer, which nothing in the UI could undo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 13, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a default-on production setting that controls whether substantial Claude thread compaction runs before sending, while replacing the prior hidden dismissal behavior. The resulting product-default and existing-user behavior changes require human review.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8921bc99-a9d6-47b3-b019-5dc765c3da37
📥 Commits

Reviewing files that changed from the base of the PR and between 6524a8d and 4d98031.

📒 Files selected for processing (10)
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/chat/ContextWindowMeter.logic.test.ts
  • apps/web/src/components/chat/ContextWindowMeter.logic.ts
  • apps/web/src/components/settings/SettingsPanels.tsx
  • apps/web/src/components/settings/settingsSearch.ts
  • docs/user/providers-claude.md
  • packages/contracts/src/settings.test.ts
  • packages/contracts/src/settings.ts
  • packages/shared/src/claudeCompaction.test.ts
  • packages/shared/src/claudeCompaction.ts
💤 Files with no reviewable changes (2)
  • apps/web/src/components/chat/ContextWindowMeter.logic.test.ts
  • apps/web/src/components/chat/ContextWindowMeter.logic.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The change adds a default-enabled setting for compacting old Claude threads and removes the resume-compaction offer’s persisted dismissal state and question-matching checks.

Changes: Claude thread compaction

Layer / File(s) Summary
Add the compaction preference
packages/contracts/src/settings.ts, packages/contracts/src/settings.test.ts, apps/web/src/components/settings/SettingsPanels.tsx, apps/web/src/components/settings/settingsSearch.ts, docs/user/providers-claude.md
The settings contract adds compactOldClaudeThreads, which defaults to true and can be updated through a settings patch. General settings, search, reset handling, documentation, and decoding tests include the preference.
Remove resume-compaction dismissal checks
packages/shared/src/claudeCompaction.ts, packages/shared/src/claudeCompaction.test.ts, apps/web/src/components/chat/ContextWindowMeter.logic.ts, apps/web/src/components/chat/ContextWindowMeter.logic.test.ts, apps/web/src/components/ChatView.tsx
The question matcher and dismissal-checking function are removed with their tests. ChatView no longer stores permanent dismissal state or uses dismissal checks to determine offer eligibility.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related PRs

  • pingdotgg/t3code#17234: Adds an earlier setting and native prompt-dismissal flow for compacting old Claude threads.

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 4d980

The new setting controls whether eligible older Claude threads receive the Compact offer. No actionable merge-blocking issue is established; merge after normal checks.

Security architecture risk: 🔵 Low · up to 4d980

The change is limited to a local compaction preference. Existing thread permissions, provider eligibility and message ordering remain intact, with no demonstrated increase in privileges or cross-thread access. Previously dismissed users may receive the compaction offer again after upgrading. End-to-end native preference persistence and runtime recovery were not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The preference can affect eligible Claude threads viewed through the same client settings scope, rather than only the environment/provider associated with an old dismissal. It does not itself select another thread, change credentials or expand the authority of the turn-submission calls.

Trust Boundaries and Controls

  • observed — The new preference is not an authorization gate. Existing compaction eligibility still requires an operable server thread, a compatible compaction-capable provider and no pending approvals or user inputs. Resolved native-dialog answers no longer write a persistent web dismissal preference.

Resilience and Maintainability Implications

  • inferred — The inspected comparison does not establish a newly introduced identity, ordering or recovery weakness in compact-before-send. Existing non-atomic submission behavior remains, while the native resume dialog has a separate preference lifecycle. Downstream persistence of its never response remains outside verified coverage.
Pre-merge checks · Passed 4
Passed Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: adding a web setting to disable compaction of old Claude threads before sending.
Description check Passed The description clearly covers the problem, implementation, scope, behavioral impact, test results, and known limitations. It does not use the template headings exactly and does not provide the reques…
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@watson

watson commented Oct 13, 2026

Copy link
Copy Markdown
Author

Closing as a duplicate of #18486. It adds the same setting, came first, and keeps existing opt-outs working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant