fix(active-memory): keep search query context truncation UTF-16 safe#101631
fix(active-memory): keep search query context truncation UTF-16 safe#101631lsr911 wants to merge 1 commit into
Conversation
Replace raw .slice(0, 120) with guard-safe truncateUtf16Safe in the search-query-context construction path, preventing dangling surrogates when previous user message text contains emoji or CJK characters at the 120-code-unit boundary. truncateUtf16Safe is already imported in this file.
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed July 7, 2026, 8:32 AM ET / 12:32 UTC. Summary PR surface: Source +31. Total +31 across 1 file. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 2ba622ca3019. Evidence reviewedPR surface: Source +31. Total +31 across 1 file. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
|
Thanks @lsr911. The useful behavior from this PR was consolidated with the sibling UTF-16 boundary fixes into #101654 and landed on The landed fix uses the existing |
What Problem This Solves
The
active-memoryextension already importstruncateUtf16Safefor content clamping, but the search-query-context path uses raw.slice(0, 120)on previous-user message text. User message text commonly contains emoji and CJK characters — a boundary mid-surrogate produces U+FFFD in the search query.Why This Change Was Made
truncateUtf16Safeis already imported at line 40 — this was simply a missed call site.Evidence
Branch prerun (commit 4ccd8db)
Files Changed
extensions/active-memory/index.ts.slice(0, 120)→truncateUtf16Safe