Repository navigation
fix(bash): preserve UTF-8 across output chunk boundaries - #5067
Merged
Merged
Conversation
ikenyal
marked this pull request as ready for review
October 11, 2026 23:04
yonib05
approved these changes
Nov 10, 2026
arronbailiss
added a commit
to arronbailiss/harness-sdk
that referenced
this pull request
Nov 21, 2026
…ds-agents#5067) The bash tool collects each command's output bytes and decodes them once, so a character split between pipe chunks is already kept whole and decoding state never leaks into the next command. The ported case pins that on stdout and stderr.
arronbailiss
added a commit
to arronbailiss/harness-sdk
that referenced
this pull request
Nov 23, 2026
…ds-agents#5067) The bash tool collects each command's output bytes and decodes them once, so a character split between pipe chunks is already kept whole and decoding state never leaks into the next command. The ported case pins that on stdout and stderr.
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.
Human Overview
I wanted the TypeScript bash tool to preserve non-ASCII UTF-8 text, including Japanese and emoji, when command output arrives in separate chunks. This change keeps decoding state for each output stream without changing how commands or sessions are managed.
Description
Non-ASCII bash output can be silently corrupted when a UTF-8 character crosses stdout or stderr chunk boundaries. Decoding is scoped to each stream and command so incomplete trailing bytes cannot affect a later command.
Related Issues
Related to #4461: addresses the TypeScript bash-tool path in Additional Context only. The Python sandbox fixes are separate; this PR does not close the issue.
Documentation PR
No site documentation changes or new examples are needed for this internal decoding fix.
Type of Change
Bug fix
Testing
Ran TypeScript build, lint, formatting/type checks, browser-bundle check, and Node unit tests with coverage (5,026 passed). A real bash invocation check covered split stdout/stderr, incomplete and invalid UTF-8, persistent variables, restart, and timeout recovery. No AWS or model calls. Provider-backed integration tests, browser tests, package smoke tests, and OS/version matrices were not run. Existing dependency audit findings are disclosed below.
hatch run prepare(not applicable: TypeScript-only change; npm checks above were run)Additional Details
Existing dependency advisories and validation scope
The repository's
pre-pushscript passed the TypeScript code checks and Node coverage suite. Its only remaining failed step wasnpm audit --audit-level=high: 5 existing dependency advisories (2 moderate, 3 high), also reported by installation from the unchanged main lockfile. The high-severity entries are@modelcontextprotocol/client,@modelcontextprotocol/sdk, andnanoid. No dependency or lockfile changes are included.The regression test fails on the unchanged decoding implementation with replacement characters in place of the original text. The real bash check passed nine assertions without invoking a model. The complexity report was
size/xsandcomplexity/low(no increase in touched functions).Prepared with coding-agent assistance; the contributor approved the Human Overview and submission.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.