CodeWhale icon indicating copy to clipboard operation
CodeWhale copied to clipboard

[Regression v0.8.50] Control sequence leakage into composer — garbage `[` chars, broken Backspace

Open Aerytgophilis opened this issue 6 months ago • 3 comments

Description

This is a regression of closed issue #1915. Terminal control sequence fragments (ANSI CSI / OSC / SGR mouse reports) leak into the composer input field during agent runs, manifesting as repeated [ characters. Backspace behavior breaks — pressing Backspace moves the cursor right instead of deleting characters, making the input field unusable until the garbage is manually cleared.

Reproduction

Observed in v0.8.50 (Windows, codewhale-tui-windows-x64.exe). Not reliably reproducible — occurs during or after long agent sessions with dense streaming output (multi-step tool-call sequences, large file reads).

Steps:

  1. Start a long agent session with sustained output (e.g. multi-file code exploration / debugging).
  2. After the agent finishes streaming, attempt to type in the composer.
  3. Observe [ characters appearing without user input.
  4. Press Backspace — cursor moves right, garbage cannot be deleted normally.

Version Log

codewhale 0.8.50 (0072209d12f2)
codewhale-tui 0.8.50
Platform: Windows 11 (x64)
Terminal: Windows Terminal (ConHost-based)
Model: deepseek-v4-pro

Environment

  • OS: Windows 11
  • CodeWhale version: v0.8.50 (codewhale-tui-windows-x64.exe, binary release)
  • Terminal: Windows Terminal
  • Model: deepseek-v4-pro
  • Proxy: Clash Verge Rev (TUN mode active, GLOBAL selector present in Mihomo kernel)

Regression note

Issue #1915 was closed on 2026-05-23 as fixed. The same symptoms are now observed on the latest stable release (v0.8.50). The SGR mouse report filter mentioned in #1915 does not appear to catch these fragments in the current version.

Related

  • #1915 — original fix (closed 2026-05-23)

Aerytgophilis avatar Jun 02 '26 15:06 Aerytgophilis

Thanks @Aerytgophilis for the report.

This repository is currently observing a maintainer-managed contribution gate in dry-run mode, so this issue is staying open. When enforcement is enabled, issues from contributors who are not listed in .github/APPROVED_CONTRIBUTORS will be closed automatically.

Please read CONTRIBUTING.md for the expected issue shape. A maintainer can grant issue access by commenting /lgtmi on an issue.

github-actions[bot] avatar Jun 02 '26 15:06 github-actions[bot]

Also experiencing keystroke swallowing: typed characters vanish from composer. Likely same root cause as garbage brackets (control sequence fragments clearing input buffer).

Aerytgophilis avatar Jun 02 '26 15:06 Aerytgophilis

Fixed on the v0.8.51 branch (claude/busy-mayer-b66rA, commit fd69f4c).

Root cause: the composer's CSI fragment filter (match_kitty_csi_fragment) only accepted u as a terminator (Kitty keyboard protocol). The chatter that actually leaks during dense streaming is DEC private mode set/reset — bracketed paste \x1b[?2004h/l, mouse capture \x1b[?1000h, focus reporting \x1b[?1004h, synchronized output \x1b[?2026h — all of which end in h/l. With the ESC byte consumed upstream, the leading [ then leaked into the input buffer and corrupted editing (the broken-Backspace symptom is the downstream effect of that corrupted buffer / mode confusion).

Fix: accept h/l as terminators too, but only after a numeric parameter, so ordinary prose like [?help] is preserved (real sequences are always [?<number><letter>; the parameter-less Kitty [?u still matches). Added regression tests for the mode sequences and the false-positive guard.

This is a Windows-Terminal-reported regression of #1915; the logic is unit-tested but if you still see stray [/Backspace issues on Windows after v0.8.51, please reopen with a capture.


Generated by Claude Code

Hmbown avatar Jun 03 '26 01:06 Hmbown