fix(logging): use truncateUtf16Safe in diagnostic stability and session context#102570
Conversation
…on context Replace naive .slice(0, N) with truncateUtf16Safe() in: - diagnostic-stability-bundle.ts: error message sanitization - diagnostic-session-context.ts: quoted field value truncation Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 5:09 AM ET / 09:09 UTC. Summary PR surface: Source +2. Total +2 across 2 files. Reproducibility: yes. from source inspection: a long error message or cron diagnostic field with an emoji crossing the truncation boundary can make current main return a dangling surrogate. I did not run a live reproduction. 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: Land the narrow helper reuse after a redacted real log or bundle proof is added, ideally with focused surrogate-boundary regressions for both touched call sites. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: a long error message or cron diagnostic field with an emoji crossing the truncation boundary can make current main return a dangling surrogate. I did not run a live reproduction. Is this the best way to solve the issue? Mostly yes: reusing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3ac7729f4c5f. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +2. Total +2 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
|
|
Land-ready at exact head Maintainer review added exported session-formatter proof at the 137-code-unit boundary and generated stability-bundle proof at the 500-code-unit boundary. The focused suites passed (2 files, 16 tests), targeted oxfmt and Best-fix verdict: both diagnostic owners retain their established limits and suffixes while sharing the canonical UTF-16-safe boundary primitive; a new cross-diagnostics wrapper would add indirection without consolidating policy. |
|
Merged via squash.
|
…on context (openclaw#102570) * fix(logging): use truncateUtf16Safe in diagnostic stability and session context Replace naive .slice(0, N) with truncateUtf16Safe() in: - diagnostic-stability-bundle.ts: error message sanitization - diagnostic-session-context.ts: quoted field value truncation Co-Authored-By: Claude <[email protected]> * test(logging): cover diagnostic UTF-16 bounds * style(logging): normalize diagnostic imports --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Diagnostic stability bundles and session-context fields truncated arbitrary error text with raw UTF-16 slices. An emoji crossing either cutoff could leave an unpaired surrogate in logs or the generated stability bundle.
Why This Change Was Made
Use the repository's existing
truncateUtf16Safehelper at both diagnostic-owner boundaries while preserving the current limits, quoting, and suffixes.User Impact
Session diagnostics and failure bundles remain valid Unicode when long errors contain supplementary characters at a cutoff.
Evidence
Files Changed
src/logging/diagnostic-stability-bundle.tssrc/logging/diagnostic-session-context.tssrc/logging/diagnostic-stability-bundle.test.tssrc/logging/diagnostic-session-context.test.ts🤖 Generated with Claude Code