fix(voice-call): keep realtime context truncation UTF-16 safe#101304
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 12:50 AM ET / 04:50 UTC. Summary PR surface: Source +1, Tests +25. Total +26 across 2 files. Reproducibility: yes. Source inspection of current main shows raw 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:
Next step before merge
Security Review detailsBest possible solution: Land this narrow helper substitution and regression test if CI remains green; keep broader UTF-16 hardening as separate site-specific fixes rather than expanding this branch. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection of current main shows raw Is this the best way to solve the issue? Yes. Updating the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c5d42593be6d. 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
Review history (1 earlier review cycle)
|
3b83095 to
7b5f6d8
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
Land-ready review complete on
No live provider gap: this is deterministic in-memory prompt formatting and needs no network or credentials. Thanks @Alix-007. |
|
Maintainer review complete on repaired exact head
Ready to land. |
|
Merged via squash.
|
1 similar comment
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where realtime voice sessions could receive malformed injected agent context when the configured character cap landed between the UTF-16 code units of an emoji.
Why This Change Was Made
The existing voice-context limiter now uses OpenClaw's shared UTF-16-safe truncation helper while preserving the existing character budget and
[truncated]marker. The focused regression drives the public instruction builder at the exact split-surrogate boundary and asserts the complete result.User Impact
Realtime voice prompts remain valid Unicode at emoji boundaries instead of containing a dangling surrogate. Context limits and behavior outside truncation are unchanged.
Evidence
tbx_01kwxyz3apwmff73p7mhnzna80:corepack pnpm test extensions/voice-call/src/realtime-agent-context.test.ts— 1 file, 2 tests passed.corepack pnpm check:changed— passed.c1bb06a35e24a89ed49004f917a2118c4479f8e2: https://github.com/openclaw/openclaw/actions/runs/28857280475 — passed.AI-assisted; maintainer-reviewed and tested.