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:
@@ -197,11 +197,13 @@ export async function executeBashWithOperations(
|
||||
let tempFileStream: WriteStream | undefined;
|
||||
let totalBytes = 0;
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
const onData = (data: Buffer) => {
|
||||
totalBytes += data.length;
|
||||
|
||||
// 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
|
||||
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
||||
|
||||
Reference in New Issue
Block a user