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
Steps to reproduce
- Open a Claude thread that shows the Compact {tokens} chip next to the send button (≥100K tokens, prompt cache expired).
- Leave the chip on. Type
/compact Keep the interface decisions, drop the debugging outputand press Enter.
Expected behavior
A single compaction that uses the typed instructions. That's what a bare /compact already does: compact-before-send skips a draft that is itself /compact.
Actual behavior
The client dispatches two turns about 15 ms apart:
- a bare
/compactfrom compact-before-send, then - the typed
/compact <instructions>, queued behind it.
The first compaction summarizes the full history without the instructions. The second one then runs the instructions against a summary that's already been made. So the instructions can't keep anything the first pass dropped, and the user pays for two compactions.
The cause is that the skip check in ChatView.tsx only matches the exact text /compact:
https://github.com/pingdotgg/t3code/blob/v0.1.0/apps/web/src/components/ChatView.tsx#L9149-L9152
const compactBeforeSend =
resumeCompactionTokens !== null &&
!keepFullHistory &&
messageTextForSend.toLowerCase() !== "/compact";/compact <instructions> doesn't equal "/compact", so it still gets a bare /compact placed in front of it (L9747-L9753). The check is the same on main @ cfafb4b (line 8879).
Observed three times in one day. In T3's event log, both turns of each pair are separate message.dispatch commands from the web client. Token counts are from Claude Code's compaction records:
| Gap between the two dispatches | Compaction 1 (bare) | Compaction 2 (with instructions) |
|---|---|---|
| 15 ms | 130,532 → 12,896 tokens | 12,998 → 17,156 tokens |
| 18 ms | 201,213 → 16,089 tokens | 16,191 → 20,362 tokens |
| 13 ms | 122,302 → 9,672 tokens | 9,774 → 8,215 tokens |
On the same day, 12 other /compact <instructions> sends ran a single compaction as expected. In each of those, the chip wasn't on (the thread was under the token threshold or its cache was still warm).
Impact
Minor bug or occasional failure
Version or commit
0.1.0 (81493ef); the check is unchanged on main @ cfafb4b
Environment
macOS, T3 Code (Beta) desktop, Claude provider
Workaround
Click the chip to switch it to Full before sending /compact <instructions>.
Suggested fix
Skip compact-before-send for any draft that is a /compact command, not only the exact text /compact. For example, use /^\/compact(\s|$)/i.test(messageTextForSend.trim()), plus a test for /compact <args> with the chip on.
Related, but not the same: #17467 / discussion #17170 (whether the chip should default to on), and discussion #19939 (routing /compact <text> through the server's compactThread).
Activity
juliusmarminge commentedon Oct 16, 2026
Note
Grok responding on behalf of Julius.
Confirmed on main: the compact-before-send skip in
apps/web/src/components/ChatView.tsxonly matches the exact text/compact(messageTextForSend.toLowerCase() !== "/compact"). So with the Compact chip on,/compact <instructions>still gets a bare/compactqueued in front of it. The first compaction then runs without your instructions.Until there's a fix, switch the chip to Full before sending
/compact <instructions>.Not a duplicate. #19643 (a setting for the chip's default) and discussion #19939 (routing
/compact <text>through the server) are related, but neither changes this check.A fix would skip compact-before-send for any
/compactcommand, with or without arguments, and add a test for/compact <args>with the chip on.juliusmarminge commentedon Oct 21, 2026
Reproduced on main 70e5e384da in the Linux web dev app with Claude Sonnet 5.5 (CLI 2.1.303). After a real Claude turn, I seeded the client usage snapshot to 250K tokens with an expired cache to expose the Compact chip; native history was unchanged. Sending the exact reported command with that chip enabled persisted a bare
/compact, then the instructed command 209 ms later.Persisted-message transcript. No duplicate found among 950 open issues. Desktop was not exercised.
juliusmarminge commentedon Oct 22, 2026
Draft fix: #23172, head 1723431e82. The focused 49 tests, changed-file lint, and web typecheck pass. A real Claude run sent one instructed command and compacted successfully on the earlier implementation revision. The PR lists missing recordings, final-head capture, and unverified Electron coverage; proof remains incomplete.
pahan35 commentedon Oct 27, 2026
@juliusmarminge, since #24008 (comment) is merged, should we close this issue?
t3dotgg commentedon Oct 31, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Closing: this is covered by #24008, which landed. Reopen if an important part is still missing.