fix(chat): filter local slash-command echoes so /clear no longer strands the composer in working #47
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab!47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/45"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
After a
/clear(or/rewind) in the embedded chat, the composer got stuck showing a pulsing Interrupt with no Send, and tapping Interrupt did nothing. Issue #34's transcript-rotation following works (the chat empties correctly), but the freshly-rotated run then read asworkingforever.Root cause: Claude Code writes a local slash-command invocation to the fresh transcript as a
usermessage whose content is a<command-name>…/<command-message>…echo carrying noisMetaflag. The transcript parser emitted it as a normal user turn;deriveStatemaps a trailinguser:text→working. Because/clearnever invokes the model, nothing follows the echo, so the run stayedworkingindefinitely and the interrupt POST fired against an idle prompt (never flipping back).Fix (purely upstream filtering): extend the existing non-conversational text filter in
foldTranscript(which already dropsisMetauser text) to also skip a slash-command echo — trimmed content beginning with<command-name>or<command-message>— and local-command output (<local-command-stdout>), via a newisLocalCommandEchohelper. Skipped text emits no bubble and never setslastKey, so a/cleartranscript has no trailing turn and reduces to the idle default. A genuine plain-text reply is unchanged — it still derivesworking, preserving the Send→Interrupt morph (ADR-0022). The reducer's load-bearing "trailing user turn → working" rule is untouched.Acceptance criteria
working(added at the transcript-parse state-edge seam inchat_test.go, covering all three prefixes).<command-…>tags) — asserted in the dedicated test and in the compat fixture leak-guard.<local-command-stdout>output is likewise treated as non-conversational.compat.md§5.Out of scope (untouched)
The genuine mid-turn interrupt no-op (#38), transcript-rotation detection (stays by-effect), and the workflow false-idle case (#39). No per-command special-casing (some commands like
/triagedo invoke the model; the brief pre-token window reading idle/prior-state self-corrects within one poll).Testing
go build ./...,go vet,gofmtclean; affected packages (internal/provider/claudecode,internal/compat) and the full suite pass.internal/tmuxxintegration tests fail on this host (they need a live tmux server the environment can't sustain) — unrelated to this change; zero tmuxx files touched.<command-message>-prefix test case and a stale "Four coupled facts" count in §5) are addressed in this PR.Closes #45