GeezerVison is showing github.com — fix(web): send /clear without compacting a stale thread first by HoneyPaptan · Pull Request #31100 · pingdotgg/t3code
Conversation
Problem
Fixes #31092.
On a Claude thread that has gone idle past its cache TTL (the "Compact" chip is showing), typing /clear sends /compact first and then /clear. The compaction re-reads the whole cold context (345K uncached tokens in the report) to write a summary that /clear discards a moment later.
Change
planComposerTurn already 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
- Extended the existing
planComposerTurn test in ChatView.logic.test.ts: /clear and /Clear no longer set compactBeforeSend or queue behind a compaction, while hello, /compactfoo and /clearly not a command still do. vp test run --project unit src/components/ChatView.logic.test.ts: 47 passed.
effect-tsgo typecheck of apps/web, plus vp fmt --check and vp lint on the changed files: clean.
- Not checked: a live idle Claude thread in the app. The send path in
useComposerSend.ts reads compactBeforeSend from this plan and is unchanged.
Model and harness: Claude Opus 5.5 (claude-opus-5-5) in Claude Code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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
Approvability
Verdict: Approved at c5e235d
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Use the following commands to manage reviews:
@coderabbitai resume to resume automatic reviews.
@coderabbitai review to trigger a single review.
Use the checkboxes below for quick actions:
- Resume reviews
- Trigger review
No actionable comments were generated in the recent review.
Walkthrough
-
The composer now skips pre-send compaction when a message begins with /clear or /compact at a command boundary. Tests cover /clear bypassing compaction and command-like prefixes that do not match.
Changes: Stale-session command handling
| Layer / File(s) |
Summary |
Command exclusion and validation packages/client-runtime/src/state/contextWindow.ts, apps/web/src/components/ChatView.logic.ts, packages/client-runtime/src/state/contextWindow.test.ts, apps/web/src/components/ChatView.logic.test.ts |
The shared pattern matches /clear and /compact, case-insensitively, when followed by whitespace or the end of the message. Pre-send compaction checks use this pattern. Tests cover /clear bypassing compaction and command-like prefixes that do not match. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
Suggested reviewers: juliusmarminge
Merge Risk: Minimal · up to 6040c
-
Sending /clear on a stale thread no longer compacts the thread first, while similar-looking inputs such as /clearly still do. The change is small, covered by tests, and easy to revert, so merge risk is minimal.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: /clear is now sent without a compact-before-send step on a stale thread. It matches the changeset, which swaps the compact exemption pattern for one that also covers /… |
| Description check |
 |
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section states the bug, the reproduction context, and the cost (345K uncached tokens). The Change s… |
| Linked Issues check |
 |
[#31092] The only directly linked issue is closed and completed. Its text states that it is historical context only and not a requirement for this pull request. No active directly linked target remain… |
| Out of Scope Changes check |
 |
[#31092] All changed files implement one behavior: skip compact-before-send for a typed /clear. The changes are the web composer plan (ChatView.logic.ts), the shared predicate that replaces `COMPA… |
Full details: Title check
-
Explanation
The title names the main change: /clear is now sent without a compact-before-send step on a stale thread. It matches the changeset, which swaps the compact exemption pattern for one that also covers /clear in planComposerTurn and compactBeforeSendTokens. The title follows the conventional commit form the template suggests.
Full details: Description check
-
Explanation
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section states the bug, the reproduction context, and the cost (345K uncached tokens). The Change section explains the regex-based fix and its matching rules, and notes the out-of-scope chip hiding. The Scope section explains why no separate issue is needed and links #31092 (Fixes #31092). The Verification section lists the focused test command and its result (47 passed), the typecheck and lint results, and what was not checked (a live idle Claude thread). The template's optional agent-model line is also present. The description is complete for a small bug fix.
Full details: Linked Issues check
-
Explanation
[#31092] The only directly linked issue is closed and completed. Its text states that it is historical context only and not a requirement for this pull request. No active directly linked target remains, so no linked-issue coding requirements apply. The change is still consistent with the issue's intent. At the reviewed head, NO_COMPACT_BEFORE_COMMAND_PATTERN (shared packages/client-runtime/src/state/contextWindow.ts) matches /clear and /compact case-insensitively at the first-word boundary. compactBeforeSendTokens returns null for both. planComposerTurn in apps/web/src/components/ChatView.logic.ts uses this pattern. The test file covers /clear and non-matching inputs such as /compactfoo and /clearly not a command. The issue's suggested Compact chip change is not an active requirement and is not part of this review.
Full details: Out of Scope Changes check
-
Explanation
[#31092] All changed files implement one behavior: skip compact-before-send for a typed /clear. The changes are the web composer plan (ChatView.logic.ts), the shared predicate that replaces COMPACT_COMMAND_PATTERN (contextWindow.ts), and tests (ChatView.logic.test.ts, contextWindow.test.ts). The shared predicate also changes mobile shouldCompactBeforeSend. This extends the same /clear rule to mobile. It is a direct consequence of sharing the predicate, not an unrelated change. The current PR description mentions only the web change, so the mobile effect is a scope expansion the author has not described. It is not an unrelated change. No change unrelated to the /clear compaction behavior was identified in the reviewed diff summary. Scope was assessed from the summary and the stated changes; no additional repository inspection was needed.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between e1e9b42 and 6040c74.
Files selected for processing: 4
-
apps/web/src/components/ChatView.logic.test.ts
apps/web/src/components/ChatView.logic.ts
packages/client-runtime/src/state/contextWindow.test.ts
packages/client-runtime/src/state/contextWindow.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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
# Conflicts:
# apps/web/src/components/ChatView.logic.ts
Note Written by claude-opus-5-5 on behalf of Maria
Merged current main (merge commit, no rebase) to clear the conflict in ChatView.logic.ts.
main moved the /compact exemption into packages/client-runtime/src/state/contextWindow.ts (#27935) so web and mobile share it. I resolved the conflict by moving this PR's pattern there as NO_COMPACT_BEFORE_COMMAND_PATTERN and importing it in ChatView.logic.ts. Mobile's shouldCompactBeforeSend now also skips compaction for /clear, with one added row in its existing contextWindow.test.ts table.
vp run check:changed passes (format, lint, knip, typecheck, tests).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…lear-skips-compact
# Conflicts:
# apps/web/src/components/ChatView.logic.ts
AI-assisted; verified with the tests and tools listed above.
Evidence
Web 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 /clear, dismiss suggestions, restore the clock, and press Enter. Base sends /compact then queues /clear; head sends only /clear.
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:
- Natural prompt-cache expiry was not observed: client time was accelerated instead of waiting one hour.
- An installed historical server release was not exercised: its missing freshContext advertisement was simulated by the compatibility proxy.
- Provider billing and desktop/mobile surfaces were not measured; this proof demonstrates the web client's command ordering.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 18, 2026
|
This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.
See the conflict window.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The automated pipeline stopped on this pull request and will not merge it:
the fix is written and reviewed, but proving it needs something no worker has:
- Permanent blocker: the reported reproduction requires access to a compatible Claude server without freshContext and a stale Claude conversation above the compaction threshold. That server/account setup was not available; first-party Claude OAuth is explicitly unavailable in this worker environment. The scenario runner's generic ACP replay does not create the required Claude state.
- The fallback dispatch order for /clear remains unverified on both commits.
It stays open for a person to finish or close.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|