fix(codex-supervisor): use truncateUtf16Safe for stderr tail truncation#102590
Conversation
StdioCodexJsonRpcConnection includes stderr output in the transport-closed error message with a naive .slice(0, 1200) which can split surrogate pairs. Replace with truncateUtf16Safe().
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 5:30 AM ET / 09:30 UTC. Summary PR surface: Source +1. Total +1 across 1 file. Reproducibility: Do we have a high-confidence way to reproduce the issue? Source inspection gives a clear focused path: the stdio close handler on current main slices a joined stderr string at 1200 UTF-16 code units, which can split a surrogate pair, but I did not run a live Codex app-server reproduction. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the code change narrow for codex-supervisor, require redacted runtime proof or a maintainer proof override before merge, and handle broader Codex app-server stderr cleanup separately if desired. Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Source inspection gives a clear focused path: the stdio close handler on current main slices a joined stderr string at 1200 UTF-16 code units, which can split a surrogate pair, but I did not run a live Codex app-server reproduction. Is this the best way to solve the issue? Is this the best way to solve the issue? Yes for the stated codex-supervisor bug: reuse the existing public plugin SDK UTF-16 helper at the diagnostic boundary while preserving the current limit and message shape; it is not a full sibling stderr-diagnostic sweep. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ad94febcb31. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1. Total +1 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Land-ready verification at exact head
No docs, config, protocol, or dependency changes. Ready to merge. |
|
Merged via squash.
|
…on (openclaw#102590) * 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(). * test(codex-supervisor): cover UTF-16-safe stderr tails --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
The Codex supervisor bounded child-process stderr with a raw UTF-16 slice when the app-server transport closed. An emoji crossing the 1,200-code-unit cutoff could leave an unpaired surrogate in the surfaced connection error.
Why This Change Was Made
Use the existing
truncateUtf16Safeplugin-SDK helper at the stderr-tail owner boundary, preserving the current limit and error shape.User Impact
Codex supervisor connection failures remain valid Unicode when app-server diagnostics contain supplementary characters at the cutoff.
Evidence
node scripts/run-vitest.mjs extensions/codex-supervisor/src/supervisor.test.ts— 1 file, 32 tests passed.git diff --checkpassed.db887d03e1f907467e33271572dffb73bceecd6b: app-server tracing is emitted to stderr incodex-rs/app-server/src/lib.rs.Files Changed
extensions/codex-supervisor/src/json-rpc-client.tsextensions/codex-supervisor/src/supervisor.test.ts🤖 Generated with Claude Code