Skip to content

fix(auto-reply): keep ACP steer output UTF-16 safe#102583

Merged
steipete merged 2 commits into
openclaw:mainfrom
lsr911:fix/utf16-bash-lifecycle
Jul 9, 2026
Merged

fix(auto-reply): keep ACP steer output UTF-16 safe#102583
steipete merged 2 commits into
openclaw:mainfrom
lsr911:fix/utf16-bash-lifecycle

Conversation

@lsr911

@lsr911 lsr911 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

ACP steer acknowledgements buffer model-provided output up to 800 UTF-16 code units. The previous raw prefix slice could leave an unpaired surrogate when that limit fell inside an emoji or other supplementary character.

Why This Change Was Made

The steer-output owner now uses the shared UTF-16-safe truncation helper before appending its existing ellipsis. Maintainer review removed the proposed bash-session change because bash session IDs come from a fixed ASCII slug alphabet, so that path cannot hit this bug.

User Impact

Long /acp steer output remains well-formed while preserving the existing output limit and acknowledgement format.

Evidence

  • Command-level regression through /acp steer: 1 passed, 60 skipped.
  • The test places an emoji across the 800-code-unit cutoff and verifies the delivered reply contains the safe prefix plus ellipsis.
  • Targeted oxfmt and git diff --check pass.

AI-assisted

The original patch was generated with Claude Code and then narrowed and tested during maintainer review.

…output truncation

Replace naive .slice(0, N) with truncateUtf16Safe() in:
- bash-command.ts: shell command name preview
- lifecycle.ts: ACP steer output text

Co-Authored-By: Claude <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 9, 2026
@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 5:22 AM ET / 09:22 UTC.

Summary
The PR replaces raw prefix slices in bash session snippets and ACP steer output truncation with truncateUtf16Safe.

PR surface: Source +2. Total +2 across 2 files.

Reproducibility: yes. by source inspection: current main can cut a UTF-16 surrogate pair when bash session snippets or ACP steer output land exactly on the raw .slice boundary. I did not run a live proof in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Update the PR body with the user-visible problem, trigger, user impact, and evidence sections from the template.
  • [P1] Add after-fix proof such as focused test output, a live command transcript, or redacted logs showing surrogate-safe truncation.
  • Consider adding a focused regression for a surrogate pair landing on the bash or ACP steer truncation boundary.

Proof guidance:

  • [P1] Needs real behavior proof before merge: No after-fix live output, terminal transcript, redacted logs, screenshot/video, or linked artifact is present; the contributor should add redacted proof to the PR body for a fresh ClawSweeper review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The contributor has not provided after-fix real behavior proof or a durable PR-body problem/evidence section, and the Real behavior proof workflow failed for that reason.
  • [P1] The PR is behind current main, so exact-head checks should be refreshed before merge even though the affected files still show the same raw-slice behavior on current main.

Maintainer options:

  1. Decide the mitigation before merge
    Land the helper-based truncation fix after the PR body includes the user-visible symptom, redacted after-fix proof, and preferably a focused surrogate-boundary regression check.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No repair job is needed; the remaining blocker is contributor-supplied PR context and real behavior proof before normal maintainer review.

Security
Cleared: The diff only changes two text truncation call sites and adds no dependency, workflow, permission, secret, install, package, or code-execution surface.

Review details

Best possible solution:

Land the helper-based truncation fix after the PR body includes the user-visible symptom, redacted after-fix proof, and preferably a focused surrogate-boundary regression check.

Do we have a high-confidence way to reproduce the issue?

Yes by source inspection: current main can cut a UTF-16 surrogate pair when bash session snippets or ACP steer output land exactly on the raw .slice boundary. I did not run a live proof in this read-only review.

Is this the best way to solve the issue?

Yes, using the existing truncateUtf16Safe helper is the narrowest maintainable fix for these two display-truncation sites. The remaining gap is proof/context, not a different implementation layer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3f2466c4c378.

Label changes

Label changes:

  • add P3: This is a small, low-risk user-visible truncation cleanup for an edge-case Unicode display bug.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No after-fix live output, terminal transcript, redacted logs, screenshot/video, or linked artifact is present; the contributor should add redacted proof to the PR body for a fresh ClawSweeper review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a small, low-risk user-visible truncation cleanup for an edge-case Unicode display bug.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No after-fix live output, terminal transcript, redacted logs, screenshot/video, or linked artifact is present; the contributor should add redacted proof to the PR body for a fresh ClawSweeper review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +2. Total +2 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 4 2 +2
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 4 2 +2

What I checked:

Likely related people:

  • steipete: Recent commits touched both auto-reply command files and extracted/maintained the normalization-core package surface used by this PR. (role: recent area contributor; confidence: high; commits: 00d8d7ead059, 82e5dd4da74f, b18a05ae3ef6; files: src/auto-reply/reply/bash-command.ts, src/auto-reply/reply/commands-acp/lifecycle.ts, packages/normalization-core/src/utf16-slice.ts)
  • jalehman: Recent merged work routed auto-reply ACP lifecycle/session behavior through the session seam in the same lifecycle module. (role: recent adjacent contributor; confidence: medium; commits: 127e174c9e4d; files: src/auto-reply/reply/commands-acp/lifecycle.ts)
  • Takhoffman: Recent bash shortcut work changed sandbox/session behavior and fixtures around bash-command.ts. (role: recent adjacent contributor; confidence: medium; commits: 55f35708e181, 6d344d28a109; files: src/auto-reply/reply/bash-command.ts, src/auto-reply/reply/bash-command.stop.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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 keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 9, 2026
@steipete steipete changed the title fix(auto-reply): use truncateUtf16Safe in bash command and ACP steer output truncation fix(auto-reply): keep ACP steer output UTF-16 safe Jul 9, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Land-ready at exact head a036e2f3962ca3480b47b4df9a52e3271185d8ff.

Maintainer review removed the original bash-session edit after tracing session slugs to fixed ASCII word lists, leaving only the real arbitrary ACP response-text boundary. Command-level regression proof passed at the 800-code-unit cutoff (1 selected, 60 skipped), targeted oxfmt and git diff --check passed, fresh autoreview completed clean with no accepted/actionable findings (0.98), and the repository landing wrapper confirms exact-head hosted CI/Testbox gates passed.

Best-fix verdict: the narrowed patch fixes the owned delivered-reply boundary and avoids dead defensive code in the ASCII-only slug path.

@steipete
steipete merged commit 4792fa5 into openclaw:main Jul 9, 2026
104 of 106 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
* fix(auto-reply): use truncateUtf16Safe in bash command and ACP steer output truncation

Replace naive .slice(0, N) with truncateUtf16Safe() in:
- bash-command.ts: shell command name preview
- lifecycle.ts: ACP steer output text

Co-Authored-By: Claude <[email protected]>

* test(auto-reply): prove safe ACP steer output bounds

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants