Skip to content

fix(ui): keep workboard capture text truncation UTF-16 safe#102544

Merged
steipete merged 4 commits into
openclaw:mainfrom
maweibin:fix/workboard-utf16-truncation
Jul 9, 2026
Merged

fix(ui): keep workboard capture text truncation UTF-16 safe#102544
steipete merged 4 commits into
openclaw:mainfrom
maweibin:fix/workboard-utf16-truncation

Conversation

@maweibin

@maweibin maweibin commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Workboard session-capture titles and notes used raw UTF-16 code-unit slices. If a length boundary landed between an emoji's surrogate halves, the captured card contained malformed text.

Why This Change Was Made

Both capture clamps now use the shared truncateUtf16Safe helper already owned by the Workboard module. The reviewed patch keeps the private helpers private and covers them through captureSessionToWorkboard instead of a helper-only probe.

User Impact

Long captured session labels, user prompts, and assistant notes remain valid Unicode at the Workboard limits. Short text and ASCII truncation behavior are unchanged.

Evidence

  • Added a public-path regression that creates a Workboard card with an emoji straddling both the 177-code-unit title prefix and 697-code-unit note prefix.
  • Focused ui/src/pages/workboard/data.test.ts run — 1 passed, 179 skipped.
  • Exact create-request assertions verify the title and notes contain the complete-code-point prefixes plus the existing ellipses.
  • Fresh autoreview — clean, 0.99 confidence.

AI-assisted: Claude Code

Replace raw .slice(0, N - 3) with truncateUtf16Safe in
clampSessionCaptureText and clampSessionCaptureTitle to prevent
lone surrogates when emoji cross the truncation boundary.

Completes the UTF-16 hardening started in openclaw#101685, which added the
import but only covered buildCardSessionLabel.
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 9, 2026
@maweibin

maweibin commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@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
@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:26 AM ET / 09:26 UTC.

Summary
The PR replaces two Workboard session-capture .slice truncations with truncateUtf16Safe and updates the capture regression test for title and notes emoji boundaries.

PR surface: Source 0, Tests +6. Total +6 across 2 files.

Reproducibility: yes. source-reproducible: current main slices at 177 and 697 code units in the Workboard capture path, so a prefix plus emoji crossing those boundaries can produce malformed UTF-16. I did not run a live UI reproduction in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted real behavior proof from a Workboard session capture showing emoji-boundary title and notes remain valid.
  • [P1] Refresh or resolve the current-head checks-node-compact-large-2 failure, or document maintainer-verified unrelatedness before merge.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The visible proof is focused regression-test output only; before merge, the contributor should add redacted real Workboard capture proof such as a screenshot, recording, live output, or logs showing the after-fix title/notes behavior, then update the PR body to trigger a fresh review.

Risk before merge

  • [P1] The PR body shows focused regression-test output, but no live Workboard/session-capture proof artifact showing the after-fix card title and notes in a real setup.
  • [P1] The current check rollup includes a failed checks-node-compact-large-2 shard on this head; I did not inspect logs deeply enough to attribute it to or clear it from this diff.

Maintainer options:

  1. Decide the mitigation before merge
    Land the two owner-local clamp replacements with the regression test after exact-head CI is clean and a redacted real Workboard capture proof is attached.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Manual review is appropriate because the remaining blockers are contributor real-behavior proof and CI status, not a narrow code repair for ClawSweeper to apply.

Security
Cleared: The diff only changes UI Workboard string truncation and a focused test, with no dependency, workflow, secret, auth, packaging, or code-execution surface changes.

Review details

Best possible solution:

Land the two owner-local clamp replacements with the regression test after exact-head CI is clean and a redacted real Workboard capture proof is attached.

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

Yes, source-reproducible: current main slices at 177 and 697 code units in the Workboard capture path, so a prefix plus emoji crossing those boundaries can produce malformed UTF-16. I did not run a live UI reproduction in this read-only review.

Is this the best way to solve the issue?

Yes, this is the best narrow fix: the existing shared UTF-16 helper already serves sibling Workboard and UI truncation paths, and replacing only the two capture clamps avoids new API surface or helper exports.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4ad94febcb31.

Label changes

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish 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: The visible proof is focused regression-test output only; before merge, the contributor should add redacted real Workboard capture proof such as a screenshot, recording, live output, or logs showing the after-fix title/notes behavior, then update the PR body to trigger a fresh review.

Label justifications:

  • P3: This is a low-risk Control UI text-truncation bug fix with limited blast radius and no config, data-model, provider, or security surface changes.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish 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: The visible proof is focused regression-test output only; before merge, the contributor should add redacted real Workboard capture proof such as a screenshot, recording, live output, or logs showing the after-fix title/notes behavior, then update the PR body to trigger a fresh review.
Evidence reviewed

PR surface:

Source 0, Tests +6. Total +6 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 1 12 6 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 14 8 +6

What I checked:

Likely related people:

  • steipete: Authored the merged Workboard feature PR including session capture, authored/merged the broad UTF-16 hardening PR that touched Workboard, and added maintainer commits on this PR. (role: feature owner and recent area contributor; confidence: high; commits: 41a895852007, 176fee5d071d, 80cb5f1e737c; files: ui/src/lib/workboard/index.ts, ui/src/pages/workboard/data.test.ts, ui/src/pages/sessions/sessions-page.ts)
  • maweibin: Co-authored the merged broad UTF-16 hardening work and authored this branch's targeted clamp replacement, making them relevant to the specific Unicode-boundary behavior. (role: recent UTF-16 hardening contributor; confidence: medium; commits: 176fee5d071d, c240a87a8423; files: ui/src/lib/workboard/index.ts, ui/src/pages/workboard/data.test.ts)
  • vincentkoc: Recently refactored the Workboard module file around internal declarations and exports without changing this capture behavior, so they are useful adjacent context but not the primary owner. (role: recent adjacent contributor; confidence: low; commits: 9dbb1ed3d246, 3d206140f3f0; files: ui/src/lib/workboard/index.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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-09T08:44:36.838Z sha c240a87 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 9, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Land-ready at exact head 73c9def5b1067205abf1d5cee9dd66d5942ad1cd.

Maintainer review strengthened this with public captureSessionToWorkboard coverage for both title and note boundaries; the focused regression passed (1 selected, 179 skipped), targeted formatting and git diff --check passed, and fresh autoreview completed clean with no accepted/actionable findings (0.99). A transient unrelated provider-local-service CI failure passed on its focused rerun; the repository landing wrapper now confirms exact-head hosted CI/Testbox gates passed.

Best-fix verdict: both capture-owned limits keep their existing policy and share the module's existing UTF-16-safe helper, with no new abstraction or compatibility path.

@steipete
steipete merged commit 9bf2127 into openclaw:main Jul 9, 2026
148 of 153 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
…#102544)

* fix(ui): keep workboard capture text truncation UTF-16 safe

Replace raw .slice(0, N - 3) with truncateUtf16Safe in
clampSessionCaptureText and clampSessionCaptureTitle to prevent
lone surrogates when emoji cross the truncation boundary.

Completes the UTF-16 hardening started in openclaw#101685, which added the
import but only covered buildCardSessionLabel.

* test(ui): cover workboard UTF-16 boundaries

* docs(changelog): note Workboard UTF-16 fix

* docs(changelog): leave release notes to release flow

---------

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

app: web-ui App: web-ui P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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