fix(web): /compact with instructions no longer runs a bare compaction first #20236
main fromrefs/pull/20236/head·opened View on GitHubWith the Compact chip enabled on a resumed Claude thread, sending /compact with instructions queued a bare compaction before the instructed command. This could compact twice and lose the benefit of the supplied instructions.
Recognize /compact followed by whitespace as an explicit compaction request, so it bypasses automatic pre-send compaction. Ordinary messages retain their existing behavior.
Validation: 138 focused cases passed, including one retained regression case that fails with the original exact-match predicate. Web typecheck and format passed; scoped lint reported existing warnings. Independent Claude Opus and GPT-6.1 reviews approved the source.
Integrated proof used the actual web composer, orchestration, Claude SDK, and an offline stream-json CLI peer. A completed peer turn was created first, then its context usage was aged to enable the Compact chip. Each case started from the same stopped snapshot and the SDK launched with --resume. The peer reports synthetic compaction: this verifies transport and command sequencing, not real model summarization or authentic Claude transcript restoration. Web was exercised; no native Electron or mobile run is claimed.
| Case | Commands received by the peer |
|---|---|
| Baseline, instructed compact | /compact, then /compact keep the auth refactor notes |
| Reviewed head, instructed compact | /compact keep the auth refactor notes only |
| Reviewed head, ordinary message | /compact, then Continue reviewing the auth refactor notes. |
Baseline precondition: Compact chip enabled with instructed command entered.

Reviewed head: one instructed compact command completed.

Ordinary-message control: automatic compact then queued normal message.

Sanitized command traces: baseline, reviewed head, ordinary-message control. The baseline screenshot shows the pre-send chip precondition; the trace establishes its two-command result.
Original contribution by @fixfon. Maintainer takeover: Claude Opus 5.5 for tests/review, Claude Fable 5.1 for implementation, GPT-6.1 for independent review; Claude Code and Codex harnesses.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
48664ffMacroscope's review found this PR approvable — This is a small, self-contained web bug fix that prevents duplicate compaction for
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules)./compactcommands while preserving existing behavior for other messages. The new predicate is directly unit-tested, and no product defaults, sensitive areas, or static-analysis settings are changed.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:
1c4a476c-6eb9-4a44-92f1-94f7d11a23b0
📥 Commits
-
Reviewing files that changed from the base of the PR and between 48664ffec82254d057dbf2722d632916db3efff7 and de326a83fc9dfd2f89cef3cdb88ce49433ff7761.
📒 Files selected for processing: 3
-
apps/web/src/components/ChatView.logic.test.tsapps/web/src/components/ChatView.logic.tsapps/web/src/components/ChatView.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
📝 Walkthrough
-
ChatViewnow usesshouldCompactBeforeSendto decide whether to queue compaction before sending a message. The helper excludes/compactcommands followed by whitespace or the end of the message, regardless of case.Changes: Compact command handling
Layer / File(s) Summary Pre-send compaction decision
apps/web/src/components/ChatView.logic.ts,apps/web/src/components/ChatView.tsx,apps/web/src/components/ChatView.logic.test.tsshouldCompactBeforeSendchecks the resume-compaction tokens, full-history setting, and message text.ChatViewuses the helper, and tests cover ordinary text,/compactfoo,/compact, and mixed-case/Compactfollowed by instructions.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
de326-
The instructed compact command reaches Claude’s native compaction flow with its instructions, avoiding the extra bare compaction. No concrete merge-blocking risk remains.
Pre-merge checks:
4-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the primary fix: preventing a bare automatic compaction before /compactcommands with instructions.Description check The description clearly covers the problem, implementation, focused verification, screenshots, test limitations, and tool usage. It is mostly complete, but it does not include an explicit Scope and ap… Full details: Description check
-
Explanation
The description clearly covers the problem, implementation, focused verification, screenshots, test limitations, and tool usage. It is mostly complete, but it does not include an explicit Scope and approval section or a direct issue or approval link.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge assignedjuliusmarminge
Taking over this one. I’ll reduce the tests to the useful coverage, update the implementation against current main, and verify it before publishing the changes.
juliusmarminge added labelsland
juliusmarminge added labelspr:in-progress
Taking over this one
juliusmarminge removed labelspr:in-progress
Thanks @fixfon! Your fix landed on main via https://git.cafe/pingdotgg/t3code/pulls/24008 (squash 16aaf5ba7d), which keeps your commits, merges current main and adds the evidence. Closing this one in favour of it.
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes