Skip to content

fix(doctor): keep scrubbed error truncation UTF-16 safe#102066

Merged
steipete merged 2 commits into
openclaw:mainfrom
mushuiyu886:fix/followup-101600
Jul 9, 2026
Merged

fix(doctor): keep scrubbed error truncation UTF-16 safe#102066
steipete merged 2 commits into
openclaw:mainfrom
mushuiyu886:fix/followup-101600

Conversation

@mushuiyu886

@mushuiyu886 mushuiyu886 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Doctor/lint/repair errors are scrubbed and capped before reaching terminal findings. The shared scrubber used raw slicing at its 253-unit content boundary, which could retain a lone high surrogate before the existing ... suffix.

Why This Change Was Made

scrubDoctorErrorMessage now delegates the cut to the canonical truncateUtf16Safe helper. ANSI stripping, error coercion, the 256-unit total cap, suffix, check execution, and finding policy remain unchanged.

The maintainer fixup replaces a 20-line surrogate scanner with one exact assertion through runDoctorLintChecks, covering the complete thrown-error-to-finding path.

User Impact

Long doctor errors remain readable when the cap crosses an emoji or another astral character.

Evidence

  • Exact production-path finding assertion through runDoctorLintChecks.
  • Targeted oxfmt and git diff --check: pass.
  • Fresh local-diff and full-branch autoreviews: clean, confidence 0.99.
  • Exact-head CI run 28991884349, OpenGrep run 28991884305, CodeQL Critical Quality run 28991884323, and CodeQL run 28991884318 on 56727ca1c7ef06c6706401e3a122719403284006: success.

AI-assisted: yes. Maintainer-reviewed and tightened.

@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 8, 2026, 11:34 PM ET / 03:34 UTC.

Summary
The PR replaces raw doctor error-message truncation with the shared UTF-16-safe truncation helper and adds a lint-flow regression for a thrown error at a surrogate boundary.

PR surface: Source +2, Tests +13. Total +15 across 2 files.

Reproducibility: yes. at source level. Current main can cut a surrogate pair with raw slice in the doctor scrubber, and the PR body provides a concrete boundary string plus after-fix runtime proof on the doctor lint path.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

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

Next step before merge

  • No ClawSweeper repair job is needed because this active PR has no discrete review finding; the remaining action is ordinary maintainer review and merge gating.

Security
Cleared: The diff only imports an existing workspace helper and adds a focused unit test; it does not change dependencies, scripts, CI, secrets, permissions, or package resolution.

Review details

Best possible solution:

Land the narrow doctor scrubber fix after normal exact-head CI and maintainer review, preserving the existing cap, control-character stripping, and shared helper contract.

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

Yes at source level. Current main can cut a surrogate pair with raw slice in the doctor scrubber, and the PR body provides a concrete boundary string plus after-fix runtime proof on the doctor lint path.

Is this the best way to solve the issue?

Yes. Replacing the raw slice in the shared scrubber is the narrowest maintainable fix because lint and repair already centralize thrown-check error formatting there.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a real but narrow doctor terminal-output bug with limited blast radius and a focused fix.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes copied terminal output from the focused Vitest run and a runtime runDoctorLintChecks probe showing no unpaired surrogate after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes copied terminal output from the focused Vitest run and a runtime runDoctorLintChecks probe showing no unpaired surrogate after the fix.
Evidence reviewed

PR surface:

Source +2, Tests +13. Total +15 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 1 13 0 +13
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 16 1 +15

What I checked:

Likely related people:

  • joshavant: Blame and file history show this commit introduced the doctor scrubber, lint flow, repair flow, and UTF-16 helper currently involved in the PR. (role: introduced behavior and recent area contributor; confidence: high; commits: 17fafcc9012c; files: src/flows/doctor-error-message.ts, src/flows/doctor-lint-flow.ts, src/flows/doctor-repair-flow.ts)
  • maweibin: Authored the related merged tasks-output UTF-16 truncation fix that this doctor follow-up explicitly builds on. (role: adjacent recent contributor; confidence: medium; commits: 2a224025527b, 4d5cd05a64bf; files: src/commands/tasks.ts, src/commands/tasks.test.ts)
  • steipete: Added the follow-up width-preservation commit in the related merged terminal truncation PR and added the latest exact-output test commit on this branch. (role: adjacent recent contributor; confidence: medium; commits: e1386490afad, 56727ca1c7ef; files: src/commands/tasks.ts, src/commands/tasks.test.ts, src/flows/doctor-lint-flow.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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-08T06:40:19.228Z sha 6ee3c17 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 8, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Maintainer verification complete on exact head 56727ca1c7ef06c6706401e3a122719403284006.

  • Replaced indirect surrogate scanning with an exact finding assertion through runDoctorLintChecks.
  • Fresh local-diff and full-branch autoreviews: clean, confidence 0.99.
  • CI run 28991884349, OpenGrep run 28991884305, CodeQL Critical Quality run 28991884323, and CodeQL run 28991884318: success.

ANSI stripping, error coercion, the existing cap, and finding behavior are unchanged; only an astral boundary now backs off safely.

@steipete
steipete merged commit 7daa090 into openclaw:main Jul 9, 2026
105 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 9, 2026
)

* fix(doctor): keep scrubbed error truncation UTF-16 safe

* test(doctor): assert exact scrubbed error output

---------

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

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants