Skip to content

fix(qqbot): keep bounded previews UTF-16 safe#101516

Merged
vincentkoc merged 1 commit into
mainfrom
fix/qqbot-utf16-bounded-previews
Jul 7, 2026
Merged

fix(qqbot): keep bounded previews UTF-16 safe#101516
vincentkoc merged 1 commit into
mainfrom
fix/qqbot-utf16-bounded-previews

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

QQBot still used raw string slices at 30 fixed-size log, diagnostic, API-error, and outbound preview sites. When a surrogate pair crossed a cap boundary, the result contained a lone UTF-16 surrogate that could not round-trip cleanly through JSON, terminals, or downstream renderers.

This consolidates and supersedes #101410, #101426, and #101444 while preserving contributor credit from @wangmiao0668000666.

Why This Change Was Made

The change replaces only bounded arbitrary-text preview slices with the existing truncateUtf16Safe helper. Existing caps, suffixes, empty-string handling, and undefined logging semantics are unchanged.

Structural parsing, array limits, hashes, IDs, timestamps, protocol chunks, cache keys, token parsing, and fetch/SSRF-adjacent URL diagnostics are intentionally excluded.

User Impact

QQBot errors, logs, command previews, message previews, and bounded outbound diagnostics no longer emit half of an emoji or another surrogate pair at an existing length cap. No configuration, network, transport, protocol, or message-routing behavior changes.

Evidence

  • Blacksmith Testbox tbx_01kwxwjxbyevbyqwfmgazbzs3y: 10 focused QQBot files, 118 tests passed.
  • Same Testbox: pnpm check:changed passed extension typechecks, extension-test typechecks, lint, dependency guards, database-first guard, media helper guard, runtime sidecar guard, and import-cycle check.
  • Focused regression fixtures cover exact UTF-16 cap crossings at 120, 160, 200, 300, and 4096 code units.
  • Fresh autoreview: clean, no actionable findings, correctness confidence 0.86.
  • git diff --check: passed.

Supersedes #101410
Supersedes #101426
Supersedes #101444

@vincentkoc vincentkoc added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 7, 2026
@vincentkoc vincentkoc self-assigned this Jul 7, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 7, 2026 09:05
Co-authored-by: wangmiao0668000666 <wang.miao86@xydigit.com>
@vincentkoc
vincentkoc force-pushed the fix/qqbot-utf16-bounded-previews branch from 9591d3c to b91775d Compare July 7, 2026 09:07
@vincentkoc

Copy link
Copy Markdown
Member Author

Land-ready at exact head b91775d.

Validation:

  • Blacksmith Testbox tbx_01kwxwjxbyevbyqwfmgazbzs3y: 10 focused QQBot test files, 118 tests passed.
  • Same Testbox: pnpm check:changed passed extension typechecks, lint, dependency and architecture guards.
  • Exact-head CI run 28854778173: 64 checks passed, zero failures.
  • Fresh final-head Codex autoreview: no findings, correctness confidence 0.88.
  • Native review artifacts validated and scripts/pr prepare-run 101516 completed successfully.

The canonical diff keeps all existing caps, suffixes, empty/undefined behavior, and excludes parsing, protocol, IDs/hashes, cache keys, and fetch/SSRF-adjacent URL diagnostics. No remaining proof gaps for this rendering-only change. Contributor @wangmiao0668000666 is preserved as co-author.

@vincentkoc
vincentkoc merged commit ccbd9eb into main Jul 7, 2026
94 checks passed
@vincentkoc
vincentkoc deleted the fix/qqbot-utf16-bounded-previews branch July 7, 2026 09:19
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

@wangmiao0668000666

Copy link
Copy Markdown
Contributor

Thanks for the consolidated fix and the credit — appreciate you carrying the follow-up scope (utils/log, utils/stt, slash-command-handler) I had planned as separate PRs.

Two notes from the contributor side that may help:

Happy to investigate any post-merge regressions in the qqbot log/error paths if they come up.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 8, 2026
Co-authored-by: wangmiao0668000666 <wang.miao86@xydigit.com>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
Co-authored-by: wangmiao0668000666 <wang.miao86@xydigit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qqbot maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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