fix(compaction): use truncateUtf16Safe for post-compaction context text#102515
Conversation
Replace naive .slice(0, maxContextChars) with truncateUtf16Safe() to prevent surrogate pair splitting in post-compaction context summaries sent to the model. Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 4:30 AM ET / 08:30 UTC. Summary PR surface: Source +1, Tests +16. Total +17 across 2 files. Reproducibility: yes. by source inspection: current main builds post-compaction context from AGENTS.md sections and truncates it with 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: Merge the narrow helper replacement once after-fix real behavior proof or a maintainer proof override confirms emoji-containing post-compaction context truncates without a dangling surrogate. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main builds post-compaction context from AGENTS.md sections and truncates it with Is this the best way to solve the issue? Yes for the code shape: reusing the existing package-exported AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5c3c5c0ee49a. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +16. Total +17 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
Review history (1 earlier review cycle)
|
|
Land-ready maintainer verification at exact head
The regression reads a real temporary |
|
Merged via squash.
|
…xt (openclaw#102515) * fix(compaction): use truncateUtf16Safe for post-compaction context text Replace naive .slice(0, maxContextChars) with truncateUtf16Safe() to prevent surrogate pair splitting in post-compaction context summaries sent to the model. Co-Authored-By: Claude <[email protected]> * test(compaction): prove context UTF-16 boundary --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
The post-compaction context builder uses naive .slice(0, maxContextChars) to truncate context summaries sent to the model. This can split surrogate pairs in compaction context text.
Why This Change Was Made
Replace with truncateUtf16Safe(). Same pattern as #102464, #102467, #102500 (all merged).
Files Changed
🤖 Generated with Claude Code