Repository navigation
fix(prompts): write streamed messages to the selected output - #3466
Merged
Merged
Conversation
Use the supplied stream for both writes and the terminal width. Keep stdout as the default destination. Signed-off-by: Sakana <15715093608@163.com>
SaKaNa-Y
marked this pull request as ready for review
November 16, 2026 13:43
fengmk2
reviewed
Nov 16, 2026
A plain Writable and a redirected standard stream have no column count. Skip width-based wrapping on these destinations so chunk boundaries preserve words and leading whitespace. Signed-off-by: Sakana <15715093608@163.com>
Signed-off-by: Sakana <15715093608@163.com>
fengmk2
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A CLI can send logs to stderr and write a JSON result to stdout. When it passes stderr to
stream.message, the message still goes to stdout, so a downstream command cannot parse the result.The renderer uses the selected output's width to wrap text. If the output has no column count, it writes consecutive chunks without adding line breaks between them. This also keeps words together when the caller uses the default stdout and redirects it to a file or pipe.
Evidence
! hello worldto redirected stderr and only{"ok":true}to stdout.['some', 'thing', ' else']to a plain Node.jsWritable. It reproduced the split word before the repair and now receives one line. A separate test checks wrapping at 10 columns and detects stray writes to stdout.Merge Danger
Door: Two-way.
Blast Radius: Streamed prompt messages with an explicit output or a redirected stdout.