Skip to content

Commit 765cf63

Browse files
lsr911claude
andcommitted
fix(codex): use truncateUtf16Safe for tool transcript output truncation
Replace naive .slice(0, N) with truncateUtf16Safe() in event-projector tool transcript output text to prevent surrogate pair splitting. Co-Authored-By: Claude <[email protected]>
1 parent f0d4d4f commit 765cf63

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

extensions/codex/src/app-server/event-projector.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Codex plugin module implements event projector behavior.
2+
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
23
import {
34
classifyAgentHarnessTerminalOutcome,
45
embeddedAgentLog,
@@ -3066,7 +3067,7 @@ function truncateToolTranscriptText(text: string): string {
30663067
if (text.length <= TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS) {
30673068
return text;
30683069
}
3069-
return `${text.slice(0, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS)}\n...(truncated)...`;
3070+
return `${truncateUtf16Safe(text, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS)}\n...(truncated)...`;
30703071
}
30713072

30723073
function toolResultStatusText(params: ToolTranscriptResultInput): string {

0 commit comments

Comments
 (0)