mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix(qa-lab): preserve boundary emoji in gateway startup diagnostics (#104840)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
co-authored by
Peter Steinberger
parent
523c07d20e
commit
afd0fe32c2
@@ -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", () => {
|
||||
|
||||
@@ -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)}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user