fix(qa-lab): use truncateUtf16Safe for tool search gateway and mock OpenAI text truncation#103219
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 6:22 PM ET / 22:22 UTC. Summary PR surface: Source +4, Tests +124. Total +128 across 4 files. Reproducibility: yes. from source: placing a supplementary character one UTF-16 code unit before any current cap causes raw Review metrics: none identified. Stored data model 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. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the canonical helper at all five truncation boundaries with the integrated regressions, then attach redacted exact-head QA Lab runtime output or logs before merge. Do we have a high-confidence way to reproduce the issue? Yes from source: placing a supplementary character one UTF-16 code unit before any current cap causes raw Is this the best way to solve the issue? Yes; applying the existing shared helper at each owning truncation boundary preserves the established UTF-16-unit budgets and avoids introducing a parallel Unicode policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 53bcdf8fe25f. Label changesLabel justifications:
Evidence reviewedPR surface: Source +4, Tests +124. Total +128 across 4 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
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…xt truncation Replace naive .slice(0, N) with truncateUtf16Safe() in: - tool-search-gateway.fixture.ts: 4 sites (provider input snippet, tool output snippet, gateway output text for normal/code lanes) - mock-openai/server.ts: 1 site (tool output evidence snippet) LLM output text may contain non-BMP characters (emoji, CJK extension characters). Naive .slice(0, N) at a surrogate pair boundary produces a lone surrogate. Co-Authored-By: Claude <[email protected]>
Co-authored-by: lsr911 <[email protected]>
03d39e6 to
b6c6b42
Compare
|
Land-ready review complete at exact head
No known proof gaps. |
|
Merged via squash.
|
…penAI text truncation (openclaw#103219) * fix(qa-lab): use truncateUtf16Safe for tool search and mock OpenAI text truncation Replace naive .slice(0, N) with truncateUtf16Safe() in: - tool-search-gateway.fixture.ts: 4 sites (provider input snippet, tool output snippet, gateway output text for normal/code lanes) - mock-openai/server.ts: 1 site (tool output evidence snippet) LLM output text may contain non-BMP characters (emoji, CJK extension characters). Naive .slice(0, N) at a surrogate pair boundary produces a lone surrogate. Co-Authored-By: Claude <[email protected]> * test: add proof script for qa-lab UTF-16 safe truncation at all boundaries * test(qa-lab): integrate UTF-16 boundary coverage Co-authored-by: lsr911 <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
QA Lab's tool-search diagnostics and mock OpenAI response builder truncated text with raw UTF-16 slicing at 220, 300, 500, and 4,000-code-unit boundaries. Emoji and other non-BMP characters at those boundaries could leave lone surrogate halves in debug evidence or mock responses.
Why This Change Was Made
The five bounded prefix sites now use the canonical
truncateUtf16Safehelper exposed through the public plugin SDK, following the cross-repository pattern established by #102823. The standalone helper proof was replaced with regression tests through the real tool-search lane, assertion diagnostics, and mock HTTP response paths.User Impact
QA Lab failure diagnostics and mock OpenAI evidence responses remain well-formed when long provider, tool, or gateway text contains emoji or other non-BMP characters. Existing code-unit limits and scenario behavior are unchanged.
Evidence
b6c6b426a6f5600582b646a438668ad56e44a46c: AWS Crabbox runrun_ebcb4ec91b63passed both focused files (136 tests total).tool-search-gateway-e2emock-provider scenario (1/1).oxfmt --checkpassed for all four changed files.