Skip to content

fix(chat): kill fake user bubble + stuck thinking state after /compact#102

Merged
itsdestin merged 1 commit into
masterfrom
fix/compact-bubble-and-thinking
May 23, 2026
Merged

fix(chat): kill fake user bubble + stuck thinking state after /compact#102
itsdestin merged 1 commit into
masterfrom
fix/compact-bubble-and-thinking

Conversation

@itsdestin

Copy link
Copy Markdown
Owner

Re-opens #100 — same branch, rebased onto green master now that PR #101 unblocked CI.

Summary

  • Bug Planned Updates Tracker #1: After every `/compact`, a fake user bubble appeared reading "Compacted (ctrl+o to see full summary)" — text the user never typed.
  • Bug Feature/multi session architecture #2: After every `/compact`, chat view got permanently stuck in "thinking" state even though CC was idle.
  • Both collapse to one parser bug — the TS + Kotlin transcript watchers were UNWRAPPING ``, letting CC's dimmed echo of its own `/compact` slash-command reach the reducer as a synthetic user-typed message. That message hit `TRANSCRIPT_USER_MESSAGE`'s "no pending match" branch, which both appended a new user bubble AND set `isThinking: true` with no transcript turn to ever clear it.
  • Fix moves `` and `` from the unwrap regex to the strip-entirely regex in both parsers.
  • UX add: the `compact-summary` transcript event now forwards the actual summary text from the `isCompactSummary` JSONL line. `SystemMarker.tsx` offers a chevron + "view summary" toggle that reveals the CC-produced summary inline — replaces CC's dead "ctrl+o to see full summary" affordance, which never worked inside YouCoded because the chat view consumes that key.
  • Added 3 regression tests against the exact CC v2.1.119 JSONL fixture line; existing 946-test suite + tsc both still green.

Root-cause trace

  1. `/compact` → `COMPACTION_PENDING` action (spinner card + flag set).
  2. CC writes the `isCompactSummary: true` line → `compact-summary` event → `COMPACTION_COMPLETE` → `endTurn()` clears `isThinking` ✓.
  3. CC writes a follow-up user-type line: `[2mCompacted (ctrl+o to see full summary)[22m`.
  4. Old behavior: `stripSystemTags` unwrapped the tag → "Compacted (ctrl+o to see full summary)" → `user-message` event → reducer fell through to "no pending match" path → fake bubble + `isThinking: true` again.
  5. New behavior: `stripSystemTags` strips the tag entirely → empty text → no event → no fake bubble, no thinking flip.

Verified against `~/.claude/projects/.../056880ed-...jsonl:1414`.

Test plan

  • `vitest run src/main/transcript-watcher.test.ts` — all 13 pass (3 new)
  • `vitest run` (full desktop suite) — 946 pass, 0 fail
  • `tsc --noEmit` — clean
  • Visual smoke: `/compact` in a dev session, confirm no fake bubble appears, confirm thinking indicator clears, click the "Compacted" marker → summary expands

🤖 Generated with Claude Code

Both reported bugs collapse to one parser bug. After /compact, CC writes
two consecutive JSONL lines: (1) an isCompactSummary line carrying the
actual summary, and (2) a user-type line whose content is
<local-command-stdout>[2mCompacted (ctrl+o to see full summary)[22m
</local-command-stdout> — CC's dimmed status echo of the local /compact
command. The parser's stripSystemTags was UNWRAPPING that tag (keeping
inner text), so the second line became user-typed text "Compacted
(ctrl+o to see full summary)" that the reducer's TRANSCRIPT_USER_MESSAGE
handler dropped into the "no pending match" branch — appending a fake
user bubble AND setting isThinking:true with no transcript turn to ever
clear it.

Fix: move <local-command-stdout> and <local-command-stderr> from the
unwrap regex to the strip-entirely regex in both the TS and Kotlin
parsers. Locked down by three new regression tests against the exact CC
v2.1.119 JSONL fixture line.

UX add (requested in the same report): the compact-summary transcript
event now carries the summary text from the isCompactSummary line, the
reducer attaches it to the SystemMarker, and SystemMarker.tsx offers a
chevron + "view summary" toggle that reveals the full CC-produced
summary inline. Replaces CC's terminal "ctrl+o to see full summary"
affordance, which never worked inside YouCoded.

Documented as a CC-coupling in docs/cc-dependencies.md so the
review-cc-changes release agent can map future CC changes to this code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@itsdestin itsdestin merged commit c76737c into master May 23, 2026
2 checks passed
@itsdestin itsdestin deleted the fix/compact-bubble-and-thinking branch May 30, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant