Skip to content

fix(discord): keep voice log previews UTF-16 safe#99974

Closed
sunlit-deng wants to merge 1 commit into
openclaw:mainfrom
sunlit-deng:codex/discord-voice-log-preview-utf16
Closed

fix(discord): keep voice log previews UTF-16 safe#99974
sunlit-deng wants to merge 1 commit into
openclaw:mainfrom
sunlit-deng:codex/discord-voice-log-preview-utf16

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Discord voice diagnostics could show a broken preview character when a long transcript or response was truncated exactly inside an emoji.

Why This Change Was Made

Voice log previews now reuse the shared UTF-16-safe truncation helper while preserving the existing 500-character preview budget and ellipsis behavior.

User Impact

Operators reading Discord voice logs get stable previews without lone surrogate characters at truncation boundaries.

Evidence

  • node scripts/run-vitest.mjs extensions/discord/src/voice/log-preview.test.ts --reporter=verbose: 1 file / 3 tests passed.
  • Direct runtime proof against formatVoiceLogPreview showed the old raw slice shape leaves a lone surrogate while the patched preview does not.
$ node --import tsx --input-type=module
{
  "inputLength": 505,
  "rawSliceHasLoneSurrogate": true,
  "safePreviewHasLoneSurrogate": false,
  "safePreviewLength": 502,
  "safePreviewTail": "xxxxx..."
}

AI-assisted: built with Codex

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: XS labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 10:49 AM ET / 14:49 UTC.

Summary
The PR changes Discord voice log preview formatting to use the plugin SDK UTF-16-safe truncation helper and adds a regression test for an emoji split at the 500-character boundary.

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

Reproducibility: yes. Source inspection shows current main and v2026.6.11 cut the preview at a raw UTF-16 code-unit boundary; the PR body provides a matching terminal probe for the lone-surrogate case.

Review metrics: none identified.

Root-cause cluster
Relationship: canonical
Canonical: #99974
Summary: This PR is the canonical remaining item for the Discord voice log preview UTF-16 boundary bug; the merged related PR only supplies the shared helper and fixed an adjacent truncation surface.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • none.

Next step before merge

  • [P2] No repair lane is needed because this PR already contains the narrow fix and no actionable review finding needs automation.

Security
Cleared: The diff only reuses an existing exported text helper and adds a focused test; it changes no dependencies, workflows, permissions, package metadata, or secret-handling paths.

Review details

Best possible solution:

Land the narrow PR after normal maintainer review, keeping the existing shared helper as the single truncation primitive for this preview.

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

Yes. Source inspection shows current main and v2026.6.11 cut the preview at a raw UTF-16 code-unit boundary; the PR body provides a matching terminal probe for the lone-surrogate case.

Is this the best way to solve the issue?

Yes. Reusing the existing plugin SDK UTF-16-safe helper is the narrowest maintainable fix here; a Discord-local truncation helper would duplicate shared behavior and a broader truncation audit is separate work.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P3: The PR fixes a low-risk Discord operator-log formatting edge case without changing delivery, config, auth, persistence, or runtime control flow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes terminal runtime output showing raw slicing leaves a lone surrogate while the patched formatter does not, plus a focused test command.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal runtime output showing raw slicing leaves a lone surrogate while the patched formatter does not, plus a focused test command.
Evidence reviewed

PR surface:

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

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

What I checked:

Likely related people:

  • vincentkoc: Release-tag blame for v2026.6.11 points the shipped Discord voice log preview helper and voice runtime files at commit e085fa1. (role: introduced shipped behavior; confidence: high; commits: e085fa1a3ffd; files: extensions/discord/src/voice/log-preview.ts, extensions/discord/src/voice/manager.ts, extensions/discord/src/voice/realtime.ts)
  • Bartok9: Authored the merged PR that introduced the shared UTF-16-safe slicing helper this PR reuses for the Discord voice preview path. (role: adjacent helper contributor; confidence: medium; commits: e09b9dfc1ba9; files: src/shared/utf16-slice.ts, src/utils.ts, src/agents/tool-display-common.ts)
  • dexhunter: Current-main blame points to a later commit carrying forward the same Discord voice log preview helper and shared UTF-16 helper files after the release tag. (role: recent area contributor; confidence: medium; commits: 6103b359cb3d; files: extensions/discord/src/voice/log-preview.ts, extensions/discord/src/voice/manager.ts, extensions/discord/src/voice/realtime.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-04T14:43:41.621Z sha 9cf6328 :: needs maintainer review before merge. :: none

@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 4, 2026
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 4, 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.

@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. and removed 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. labels Jul 4, 2026
@steipete steipete self-assigned this Jul 5, 2026
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for the contribution. This fix landed with contributor co-authorship preserved in #100258 (deac98eb7204fdb51589c5e369b95be128215e77).

I consolidated the source fixes into a maintainer takeover because the contributor branches were based on rewritten pre-main history; updating them directly would have pulled unrelated changes into the review surface. Closing this PR as superseded by the landed batch.

@steipete steipete closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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