Skip to content

fix(voice-call): keep transcript log truncation UTF-16 safe#101305

Closed
Alix-007 wants to merge 1 commit into
openclaw:mainfrom
Alix-007:alix/utf16-voice-webhook-transcript
Closed

fix(voice-call): keep transcript log truncation UTF-16 safe#101305
Alix-007 wants to merge 1 commit into
openclaw:mainfrom
Alix-007:alix/utf16-voice-webhook-transcript

Conversation

@Alix-007

@Alix-007 Alix-007 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • AI-assisted with Codex; I inspected the changed production path and can explain the change.
  • Voice-call streaming transcript log truncation preserves UTF-16 boundaries before appending ellipses.
  • Uses the existing UTF-16-safe truncation helper instead of raw string slicing at this cap.
  • Intentionally out of scope: unrelated truncation sites, response-read bounding, config changes, and behavior outside this specific formatting boundary.

Linked context

  • No linked issue.
  • Related to the existing OpenClaw UTF-16-safe truncation hardening pattern.

Real behavior proof (required for external PRs)

  • Behavior addressed: Voice-call streaming transcript log truncation preserves UTF-16 boundaries before appending ellipses.
  • Real environment tested: local OpenClaw source checkout on Node v22.22.0; PR head 2d5384c.
  • Exact steps or command run after this patch: node scripts/run-vitest.mjs extensions/voice-call/src/webhook.test.ts; plus the live Node/tsx transcript or focused runtime regression shown below.
  • Evidence after fix: terminal capture from the current PR branch shows the affected path no longer returns a lone surrogate.
$ node scripts/run-vitest.mjs extensions/voice-call/src/webhook.test.ts
✓ logs streaming transcripts without splitting UTF-16 surrogate pairs
Test Files 1 passed
Tests 46 passed

Regression assertion after fix: captured Transcript log contains the 199-character prefix plus ... and contains no high or low surrogate half.
  • Observed result after fix: the affected voice-call truncation path keeps output well-formed at the emoji/surrogate-pair boundary and preserves the existing truncation marker/cap behavior.
  • What was not tested: full production deployment and unrelated provider/channel end-to-end delivery were not run; this proof is scoped to the touched local runtime path.
  • Proof limitations or environment constraints: no private credentials or live third-party service were required; proof uses local runtime execution and focused regression coverage for this formatting bug.
  • Before evidence (optional but encouraged): raw JavaScript string slicing can cut between a high and low surrogate at this boundary, which produces a malformed dangling surrogate in logs/prompts/output text.

Tests and validation

  • node scripts/run-vitest.mjs extensions/voice-call/src/webhook.test.ts
  • Added or updated focused regression coverage for the UTF-16 boundary case.
  • No known local failures from this change.

Risk checklist

Did user-visible behavior change? (Yes/No)

Yes. Malformed truncated text is now avoided while preserving existing caps and truncation markers.

Did config, environment, or migration behavior change? (Yes/No)

No.

Did security, auth, secrets, network, or tool execution behavior change? (Yes/No)

No.

What is the highest-risk area?

voice-call webhook transcript log formatting.

How is that risk mitigated?

The patch is limited to the existing truncation boundary and is covered by focused regression proof above.

Current review state

What is the next action?

ClawSweeper re-review and maintainer review after this proof/body refresh.

What is still waiting on author, maintainer, CI, or external proof?

Nothing is waiting on the author after this proof update; waiting on CI/ClawSweeper/maintainer review.

Which bot or reviewer comments were addressed?

Addressed ClawSweeper's needs-proof feedback by using exact Real behavior proof field labels and adding copied terminal output from the current PR head.

@openclaw-barnacle openclaw-barnacle Bot added channel: voice-call Channel integration: voice-call size: XS labels Jul 7, 2026
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 11:53 PM ET / 03:53 UTC.

Summary
The PR replaces voice-call webhook transcript log .slice(0, 200) truncation with truncateUtf16Safe and adds a focused Vitest case for an emoji-boundary log preview.

PR surface: Source +1, Tests +42. Total +43 across 2 files.

Reproducibility: yes. source-level. Current main and v2026.6.11 use sanitized.slice(0, TRANSCRIPT_LOG_MAX_CHARS), so a surrogate pair that straddles the 200-code-unit boundary can be cut before logging through the transcript callbacks.

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 copied terminal output, a terminal screenshot, or logs from a run that triggers the transcript log truncation path after the patch.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Mock-only: the PR body reports a focused Vitest run but no copied terminal output, logs, screenshot, or other real after-fix artifact; contributor should add redacted terminal/log proof and update the PR body for re-review.

