fix(queue-helpers): use truncateUtf16Safe for queue overflow summary truncation#102721
fix(queue-helpers): use truncateUtf16Safe for queue overflow summary truncation#102721zhangqueping wants to merge 1 commit into
Conversation
…truncation Replace raw UTF-16 slice in summarizeDroppedItem with truncateUtf16Safe to prevent surrogate pair splitting in queue overflow summary text. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 7:41 AM ET / 11:41 UTC. Summary PR surface: Source +2. Total +2 across 1 file. Reproducibility: yes. by source inspection: current main slices queue summary text at an arbitrary UTF-16 code-unit boundary, and follow-up queue overflow summaries can be built from dropped user prompt text. I did not run a live reproduction in this read-only cleanup review. 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: Keep the narrow helper-level change, add redacted real behavior proof for an emoji-boundary overflow summary, and preferably add a focused queue-helper regression test before merge. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main slices queue summary text at an arbitrary UTF-16 code-unit boundary, and follow-up queue overflow summaries can be built from dropped user prompt text. I did not run a live reproduction in this read-only cleanup review. Is this the best way to solve the issue? Yes, this is the best fix shape: reuse the existing surrogate-safe normalization helper at the shared queue-summary truncation point. Local surrogate logic or per-caller fixes would duplicate an existing contract and increase drift risk. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6621ead871a9. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2. Total +2 across 1 file. 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)
|
|
Thanks @zhangqueping. #102823 landed the same UTF-16-safe queue-overflow preview cap in |
What Problem This Solves
The queue overflow summary helper uses a raw UTF-16 code-unit slice to truncate dropped item text. When the truncation boundary falls between an emoji's surrogate halves, the summary text contains an unpaired surrogate.
Why This Change Was Made
Replace
.slice(0, limit-1)withtruncateUtf16SafeinsummarizeDroppedItem. The existing limit, trimming, and ellipsis suffix remain unchanged.Files Changed
src/utils/queue-helpers.ts.slice(0,N)withtruncateUtf16SafeinsummarizeDroppedItem.🤖 Generated with Claude Code