Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web - composer send path (compact-before-send on stale Claude threads)
Steps to reproduce
- Use a Claude thread until its context is above the compaction suggestion minimum (
COMPACTION_SUGGESTION_MIN_TOKENS). - Leave it idle past its prompt-cache TTL, so the composer shows the "Compact" chip (compact-before-send is on).
- Type
/clearand press Enter.
Expected behavior
/clear is sent on its own. The old conversation is discarded, so nothing should be compacted first.
Actual behavior
The composer sends /compact first, then /clear. The thread shows "Context compacted before sending 345K -> 14.1K tokens", and then the clear runs. The compaction re-reads the whole cold context (345K uncached input tokens in my case) to produce a summary that /clear throws away the next moment.
Impact
Pure waste of plan usage and wall-clock time on exactly the action a user takes to avoid paying for the old context. On a 1M-context model with a stale thread this is hundreds of thousands of uncached tokens per /clear.
Diagnosis
planComposerTurn in apps/web/src/components/ChatView.logic.ts (main @ 8ab024f) exempts only /compact from compact-before-send:
const compactBeforeSend =
input.resumeCompactionTokens !== null &&
!input.keepFullHistory &&
!COMPACT_COMMAND_PATTERN.test(input.messageText);COMPACT_COMMAND_PATTERN is /^\/compact(?:\s|$)/i. There is no equivalent check for /clear (or other local commands that reset or do not use the conversation), so useComposerSend.ts dispatches the /compact turn before it.
Suggested fix: skip compact-before-send when the message is /clear (and probably any local slash command that does not send the conversation to the model). Also hide or disable the "Compact" chip while the composer holds /clear.
Version or commit
T3 Code (Beta) desktop 0.1.6. Code path confirmed unchanged on main @ 8ab024f.
Environment
macOS 27 (Apple Silicon), desktop app with local server, Claude Code 2.1.316, provider claudeAgent with claude-opus-5-5.
Workaround
Turn off the "Compact" chip before sending /clear, set "Compact idle threads" to "Never", or start a new thread instead of /clear.
Related
- Idle compaction compacts a Claude thread after /clear, using the pre-clear context size and cache expiry #30097 - idle (background) compaction still runs after
/clear, using pre-clear usage. Same family, different trigger: this one is the foreground compact-before-send on the/clearmessage itself. - [Bug]: Claude thread resumes the pre-/clear session, so replies go to the old conversation #24152 - Claude thread resumes the pre-
/clearsession. - Context window meter keeps pre-/clear token count in Claude threads #29951 - context meter keeps the pre-
/cleartoken count (which likely keeps the Compact chip showing after a clear). - [Feature]: Make stale Claude resume-compaction token threshold configurable #19823, "Before the cache expires" still compacts on return once the cache has expired #28505 - compact-before-send threshold and behavior.
Activity
Sharad-Patel1 commentedon Nov 16, 2026
Note
Generated by claude-opus-5-5
RESPONDING ON BEHALF OF SHARAD
This can be closed: #30325 (99e361e) fixed this on
main, and it shipped in v0.1.8./clearis now T3's own command. Sent on its own or picked from the slash menu, it arms a fresh session and sends nothing, becauseuseComposerSend.tsreturns beforeplanComposerTurnruns. There is no/clearturn left to compact first. The message after it is a fresh-context turn, whichplanComposerTurnnever compacts.The attached script plans the issue's case,
/clearon a stale thread with 345K tokens, on the commit before #30325, and getscompactBeforeSend: true. On currentmain,useComposerSendintercepts a lone/clearbefore planning any turn, and the next message planscompactBeforeSend: false.I also ran it in the real app with the free Replay provider, in a thread with one finished turn, typing
/clearand pressing Enter. Before #30325,/clearwent out as an ordinary message and started a turn. On a stale Claude thread, that send is the one that compacted first. Onmainthe slash menu offers T3's/clear, nothing is sent, and the composer says the next message starts a fresh session. A Replay thread can't be a stale Claude thread, so the compaction step itself is covered by the script rather than the recording.e139768a7e)main(e5b6c96a46)To reproduce, run
bash prove-issue-31092.shfrom a clean t3code checkout aftervp i.main16695c8: prove-issue-31092.out.txtResult
viktorce commentedon Nov 19, 2026
As noted above, #30325 fixed the compaction half. The chip still shows. On
mainas of 475ae52, on a cold Claude thread that offers to compact, pressing Enter on/clearempties the composer and says the next message starts a fresh session, but the Compact chip stays, and Send's tooltip still offers to summarize the history first. That next message never compacts.In the web app at phone width, with a message typed after
/clear, the first tap on the collapsed composer's send button opens the composer to offer the compaction instead of sending.#39133 hides the offer after
/clearuntil the next message is sent, and brings it back if you keep the current session. Mobile already hides it once/clearis armed, so only web needed the change. It doesn't cover the moment this issue names, while/clearis still typed in the composer. The chip shows then too, on web and mobile. Pressing Enter there compacts nothing, so the offer misleads for that moment but costs nothing.#31100 auto-closes this issue on merge, and its body leaves the chip as a follow-up, so the chip half would be left untracked. Could this issue stay open for the chip if #31100 merges, or should I file the chip separately?
/clearDemo data in dark mode, rendered in a browser test on 8cf97b5. The compaction offer code they show is unchanged on 475ae52, where the new browser test in #39133 fails with the chip still showing.