fix(agents): keep prompt template descriptions UTF-16 safe#101660
fix(agents): keep prompt template descriptions UTF-16 safe#101660ly85206559 wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 9:39 AM ET / 13:39 UTC. Summary PR surface: Source +1, Tests +56. Total +57 across 2 files. Reproducibility: yes. from source inspection. Current main and the latest release both raw-slice the first non-empty prompt-template body line at 60 UTF-16 code units, and the added test gives a focused reproduction path, though I did not run tests in this read-only review. Review metrics: none identified. Stored data model 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 this focused helper swap with regression coverage after redacted real prompt-template loading or listing proof is added, or let a proven broader consolidation merge first and then close this PR as superseded. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection. Current main and the latest release both raw-slice the first non-empty prompt-template body line at 60 UTF-16 code units, and the added test gives a focused reproduction path, though I did not run tests in this read-only review. Is this the best way to solve the issue? Yes for the prompt-template surface. Reusing the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b95b9e448794. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +56. Total +57 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)
|
|
Closed as superseded by #101685, landed in |
What Problem This Solves
Fixes prompt template fallback descriptions being truncated with raw UTF-16 slicing. When a markdown template has no frontmatter description, OpenClaw derives the description from the first non-empty body line; the previous
.slice(0, 60)path could cut an emoji or other surrogate pair in half.Why This Change Was Made
Recent prompt, title, preview, and channel display truncation fixes use the shared
truncateUtf16Safehelper for user-visible bounded text. This applies that existing helper to prompt template fallback descriptions while preserving the existing 60-character limit and...marker behavior.User Impact
Prompt template lists keep well-formed descriptions when template text contains emoji or non-BMP characters near the truncation boundary.
Evidence
node scripts/run-vitest.mjs src/agents/sessions/prompt-templates.test.tssrc/agents/sessions/prompt-templates.test.tspassed: 1 test passed.git diff --checkpython .agents\skills\autoreview\scripts\autoreview --mode local --no-web-searchautoreview clean: no accepted/actionable findings reportedorigin/mainat60f0749b7f