fix(qa-lab): preserve boundary emoji in gateway startup diagnostics (#104840)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
xingzhou
2026-07-16 18:26:26 -07:00
committed by GitHub
co-authored by Peter Steinberger
parent 523c07d20e
commit afd0fe32c2
2 changed files with 17 additions and 1 deletions
@@ -206,6 +206,18 @@ describe("formatQaGatewayProcessBoundaryStartupFailure", () => {
expect(message).not.toContain("s".repeat(100));
expect(message).not.toContain(prefix);
});
it("preserves complete Unicode code points at the retained log-tail boundary", () => {
const message = testing.formatQaGatewayProcessBoundaryStartupFailure(
new Error("launcher exited before identity"),
`P😀${"z".repeat(8_191)}`,
);
expect(message).not.toMatch(
/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u,
);
expect(Buffer.from(message, "utf8").toString("utf8")).not.toContain("");
});
});
describe("Gateway child fixture helpers", () => {
+5 -1
View File
@@ -18,6 +18,7 @@ import {
uniqueStrings,
} from "openclaw/plugin-sdk/string-coerce-runtime";
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
import {
createQaBundledPluginsDir,
resolveQaBundledPluginSourceDir,
@@ -493,7 +494,10 @@ function monitorQaGatewayChildFailure(child: ChildProcess, output: { push(chunk:
const QA_GATEWAY_PROCESS_BOUNDARY_LOG_TAIL_CHARS = 8_192;
function formatQaGatewayProcessBoundaryStartupFailure(error: unknown, logs: string) {
const logTail = redactQaGatewayDebugText(logs).slice(-QA_GATEWAY_PROCESS_BOUNDARY_LOG_TAIL_CHARS);
const logTail = sliceUtf16Safe(
redactQaGatewayDebugText(logs),
-QA_GATEWAY_PROCESS_BOUNDARY_LOG_TAIL_CHARS,
);
return `${formatErrorMessage(error)}${formatQaGatewayLogsForError(logTail)}`;
}