Skip to content

Fix #1452: Piped sync child leaves colorizeStderr mid-line after the send confirm, so the next diagnostic line loses its severity colour - #1461

Open
philcunliffe wants to merge 3 commits into
masterfrom
fix/issue-1452
Open

Fix #1452: Piped sync child leaves colorizeStderr mid-line after the send confirm, so the next diagnostic line loses its severity colour#1461
philcunliffe wants to merge 3 commits into
masterfrom
fix/issue-1452

Conversation

@philcunliffe

Copy link
Copy Markdown
Contributor

Feature or issue

Since PR #1448 the wizard's sync step spawns hyp sync with a piped stderr, which turns off the child's own painting (useColor is false on a pipe), leaving the parent's colorizeStderr as the only painter. That wrap infers the cursor from its own writes, but the child's send confirm ends without a newline and the answer, plus the newline the tty echoes beside it, never passes through the wrap. The wrap therefore still believes it is mid-question when the child's next diagnostic arrives, and paintChunk's line-start gate leaves it plain: hyp sync: nothing was sent - the sink driver is holding every tick reached the terminal red under stdio: 'inherit' and unpainted afterwards. Reverting only the src/ half of this branch reproduces it exactly, with the new wizard test asserting the red hyp sync: prefix and receiving the bare text.

Solution

  • colorizeStderr gains a symbol-keyed hook and style.js exports resyncLineStart(stream), which tells a wrap the terminal is back at a line start. It is a no-op on an unwrapped stream, which is every stream that was not painting anyway.
  • The runSyncChild echo loop tracks whether the chunk it last relayed ended without a newline and resyncs before writing the next one, so the diagnostic that follows an answered confirm is classified again.
  • Verified fail-then-pass: with the two src/ files reverted to their pre-fix content the new wizard test fails on the missing SGR prefix and the style test file fails to load; with the fix restored all 42 tests in the two files pass. Full npm test and npm run typecheck show no new failures (the two hyparquet-pin test failures and the squirreling type error are present on master without this branch).

Code: +37 / -5 lines

Fixes #1452

philcunliffe and others added 3 commits September 6, 2026 06:20
…rizer can trust

The wizard pipes `hyp sync` so it can read the child's words, which turns off
the child's own painting; the parent's colorized stderr is then the only
painter left. The send confirm ends without a newline and its answer is echoed
by the tty, not by that stream, so `paintChunk`'s line-start gate left the next
diagnostic plain.

`colorizeStderr` gains `resyncLineStart`, and the echo calls it on the chunk
that follows an unterminated one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Piped sync child leaves colorizeStderr mid-line after the send confirm, so the next diagnostic line loses its severity colour

1 participant