Risk before merge

  • [P1] External-PR real behavior proof is not sufficient yet; the PR body reports a focused Vitest run but does not show redacted terminal output, logs, or another after-fix runtime artifact.

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused helper substitution after contributor-supplied real behavior proof is added and exact-head checks remain green; keep unrelated voice-call log slices as separate follow-ups if needed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No ClawSweeper repair lane is needed because the code change is already focused and review found no mechanical defect; the blocker is contributor-supplied real behavior proof.

Security
Cleared: No concrete security or supply-chain concern found; the diff only changes TypeScript log truncation and adds a focused Vitest case.

Review details

Best possible solution:

Land the focused helper substitution after contributor-supplied real behavior proof is added and exact-head checks remain green; keep unrelated voice-call log slices as separate follow-ups if needed.

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

Yes, source-level. Current main and v2026.6.11 use sanitized.slice(0, TRANSCRIPT_LOG_MAX_CHARS), so a surrogate pair that straddles the 200-code-unit boundary can be cut before logging through the transcript callbacks.

Is this the best way to solve the issue?

Yes. Reusing the existing public truncateUtf16Safe helper at the raw head truncation point is the narrowest maintainable fix; a local surrogate guard or broad unrelated slice sweep would add more risk for this PR.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P3: This is a low-blast-radius voice-call transcript log formatting fix with no config, auth, storage, migration, dependency, or delivery-contract change.
  • 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: Mock-only: the PR body reports a focused Vitest run but no copied terminal output, logs, screenshot, or other real after-fix artifact; contributor should add redacted terminal/log proof and update the PR body for re-review.

Label justifications:

  • P3: This is a low-blast-radius voice-call transcript log formatting fix with no config, auth, storage, migration, dependency, or delivery-contract change.
  • 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: Mock-only: the PR body reports a focused Vitest run but no copied terminal output, logs, screenshot, or other real after-fix artifact; contributor should add redacted terminal/log proof and update the PR body for re-review.
Evidence reviewed

PR surface:

Source +1, Tests +42. Total +43 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 42 0 +42
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 44 1 +43

What I checked:

Likely related people:

  • steipete: Shortlog shows the heaviest history on the voice-call webhook/realtime-handler/test paths, and git log -S "Transcript for" traces the transcript log path back to the voice-call parity work. (role: feature owner and recent area contributor; confidence: high; commits: 42c17adb5e4d, 63f5fa47deb6, 651dc7450b68; files: extensions/voice-call/src/webhook.ts, extensions/voice-call/src/webhook.test.ts, packages/normalization-core/src/utf16-slice.ts)
  • amtellezfernandez: Current-main blame for sanitizeTranscriptForLog points to the merged snapshot commit from fix(security): align browser audit with plugin policy #97732, which recreated the current webhook files. (role: recent current-main snapshot contributor; confidence: medium; commits: 349d3547ccd1; files: extensions/voice-call/src/webhook.ts, extensions/voice-call/src/webhook.test.ts)
  • vincentkoc: The broader UTF-16-safe channel preview cleanup commit touched voice-call realtime-handler and superseded the adjacent partial-transcript PR, making this a useful routing signal for related truncation hardening. (role: adjacent UTF-16 cleanup contributor; confidence: medium; commits: c16bb8725a8a, e085fa1a3ffd; files: extensions/voice-call/src/webhook/realtime-handler.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.

@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 7, 2026
@Alix-007
Alix-007 force-pushed the alix/utf16-voice-webhook-transcript branch from ffa2e3e to a086bfd Compare July 7, 2026 04:20
@Alix-007
Alix-007 force-pushed the alix/utf16-voice-webhook-transcript branch from a086bfd to 2d5384c Compare July 7, 2026 04:23
@vincentkoc

Copy link
Copy Markdown
Member

Closing as superseded by the canonical UTF-16 boundary consolidation:

#101355
84e5327

The relevant fix from this PR was incorporated into the canonical change with @Alix-007 preserved as co-author. The landed patch consolidates the equivalent owner-local truncation boundaries, with exact changed gates, 142 focused tests, and clean exact-head CI.

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

Labels

channel: voice-call Channel integration: voice-call 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