fix(coding-agent): UTF-8 corruption in remote bash execution
Applied streaming TextDecoder fix to executeBashWithOperations(), matching the fix in executeBash() from PR #433. Remote execution (SSH, containers) was still using Buffer.toString() which corrupts multi-byte UTF-8 sequences split across chunk boundaries. fixes #608
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Bash output expanded hint now says "(ctrl+o to collapse)" ([#610](https://github.com/badlogic/pi-mono/pull/610) by [@tallshort](https://github.com/tallshort))
|
- Bash output expanded hint now says "(ctrl+o to collapse)" ([#610](https://github.com/badlogic/pi-mono/pull/610) by [@tallshort](https://github.com/tallshort))
|
||||||
|
- Fixed UTF-8 text corruption in remote bash execution (SSH, containers) by using streaming TextDecoder ([#608](https://github.com/badlogic/pi-mono/issues/608))
|
||||||
|
|
||||||
## [0.42.3] - 2026-01-10
|
## [0.42.3] - 2026-01-10
|
||||||
|
|
||||||
|
|||||||
@@ -197,11 +197,13 @@ export async function executeBashWithOperations(
|
|||||||
let tempFileStream: WriteStream | undefined;
|
let tempFileStream: WriteStream | undefined;
|
||||||
let totalBytes = 0;
|
let totalBytes = 0;
|
||||||
|
|
||||||
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
const onData = (data: Buffer) => {
|
const onData = (data: Buffer) => {
|
||||||
totalBytes += data.length;
|
totalBytes += data.length;
|
||||||
|
|
||||||
// Sanitize: strip ANSI, replace binary garbage, normalize newlines
|
// Sanitize: strip ANSI, replace binary garbage, normalize newlines
|
||||||
const text = sanitizeBinaryOutput(stripAnsi(data.toString("utf-8"))).replace(/\r/g, "");
|
const text = sanitizeBinaryOutput(stripAnsi(decoder.decode(data, { stream: true }))).replace(/\r/g, "");
|
||||||
|
|
||||||
// Start writing to temp file if exceeds threshold
|
// Start writing to temp file if exceeds threshold
|
||||||
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user