fix(agents): keep truncation surrogate-safe#102332
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 8, 2026, 11:30 PM ET / 03:30 UTC. Summary PR surface: Source +1, Tests +25. Total +26 across 2 files. Reproducibility: yes. from source inspection: current main’s active process label helper slices raw UTF-16 strings at the 140-character boundary. The PR test constructs a label where that boundary bisects an emoji, but I did not run a product repro in this read-only 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: Land the narrow helper reuse after the contributor adds redacted real runtime proof showing an actual active background bash session label or agent-context output remains UTF-16 well-formed. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main’s active process label helper slices raw UTF-16 strings at the 140-character boundary. The PR test constructs a label where that boundary bisects an emoji, but I did not run a product repro in this read-only review. Is this the best way to solve the issue? Yes for the production code: reusing the existing UTF-16-safe helper at the outer label cap is the narrowest maintainable fix. The remaining blocker is real behavior proof from a real setup, not a different code shape. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1252a3da59a8. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1, Tests +25. Total +26 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 (2 earlier review cycles) |
|
Maintainer verification complete on exact head
The change is limited to agent-facing background-process metadata; execution, registry state, and scope isolation are unchanged. |
|
Merged via squash.
|
After merging main, upstream openclaw#102332 added a test asserting surrogate-safe END truncation for active-process session labels. This branch had incidentally switched name truncation to truncateMiddle when the local truncate() helper was removed. Restore the surrogate-safe end-truncation helper (truncateUtf16Safe) for the redacted label so it truncates at the end like upstream, while keeping all redaction. Fixes the checks-node-compact-large-whole-1 shard failure; upstream test passes unmodified.
* fix(agents): keep truncation surrogate-safe * test(agents): tighten process label truncation coverage --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Agent-facing background-process labels are capped at 140 UTF-16 code units. Their outer formatter used raw slicing before the
...suffix and could retain a lone high surrogate when a long command verb crossed the cut.Why This Change Was Made
The existing outer label formatter now uses the canonical
truncateUtf16Safehelper. Process execution, registry state, scope isolation, command parsing, and the 140-unit policy are unchanged.The maintainer fixup also corrected the regression proof. The original emoji argument was shortened by
deriveSessionNamebefore the outer cap, so it never exercised the changed code; another test asserted only that an unscoped session stayed absent. The replacement uses a long single-token command that crosses the actual 137-unit cut and asserts the exact final label. Unrelated tests for already-safe web-fetch behavior were removed.User Impact
Reconnectable background-process metadata remains valid UTF-16 when a compact label boundary crosses an emoji or another astral character.
Evidence
listActiveProcessSessionReferences.git diff --check: pass.28991774236, OpenGrep run28991774230, CodeQL Critical Quality run28991774226, and CodeQL run28991774348oncecd014b51357df49dd6f760b6870dd67bc0252d: success.AI-assisted: yes. Maintainer-reviewed and tightened.