Skip to content

Commit aa530d6

Browse files
committed
fix(agent-runner-execution): use truncateUtf16Safe for external run failure detail
Replace raw UTF-16 slice in formatForwardedExternalRunFailureText with truncateUtf16Safe to prevent surrogate pair splitting. The module already imports truncateUtf16Safe for other truncation paths — this commit extends coverage to the remaining call site. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 6ad8a77 commit aa530d6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/auto-reply/reply/agent-runner-execution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ function formatForwardedExternalRunFailureText(message: string): string {
952952
}
953953
const detail =
954954
sanitized.length > EXTERNAL_RUN_FAILURE_DETAIL_MAX_CHARS
955-
? `${sanitized.slice(0, EXTERNAL_RUN_FAILURE_DETAIL_MAX_CHARS - 1).trimEnd()}…`
955+
? `${truncateUtf16Safe(sanitized, EXTERNAL_RUN_FAILURE_DETAIL_MAX_CHARS - 1).trimEnd()}…`
956956
: sanitized;
957957
const suffix = /[.!?]$/u.test(detail) ? "" : ".";
958958
return `⚠️ Agent failed before reply: ${detail}${suffix} Please try again, or use /new to start a fresh session.`;

0 commit comments

Comments
 (0)