You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up from the #2192 paste-verification fix (PR for fix/tui-paste-marker-verification). That PR makes isPasteConfirmed treat the TUI's paste-commit marker as authoritative: countPasteMarkers(buffer) > promptMarkerCount. promptMarkerCount is subtracted so the prompt's own echoed [Pasted text #N] literals aren't mistaken for the TUI's commit marker.
The remaining edge
That subtraction is correct for the inline (uncollapsed) paste path, but wrong for the collapsed path that the PR otherwise fixes:
Claude collapses the multi-line paste into its own single [Pasted text #M] chip and hides the body — including the prompt's embedded marker literals. So the buffer carries only Claude's 1 chip while promptMarkerCount ≥ 1 (counted from the prompt text).
countPasteMarkers(buffer)=1 > promptMarkerCount=1 → false, and the hidden body defeats the verifyPasteRendered text fallback too → paste declared swallowed, retried 3×, agent dies paste-not-rendered despite the paste landing.
The common case (0-marker prompt) is correct: collapse yields 1 > 0 → confirmed. Only prompts that embed marker literals hit this.
The code comment in tuiHandshake.js (isPasteConfirmed) claims such a transcript paste "simply falls back to the timer, which is safe" — but with the body hidden the fallback text check also fails, so it fails the agent rather than being safe. Fix the comment as part of the fix.
Possible mitigations
When the buffer shows Claude's collapsed-chip shape (a marker present but body absent), treat any marker ≥ 1 as delivery regardless of promptMarkerCount — a collapsed chip is the TUI's own commit by construction.
Or gate the promptMarkerCount subtraction to the markerless/uncollapsed path only.
Both need care to avoid re-introducing the echoed-marker false-positive the subtraction was guarding against. Add a regression test with a self-marker-containing multi-line prompt transcript.
Severity
Low / narrow — only self-marker-containing multi-line prompts. Deferred out of the original fix (which unblocks the 100%-reproduction common case) on reviewer recommendation.
Context
Follow-up from the #2192 paste-verification fix (PR for
fix/tui-paste-marker-verification). That PR makesisPasteConfirmedtreat the TUI's paste-commit marker as authoritative:countPasteMarkers(buffer) > promptMarkerCount.promptMarkerCountis subtracted so the prompt's own echoed[Pasted text #N]literals aren't mistaken for the TUI's commit marker.The remaining edge
That subtraction is correct for the inline (uncollapsed) paste path, but wrong for the collapsed path that the PR otherwise fixes:
claude-code-tuiCoS task whose prompt is multi-line AND literally contains one or more[Pasted text #N …]substrings (e.g. a TUI-transcript-analysis task — the domain TUI agent prompt-submit handshake: dead paste-marker path + false-success on unsubmitted prompt #1229'spromptMarkerCountwas added for).[Pasted text #M]chip and hides the body — including the prompt's embedded marker literals. So the buffer carries only Claude's 1 chip whilepromptMarkerCount ≥ 1(counted from the prompt text).countPasteMarkers(buffer)=1 > promptMarkerCount=1→false, and the hidden body defeats theverifyPasteRenderedtext fallback too → paste declared swallowed, retried 3×, agent diespaste-not-rendereddespite the paste landing.The common case (0-marker prompt) is correct: collapse yields
1 > 0→ confirmed. Only prompts that embed marker literals hit this.The code comment in
tuiHandshake.js(isPasteConfirmed) claims such a transcript paste "simply falls back to the timer, which is safe" — but with the body hidden the fallback text check also fails, so it fails the agent rather than being safe. Fix the comment as part of the fix.Possible mitigations
≥ 1as delivery regardless ofpromptMarkerCount— a collapsed chip is the TUI's own commit by construction.promptMarkerCountsubtraction to the markerless/uncollapsed path only.Both need care to avoid re-introducing the echoed-marker false-positive the subtraction was guarding against. Add a regression test with a self-marker-containing multi-line prompt transcript.
Severity
Low / narrow — only self-marker-containing multi-line prompts. Deferred out of the original fix (which unblocks the 100%-reproduction common case) on reviewer recommendation.