Skip to content

Commit 595ad5c

Browse files
committed
fix(qa-lab): use truncateUtf16Safe for CLI error message truncation
Replace .slice(0, 240) with truncateUtf16Safe() to prevent UTF-16 surrogate pair corruption in QA CLI error messages.
1 parent e595a8c commit 595ad5c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

extensions/qa-lab/src/suite-runtime-agent-process.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { setTimeout as sleep } from "node:timers/promises";
66
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
77
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
88
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
9+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
910
import {
1011
appendQaChildOutput,
1112
appendQaChildOutputTail,
@@ -212,7 +213,7 @@ function parseQaCliJsonOutput(text: string, args: readonly string[]) {
212213
// Keep looking for the actual payload line.
213214
}
214215
}
215-
throw new Error(`qa cli returned non-JSON stdout: ${cleaned.slice(0, 240)}`);
216+
throw new Error(`qa cli returned non-JSON stdout: ${truncateUtf16Safe(cleaned, 240)}`);
216217
}
217218
}
218219

0 commit comments

Comments
 (0)