fix(cli): keep CLI display/approval truncation UTF-16 safe#101633
fix(cli): keep CLI display/approval truncation UTF-16 safe#101633lsr911 wants to merge 1 commit into
Conversation
Replace raw .slice(0, N) with truncateUtf16Safe in CLI display paths that may truncate user-provided text containing emoji or CJK characters: - cli/error-format: JSON input preview @45 - cli/exec-approvals-cli: approval display text @300 - commands/onboarding-plugin-install: plugin description @179 - commands/onboard-helpers: TUI display line @119
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 8:17 AM ET / 12:17 UTC. Summary PR surface: Source +54. Total +54 across 4 files. Reproducibility: yes. from source inspection rather than a live CLI run: current main still truncates user-visible strings with 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow helper substitution after the contributor adds redacted real CLI/onboarding output for all changed display paths, without adding new API or config surface. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection rather than a live CLI run: current main still truncates user-visible strings with raw Is this the best way to solve the issue? Yes: replacing these preview/error truncations with the existing leaf AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2ba622ca3019. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +54. Total +54 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
|
|
Thanks @lsr911. The useful behavior from this PR was consolidated with the sibling UTF-16 boundary fixes into #101654 and landed on The landed fix uses the existing |
What Problem This Solves
Four CLI/onboarding call sites truncate user-provided text with raw
.slice(0, N):All can contain emoji or CJK characters, producing U+FFFD in terminal output.
Why This Change Was Made
truncateUtf16Safefrom@openclaw/normalization-core/utf16-sliceis the canonical leaf helper.Evidence
Branch prerun (commit c601761)
Files Changed
src/cli/error-format.ts.slice(0, 45)→truncateUtf16Safe+ importsrc/cli/exec-approvals-cli.ts.slice(0, 300)→truncateUtf16Safe+ importsrc/commands/onboarding-plugin-install.ts.slice(0, 179)→truncateUtf16Safe+ importsrc/commands/onboard-helpers.ts.slice(0, 119)→truncateUtf16Safe+ import