Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): /compact with instructions no longer runs a bare compaction first #20236

Closedfixfon(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/20236/headopened View on GitHub

With 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.

CaseCommands 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.

Baseline precondition: Compact chip enabled with instructed command entered

Reviewed head: one instructed compact command completed.

Reviewed head: one instructed compact command completed

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

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

    2. Approvability

      Verdict: Approved at 48664ff

      Macroscope's review found this PR approvable — This is a small, self-contained web bug fix that prevents duplicate compaction for /compact commands 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.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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.ts
      • apps/web/src/components/ChatView.logic.ts
      • apps/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

      ChatView now uses shouldCompactBeforeSend to decide whether to queue compaction before sending a message. The helper excludes /compact commands 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.ts
      shouldCompactBeforeSend checks the resume-compaction tokens, full-history setting, and message text. ChatView uses the helper, and tests cover ordinary text, /compactfoo, /compact, and mixed-case /Compact followed 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: Passed 4
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title clearly and concisely describes the primary fix: preventing a bare automatic compaction before /compact commands with instructions.
      Description checkPassedThe 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
      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge assignedjuliusmarminge

    5. 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.

    6. juliusmarminge added labelsland

    7. juliusmarminge added labelspr:in-progress

    8. Taking over this one

    9. juliusmarminge removed labelspr:in-progress

    10. 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.

    11. juliusmarminge closed this

Sign in to join this conversation.