Skip to content

fix(codex): use truncateUtf16Safe for attempt notification text truncation#101534

Merged
steipete merged 3 commits into
openclaw:mainfrom
lsr911:fix/utf16-safe-codex-notifications
Jul 7, 2026
Merged

fix(codex): use truncateUtf16Safe for attempt notification text truncation#101534
steipete merged 3 commits into
openclaw:mainfrom
lsr911:fix/utf16-safe-codex-notifications

Conversation

@lsr911

@lsr911 lsr911 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Codex attempt notifications truncate agent output with .slice(0, 237). When the slice boundary lands mid-surrogate-pair (common with CJK characters or emoji in agent output), the U+FFFD replacement character appears in desktop notification text.

Why This Change Was Made

Replace .slice(0, 237) with truncateUtf16Safe().

Evidence

- return text.length > 240 ? `${text.slice(0, 237)}...` : text;
+ return text.length > 240 ? `${truncateUtf16Safe(text, 237)}...` : text;

Part of the UTF-16 safety sweep following Alix-007 (#101311), wangmiao (#101421), and ly85206559 (#101029).

Issue

N/A


🤖 Generated with Claude Code

…ation

.slice(0, 237) on notification text can split surrogate pairs from
CJK characters or emoji in agent output, producing U+FFFD in Codex
desktop notifications.

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

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 34f168c140dff0b8eee35ddf448f307c68aa720e, but the PR head is now 9061bd846acc5488769169cd602645c162e8bc1a. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (1 earlier review cycle)
  • reviewed 2026-07-07T09:55:33.251Z sha ecd7135 :: needs real behavior proof before merge. :: none

@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. P2 Normal backlog priority with limited blast radius. labels Jul 7, 2026
@clawsweeper clawsweeper Bot removed 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. labels Jul 7, 2026
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Land-ready at exact reviewed head 9061bd846acc5488769169cd602645c162e8bc1a.

  • Replaced raw UTF-16 slicing in Codex raw-assistant activity previews with the shipped plugin SDK text utility.
  • Added a protocol-shaped regression through describeNotificationActivity and assigned it to the existing attempt-support shard; this fixed the related full-suite coverage failure on the prior head.
  • Fresh Codex autoreview: clean, no accepted/actionable findings (correctness 0.88).
  • oxfmt on all touched files and git diff --check: passed.
  • Exact-head hosted CI: 66 checks passed; none failed or pending.
  • Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 101534: passed exact-head hosted gates.

Direct dependency-contract inspection used Codex db887d03e1f907467e33271572dffb73bceecd6b: app-server declares rawResponseItem/completed, carries the raw ResponseItem, emits it from the raw-response event path, and models assistant message role, content, and phase with output text at ContentItem::OutputText.

No docs or changelog change is required for this internal diagnostic-boundary correction.

@steipete
steipete merged commit 37d613a into openclaw:main Jul 7, 2026
97 of 99 checks passed
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 8, 2026
…ation (openclaw#101534)

* fix(codex): use truncateUtf16Safe for attempt notification text truncation

.slice(0, 237) on notification text can split surrogate pairs from
CJK characters or emoji in agent output, producing U+FFFD in Codex
desktop notifications.

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

* test(codex): cover UTF-16-safe attempt previews

* test(codex): assign notification coverage to a shard

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…ation (openclaw#101534)

* fix(codex): use truncateUtf16Safe for attempt notification text truncation

.slice(0, 237) on notification text can split surrogate pairs from
CJK characters or emoji in agent output, producing U+FFFD in Codex
desktop notifications.

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

* test(codex): cover UTF-16-safe attempt previews

* test(codex): assign notification coverage to a shard

---------

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

extensions: codex P2 Normal backlog priority with limited blast radius. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants