Repository navigation
fix(web): send /clear without compacting a stale thread first - #31100
HoneyPaptan wants to merge 5 commits into
Conversation
Compact-before-send only exempted /compact, so /clear on an idle Claude thread ran a full compaction of the old context and then discarded it. Fixes pingdotgg#31092
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Explicit /clear commands now skip unnecessary stale-thread compaction, avoiding wasted work before context is discarded. Ordinary messages and existing queue safeguards retain their behavior. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
# Conflicts: # apps/web/src/components/ChatView.logic.ts
|
Note Written by Merged current
|
…lear-skips-compact # Conflicts: # apps/web/src/components/ChatView.logic.ts
AI-assisted; verified with the tests and tools listed above.
EvidenceWeb client, Chromium, 1280×800, light theme, separate fresh databases, real Claude connection, identical synthetic histories reporting 660,789 context tokens. Connect without freshContext, advance the client clock past the cache TTL, leave Compact 661k enabled, type
Reproduction instructions · Seed driver · Settings setup · Browser preparation · Compatibility proxy · Command audit Controlled setup: the client clock was accelerated; no natural one-hour idle wait was performed. The proxy omitted freshContext to simulate an older server advertisement while forwarding real app traffic. Runtime model identifiers were excluded from evidence. Both recordings and stills were visually inspected. AI-assisted; verified with the tests and tools listed above. Not shown:
|


Problem
Fixes #31092.
On a Claude thread that has gone idle past its cache TTL (the "Compact" chip is showing), typing
/clearsends/compactfirst and then/clear. The compaction re-reads the whole cold context (345K uncached tokens in the report) to write a summary that/cleardiscards a moment later.Change
planComposerTurnalready skips compact-before-send for a typed/compact. The same pattern now also matches/clear, so it is sent on its own. Matching is the same as for/compact: case-insensitive, the command must be the whole first word (/clearly ...still compacts first).Not included: hiding the "Compact" chip while the composer holds
/clear. That's a UI follow-up and the chip no longer causes a compaction for this message.Scope and approval
A very small, focused fix for an obvious bug: the exact case the reporter hit, with the code path they pointed to. One regular expression and its comment, plus test cases.
Verification
planComposerTurntest inChatView.logic.test.ts:/clearand/Clearno longer setcompactBeforeSendor queue behind a compaction, whilehello,/compactfooand/clearly not a commandstill do.vp test run --project unit src/components/ChatView.logic.test.ts: 47 passed.effect-tsgotypecheck ofapps/web, plusvp fmt --checkandvp linton the changed files: clean.useComposerSend.tsreadscompactBeforeSendfrom this plan and is unchanged.Model and harness: Claude Opus 5.5 (
claude-opus-5-5) in Claude Code.