fix(active-memory): recall context breaks when recent turns contain emoji#102877
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 11:32 AM ET / 15:32 UTC. Summary PR surface: Source +6, Tests +87. Total +93 across 2 files. Reproducibility: yes. Current main and the latest release both show raw UTF-16 code-unit slicing in the recent recall and timeout partial transcript paths, and the PR proof includes a RED control for the emoji-boundary regressions. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this plugin-local fix after exact-head or merge-result validation, then close or supersede the timeout-only duplicate at #102940. Do we have a high-confidence way to reproduce the issue? Yes. Current main and the latest release both show raw UTF-16 code-unit slicing in the recent recall and timeout partial transcript paths, and the PR proof includes a RED control for the emoji-boundary regressions. Is this the best way to solve the issue? Yes. Reusing the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3c048ef05297. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +6, Tests +87. Total +93 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 proof for exact head
No known proof gaps. |
Co-authored-by: 张贵萍0668001030 <[email protected]>
|
Merged via squash.
|
…moji (openclaw#102877) * fix(active-memory): keep recall query snippets utf16-safe * test(active-memory): exercise recall hook for utf16 bounds * test(active-memory): detect only unpaired surrogates * fix(active-memory): bound timeout partials safely Co-authored-by: 张贵萍0668001030 <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
…moji (openclaw#102877) * fix(active-memory): keep recall query snippets utf16-safe * test(active-memory): exercise recall hook for utf16 bounds * test(active-memory): detect only unpaired surrogates * fix(active-memory): bound timeout partials safely Co-authored-by: 张贵萍0668001030 <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes two active-memory paths that could pass malformed text onward when a configured UTF-16 code-unit cap landed inside an emoji or another surrogate-pair character:
The timeout path folds the distinct useful work from same-author PR #102920 into this active same-plugin fix after that PR was closed only by the contributor queue limit.
Why This Change Was Made
Active-memory already bounds both surfaces, but their raw string slices could retain one half of a surrogate pair. The fix reuses the existing
truncateUtf16Safecontract at each bounded append.For timeout transcripts, each already-trimmed record and separator is accounted before append. Collection stops at the first truncation or surrogate backoff so later records cannot skip ahead, and the redundant final map/filter/slice path is deleted. The configured limits and recall query shape remain unchanged.
User Impact
Users can include emoji and other non-BMP characters in recent conversation turns and timeout-recovered partial replies without active-memory corrupting those characters before memory search or partial-result recovery.
Evidence
Final exact head:
c0d70155b31638f8c4a3a7a359204b904b3e92af(GitHub-verified signed maintainer follow-up; original author credited).before_prompt_build, timeout recovery, and the embedded-agent prompt.run_c9984877a13a. Reversing only the production-file PR diff made all three exact regressions fail with lone-surrogate output.run_2d2505291a1a./usr/local/bin/pnpm test extensions/active-memory/index.test.ts -- -t "keeps recent conversation context UTF-16 well-formed|keeps partial assistant transcript caps UTF-16 safe|keeps joined partial assistant transcript caps UTF-16 safe": 3/3 passed./usr/local/bin/pnpm test extensions/active-memory/index.test.ts: 161/161 passed.node_modules/.bin/oxfmt --check extensions/active-memory/index.test.ts extensions/active-memory/index.tsandgit diff --checkpassed.No known proof gaps.