TUI leaks malformed truecolor escape `\x1b[38;2;NaN;NaN;NaNm` into prompt buffer (shows as `aN;NaNm`) during background-workflow/auto-mode redraw
Summary
A malformed truecolor ANSI escape with NaN color channels — \x1b[38;2;NaN;NaN;NaNm — is being emitted by the TUI, and its unparseable tail leaks into the prompt input buffer as the literal text aN;NaNm. It shows up when returning to a session that has a background Workflow running with auto mode on (i.e. while the status area is periodically redrawing). It's harmless (clear with Ctrl-U) but visually confusing.
Environment
- Claude Code v2.1.195 (latest)
- macOS (Darwin 25.5.0), arm64
- Terminal: appears on session refocus / return-after-idle
- A background
Workflow("Waiting for 1 dynamic workflow to finish") is running and auto mode is on
Symptom
The string injected into the prompt input is always byte-for-byte identical: aN;NaNm. It never varies.
It appears in the prompt text box (not the statusline), e.g.:
> aN;NaNm█
Analysis
aN;NaNm is the tail of a truecolor SGR escape whose three color channels all stringified to NaN:
\x1b[38;2;NaN;NaN;NaNm
The terminal consumes the leading \x1b[38;2;… while attempting to parse the (invalid) sequence, and the unconsumed remainder aN;NaNm (the end of …;NaN;NaNm) ends up in stdin → the prompt buffer.
- Capital
NaN= JavaScriptNumber → string(Python would emit lowercasenan), so the source is Claude Code's own TUI, not a user statusline script. - The string being constant rules out a data-driven value (a cost/percent/time value going NaN would vary). This points to a fixed render path that builds a color from an
undefined/uninitialized value every time — most likely in the background-workflow / auto-mode status redraw.
Repro
- Enable auto mode (Shift+Tab).
- Launch a background
Workflow(e.g. via/workflows) so the status area shows "Waiting for N dynamic workflow(s) to finish". - Switch away from the terminal and return after a short idle period (triggers a redraw).
- Observe
aN;NaNminjected into the prompt input box.
Suspected fix
Guard the truecolor color computation in the workflow/auto-mode status render path so an undefined/NaN color triplet falls back to a default instead of being interpolated into \x1b[38;2;${r};${g};${b}m.