fix(agents): keep cleanup timeout details UTF-16 safe#102565
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 5:05 AM ET / 09:05 UTC. Summary PR surface: Source +1, Tests +25. Total +26 across 2 files. Reproducibility: yes. source inspection gives a high-confidence reproduction path by returning timeout details where a surrogate pair starts at prefixLength - 1, causing current main's raw slice to leave a dangling high surrogate before the suffix. I did not execute the repro locally because this review was read-only. 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow helper-based fix after refreshing exact-head checks, keeping cleanup timing and the exported agent cleanup API unchanged. Do we have a high-confidence way to reproduce the issue? Yes: source inspection gives a high-confidence reproduction path by returning timeout details where a surrogate pair starts at prefixLength - 1, causing current main's raw slice to leave a dangling high surrogate before the suffix. I did not execute the repro locally because this review was read-only. Is this the best way to solve the issue? Yes. Applying the existing shared UTF-16-safe helper at the single cleanup diagnostic truncation boundary is narrower and more maintainable than adding a local surrogate check or broader logging refactor. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e975d4923808. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1, Tests +25. Total +26 across 2 files. 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 review completed at exact head The cleanup-timeout owner now uses the shared UTF-16-safe prefix primitive while preserving its existing 512-code-unit bound and suffix. The regression exercises the exported timeout path at a split-surrogate boundary and verifies the emitted warning exactly. Evidence:
Known proof gaps: none for this internal diagnostic boundary. |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where agent cleanup timeout warnings could emit malformed diagnostic text when cleanup timeout details were truncated at a UTF-16 surrogate boundary.
Why This Change Was Made
Cleanup timeout diagnostics now use the shared UTF-16-safe truncation helper before appending the truncation suffix. This keeps the existing 512-character diagnostic bound and does not change cleanup timeout scheduling, timeout values, or late-rejection handling.
User Impact
Operators and developers can rely on cleanup timeout warning details to remain readable even when oversized diagnostics contain emoji or other surrogate-pair characters at the truncation boundary.
Evidence
Validation
final-cleanup-timeout-utf16-unit(pass, exit_code=0):Validation
final-cleanup-timeout-utf16-runtime(pass, exit_code=0):Validation
final-diff-check(pass, exit_code=0):