# fix\(web\): instructed compact runs without a bare compaction first · PR \#24008 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/24008)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: merged

Source repository: pingdotgg/t3code

Source branch: takeover/20236-compact-instructions-r2

Target branch: main

Head commit: f21775904c4e1c647a0b4279f752013208694bb2

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/24008)

[Commits](https://git.cafe/pingdotgg/t3code/pull/24008/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/24008/diffs?format=markdown)

## Description

---

Fixes duplicate compaction when a resumed Claude thread sends `/compact` with instructions while the Compact chip is enabled.

<details><summary>Original description by @fixfon</summary>

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.

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

![Baseline precondition: Compact chip enabled with instructed command entered](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/441e01ebb6e3e6d4/browser-screenshot-localhost-mvejvk8j-ba2b8203.png)

Reviewed head: one instructed compact command completed.

![Reviewed head: one instructed compact command completed](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/8c6b034ac395b25d/browser-screenshot-localhost-mvejyig4-e0c6426d.png)

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

![Ordinary-message control: automatic compact then queued normal message](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/794088b10f4c2136/browser-screenshot-localhost-mvejzafz-6d58e461.png)

Sanitized command traces: [baseline](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/05c26314f9f21da9/20236-baseline-commands.json), [reviewed head](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/143e876aadb42703/20236-head-commands.json), [ordinary-message control](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/dcc5505f4acca9d8/20236-control-commands.json). 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.


</details>

## Takeover

Retains @fixfon’s commits from [#20236](https://github.com/pingdotgg/t3code/pull/20236). Main moved submission into `planComposerTurn`; the same command-boundary guard is ported there. The existing dispatch regression test is expanded, and the single-caller helper is removed.

## Evidence

Final head [f2177590](https://github.com/pingdotgg/t3code/commit/f21775904c4e1c647a0b4279f752013208694bb2), merged main [4812dcad](https://github.com/pingdotgg/t3code/commit/4812dcad02a86874533540e6a0c4b7f5eaea297a). **Proof incomplete:** all24 interaction recordings exist, but six wide settled-image comparisons require correction of an unrelated source-control card difference.

[Fixture matrix](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/6c690f778d80f687/matrix.md). A1: instructed compact; C1: ordinary message; C2: bare uppercase; C3: command prefix; C4: Full then Compact; C5: Never then on-return.

| Cell (CSS width/theme) | Before recording<br>4812dcad | After recording<br>f2177590 | Diff0 | DiffT16 | Proof status |
| --- | --- | --- | --- | --- | --- |
|A1-1440-dark|[A1-1440-dark-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/9b255e7f4705e2b1/A1-1440-dark-before.mp4)|[A1-1440-dark-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/7ca0bc4e18fe530f/A1-1440-dark-after.mp4)|[A1-1440-dark-diff0.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/d8e1166a06bbb309/A1-1440-dark-diff0.png)|[A1-1440-dark-diffT.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/99f63b92de3b454f/A1-1440-dark-diffT.png)|Unverified: unmatched details card|
|A1-1440-light|[A1-1440-light-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/d5633d5b0ee8c83a/A1-1440-light-before.mp4)|[A1-1440-light-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/b4a46a919b7b6264/A1-1440-light-after.mp4)|[A1-1440-light-diff0.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/1773556731890a42/A1-1440-light-diff0.png)|[A1-1440-light-diffT.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/5792de144b0327bf/A1-1440-light-diffT.png)|Unverified: unmatched details card|
|A1-390-dark|[A1-390-dark-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e639fbb030e894af/A1-390-dark-before.mp4)|[A1-390-dark-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e762ee9e7bb31b33/A1-390-dark-after.mp4)|[A1-390-dark-diff0.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/379d393e93cd8ba3/A1-390-dark-diff0.png)|[A1-390-dark-diffT.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/2bd5afce65547d1f/A1-390-dark-diffT.png)|Interaction captured; audit below|
|A1-390-light|[A1-390-light-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/29d7dc7596e4f5d5/A1-390-light-before.mp4)|[A1-390-light-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/9c1ddf28aeaeb837/A1-390-light-after.mp4)|[A1-390-light-diff0.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/53cfbe2b7304bef9/A1-390-light-diff0.png)|[A1-390-light-diffT.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/9879943f7f8e66a7/A1-390-light-diffT.png)|Interaction captured; audit below|
|C1-1440-dark|[C1-1440-dark-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/60b5d6cba95e5dd3/C1-1440-dark-before.mp4)|[C1-1440-dark-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/14b11feb363f7e5c/C1-1440-dark-after.mp4)|Upload pending|Upload pending|Unverified: unmatched details card|
|C1-1440-light|[C1-1440-light-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/07e135f2491149c7/C1-1440-light-before.mp4)|Upload pending|Upload pending|Upload pending|Unverified: unmatched details card|
|C1-390-dark|[C1-390-dark-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/4fa1d96dd288592b/C1-390-dark-before.mp4)|[C1-390-dark-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/0d4f35a9951f658c/C1-390-dark-after.mp4)|[C1-390-dark-diff0.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e339b68b511f73c5/C1-390-dark-diff0.png)|Upload pending|Interaction captured; audit below|
|C1-390-light|[C1-390-light-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/3311706a679bbdcc/C1-390-light-before.mp4)|Upload pending|Upload pending|Upload pending|Interaction captured; audit below|
|C2-1440-light|[C2-1440-light-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/07d5503bc9b46eef/C2-1440-light-before.mp4)|Upload pending|Upload pending|Upload pending|Unverified: unmatched details card|
|C3-390-dark|[C3-390-dark-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/6520e521e4d10211/C3-390-dark-before.mp4)|Upload pending|Upload pending|Upload pending|Interaction captured; audit below|

|C4-390-light|[C4-390-light-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/5889d1302330c176/C4-390-light-before.mp4)|[C4-390-light-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/1accc6e450ebe0af/C4-390-light-after.mp4)|[C4-390-light-diff0.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a4f4d332df28155d/C4-390-light-diff0.png)|[C4-390-light-diffT.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/d78bedbbc5282605/C4-390-light-diffT.png)|Interaction captured; audit below|
|C5-1440-dark|[C5-1440-dark-before.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/c94b6d2f7382ad3c/C5-1440-dark-before.mp4)|[C5-1440-dark-after.mp4](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/d853b1946a7605ae/C5-1440-dark-after.mp4)|[C5-1440-dark-diff0.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/057e8be2cc69355c/C5-1440-dark-diff0.png)|[C5-1440-dark-diffT.png](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/3a047d6740c487f1/C5-1440-dark-diffT.png)|Unverified: unmatched details card|

Environment: T3 browser preview, responsive web, CSS1440×900 or390×900, light/dark, DPR2, default font scaling. Whole-surface wide video2880×1800 and preview still1280×800; narrow780×1800. Same immutable synthetic seed and frozen browser clock. Independent stills≥550ms apart settle exactly. Unmasked diffs highlight threshold0 and max-channel delta>16.

What else changed: A1 removes the bare predecessor and its timeline entry. Wide captures also show source-control card status from temporary baseline file swaps (Commit & push/+0−0 versus Commit/+20−9). That unrelated difference is not accepted as matched comparison proof; closed-card retakes remain incomplete. The continuous videos retain their original pixels and prove interactions with this difference disclosed. Offline peer proves sequencing and resumed transport, not real Claude summarization, restoration, billing, or parser acceptance.

<details><summary>Verification log</summary>

Tests45→45 in `apps/web/src/components/ChatView.logic.test.ts`; current base regression1 failed/44 passed, final45 passed. Scoped lint, format and web typecheck passed; final CI Build and Typecheck successful. [Final tests](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/9952b9bad11bd7df/final-f217-tests.log).

Three fresh dual-review rounds returned MERGE/MERGE, no confirmed source defects; [final merged-head review](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/76d855824c164ce7/reviews-r3.md). Fixed anchored regex has constant work and no backtracking risk. CI29/29 successful on final f2177590; GitCafe reports mergeable/current conflict check, no actionable bot findings.

Final proof audit: **INSUFFICIENT**; [Final independent audit and row verdicts](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/3eff83de75c3c78b/audit-report.md). Independent A1 rebuild sent only the instructed command and reached idle, but its two stills differed by509 pixels and failed temporal settling, so its pixel comparison is unverified. Capture index/bundle: [Public artifact index](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/efea767beb4899d9/public-index.md) · [Reproducible fixture/evidence bundle](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/990c0012863d4f22/final-capture-r5.tar.gz). Earlier c218a805 SUFFICIENT audit does not certify this final merge head.

Unverified web cells: A1-1440-light, A1-1440-dark, C1-1440-light, C1-1440-dark, C2-1440-light, C5-1440-dark need matched settled-image pairs and regenerated diffs. No Electron/mobile native capture claimed; changed surface is web. Real Claude summaries/restoration and remote/tunnel behavior are outside the sequencing claim.

Models/harnesses: Claude Opus5.5 through Claude Code for tests, implementation, reviewerB; GPT-6.1-sol through Codex for reviewerA, capture and proof audit.

</details>
### Completed evidence supplement — final pinned head

**VERDICT: SUFFICIENT.** This append supersedes the historical “Proof incomplete”, “INSUFFICIENT”, “Unverified” wide-cell statuses, pending links, rejected old wide diffs and failed independent rebuild above, plus the index’s pending independent-audit status. Historical records remain unchanged; the old mismatched wide diffs remain rejected and are replaced by the matched pairs below.

[Independent audit and all row verdicts](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/bf81bd5ec5cb6d1d/audit-report.md) · [Audit manifest](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/887d3434ddd0ee2c/audit-manifest.json) · [Independent rebuild proof](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/c852eef06b105310/independent-proof.tar.gz).

[Consolidated evidence index: all stills, diffs and recordings](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/53acd20fa0a18eaf/consolidated-index.md) · [Consolidated matrix](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/621495f9e90aac78/consolidated-matrix.md) · [Scripts, fixtures and captures bundle](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/3e71816cdc797fa6/wide-evidence-supplement.tar.gz).

**6/6 missing wide pairs complete; 6/6 accepted narrow cells and all 24 recordings reused unchanged; all 12 visual cells audited sufficient.** L1/S1 retain prior accepted records, without fresh tests or source review. No unverified rows remain within the synthetic responsive-web sequencing scope. The auditor played all 24 recordings completely and checked their narrated steps against sanitized command/resume traces. Historical wide recordings prove sequencing only and retain their disclosed card mismatch; replacement stills establish matched visual parity. C5 stills show Never opt-out; reused recordings show restoration to When you return and the subsequent automatic-predecessor send.

The six new wide pairs run the entire base [4812dca](https://git.cafe/pingdotgg/t3code/commit/4812dcad02a86874533540e6a0c4b7f5eaea297a) (merge-base of final head) versus the entire exact head [f217759](https://git.cafe/pingdotgg/t3code/commit/f21775904c4e1c647a0b4279f752013208694bb2). Reused 390px cells and recordings retain the disclosed changed-file baseline substitution method; they are not full-base runtime evidence.

New capture environment: Chromium 148.0.7778.96, Linux x86_64, 1440×900 CSS, DPR2, 2880×1800 PNG, desktop emulation, normal font scaling, en-US/UTC, reduced motion, frozen browser Date 2026-10-23T12:00Z, fonts loaded and network idle, matching scroll/sidebar/details states. All new sides settle exactly; old 390px cells are unchanged. Independent A1 wide-light head frames 1143ms apart have zero temporal differing pixels; rebuild versus delivered has 0 pixels >0, 0 pixels >16, maximum channel 0. No masks or pixel-difference waivers.

A1 removes the duplicate bare command/boundary, moves the instructed row up and changes the minimap only to reflect the shorter timeline. The other four new wide control pairs have zero differing pixels at threshold zero. No unrelated visual differences were found.

![Before: bare compaction followed by instructed compaction](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/37c0055c2f5f5902/A1-1440-light-before-1.png)
![After: instructed compaction without the preceding bare compaction](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/694b31d6bfdf78e6/A1-1440-light-after-1.png)

Scope: offline synthetic peer proves actual web composer/server/Claude SDK command sequencing and resumed transport. It does not prove actual Claude summarization, transcript restoration, billing, parser internals, native desktop/mobile, remote or tunnel behavior; fixture notices, token counts and responses are synthetic. No new source review or tests are claimed by this evidence update.

Models/harness: GPT-6.1-sol through Codex for capture and independent proof audit.

