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
{{ message }}
Repository navigation
Bash output can corrupt UTF-8 when stdout and stderr interleave #36655
The Bash tool can corrupt otherwise valid UTF-8 when stdout and stderr emit at the same time.
ShellTool.run currently calls Stream.decodeText(handle.all), while handle.all is created with Stream.merge(stdout, stderr). This means bytes from two independent pipes are fed through one streaming UTF-8 decoder. If a multibyte character is split across stdout chunks and a stderr chunk arrives in between, the stderr bytes are treated as part of the pending stdout character and replacement characters are emitted.
Each stream is valid when decoded on its own. The corruption only happens because the byte streams are merged before decoding.
I think stdout and stderr should each use their own incremental decoder, with the decoded text events merged afterward. The relative order between separate pipes would still be best-effort, but one stream could no longer corrupt the other stream's decoder state.
I'm happy to submit a fix with regression coverage if this direction makes sense.
Activity
fix(opencode): decode shell streams independently
github-actions commentedon Sep 12, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.