Skip to content

Commit afedb38

Browse files
committed
fix(codex-supervisor): use truncateUtf16Safe for stderr tail truncation
StdioCodexJsonRpcConnection includes stderr output in the transport-closed error message with a naive .slice(0, 1200) which can split surrogate pairs. Replace with truncateUtf16Safe().
1 parent 9566ade commit afedb38

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

extensions/codex-supervisor/src/json-rpc-client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as net from "node:net";
88
import * as os from "node:os";
99
import * as path from "node:path";
1010
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
11+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
1112
import WebSocket from "ws";
1213
import type { CodexJsonRpcConnection, CodexSupervisorEndpoint } from "./types.js";
1314

@@ -199,7 +200,7 @@ class StdioCodexJsonRpcConnection extends BaseCodexJsonRpcConnection {
199200
this.proc.once("close", () =>
200201
this.fail(
201202
new Error(
202-
`Codex app-server stdio transport closed. stderr_tail=${this.stderrTail.join("\n").slice(0, 1200)}`,
203+
`Codex app-server stdio transport closed. stderr_tail=${truncateUtf16Safe(this.stderrTail.join("\n"), 1200)}`,
203204
),
204205
),
205206
);

0 commit comments

Comments
 (0)