Skip to content

fix(meeting-bot): keep local audio diagnostics readable across chunks - #110703

Merged
steipete merged 3 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-local-audio-stderr-utf8
Aug 23, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-local-audio-stderr-utf8

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where local meeting-audio diagnostics could be corrupted or
truncated when UTF-8 characters, line endings, or final stderr bytes are split
across process-stream chunks. In particular, stderr can still deliver its last
bytes after the child emits exit and before the stream closes.

Why This Change Was Made

Real Node stderr streams in the meeting-audio transport now reuse the existing
onDecodedOutput streaming decoder. The transport emits UTF-8-complete
fragments as they arrive, flushes the final stream tail on end/close, and
keeps diagnostic records bounded to 8 KiB with UTF-8-safe truncation. Injected
adapters that do not promise stream completion retain their prior per-chunk
behavior, so diagnostics delivered after child exit remain visible without
guessing an end-of-stream boundary.

User Impact

Meeting operators receive complete, readable bounded local-audio error lines,
including multibyte text, late stderr bytes, and final partial lines emitted as
the child exits.

Evidence

  • CI run 32662687100
    completed for exact head 3a00d8cdf108b6e3aa20587840f502c1c9d8c49d with no
    failed or pending checks.
  • src/meeting-bot/realtime-local-audio-transport.test.ts covers the two
    existing backpressure/replacement regressions plus split UTF-8 diagnostics
    through playback, capture, and barge-in receivers (3 tests on the current
    head). The focused file passed in hosted CI.
  • Formatting, the repository pre-commit hook, and git diff --check passed
    before the submitted commit.

Exact-head real-behavior proof

The following proof was run against the production boundary
child_process.spawn → createLocalMeetingRealtimeAudioTransport → logger.debug
at exact head 3a00d8cdf108b6e3aa20587840f502c1c9d8c49d. The harness used real
child processes and only wrapped spawn to record timestamps. Each child wrote
the first byte of a multibyte UTF-8 character, spawned a helper inheriting the
same stderr descriptor to write the remaining bytes later, then exited. This
therefore exercises child exit before the late stderr bytes and stream
completion; no production handler was bypassed.

Redacted output (timestamps are milliseconds from harness start):

Receiver First stderr chunk Child exit Late stderr chunk end close
audio input 6c6174652de5 (late- + first byte of 尾) 126 b0bee8a18c0a (尾行\n remainder) 243 244
audio output 6c6174652de5 (late- + first byte of 尾) 136 b0bee8a18c0a (尾行\n remainder) 256 256

Observed production logger records, in order for both receivers:

[proof] audio input: late-
[proof] audio input command exited (0)
[proof] audio input: 尾行
[proof] audio output: late-
[proof] audio output command exited (0)
[proof] audio output: 尾行

Assertions from the run were all true: childExitBeforeLateStderr=true,
endAfterLateStderr=true, closeAfterOrWithEnd=true, and
replacementCharacters=0. The same decoder path therefore preserves the
split UTF-8 tail after exit and retains it through stream end/close.

Production delta rationale

The net +43 production lines are one bounded stderr helper plus two constants,
replacing three duplicate per-chunk handlers. The helper is the owner boundary
for the existing streaming decoder and UTF-8-safe diagnostic bound; it adds no
new public API, process command, retry, delivery, or fallback policy. The
exact-head proof above confirms the lifecycle behavior that motivated the
helper.

Root Cause and Risk

The root cause is lifecycle ordering: a child can emit exit before stderr has
delivered and closed its final bytes, while converting each chunk with
String(chunk) can split a UTF-8 sequence. The canonical fix is streaming
decoding at the meeting-audio transport boundary, with bounded UTF-8-safe
diagnostics and stream-owned finalization. This change does not modify process
commands, delivery, automation, session state, or retry behavior; it only makes
existing stderr diagnostics complete and readable. The two-file scope follows
the shared owner plus its focused regression coverage.

Current head validation

  • Exact source head: 3a00d8cdf108b6e3aa20587840f502c1c9d8c49d.
  • origin/main: df7e6f1c44da23513fe41cf693f0a12da5be2405; the current head is
    based directly on that merge base, with no touched-path conflict.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 4:25 PM ET / 20:25 UTC.

ClawSweeper review

What this changes

The PR replaces per-chunk local meeting-audio stderr logging with streaming UTF-8 decoding, bounded diagnostics, and final-stream flushing for playback, capture, and barge-in processes.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: current main still logs each stderr chunk with direct string conversion, while this PR centralizes streaming decoding across all local-audio process paths. The exact-head real subprocess evidence now addresses the prior proof gap; no blocking functional finding was identified.

Priority: P2
Reviewed head: 3a00d8cdf108b6e3aa20587840f502c1c9d8c49d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with credible real subprocess evidence and no blocking review finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body provides exact-head live output from real child processes through the production transport boundary, showing late stderr recovery after exit with intact UTF-8.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides exact-head live output from real child processes through the production transport boundary, showing late stderr recovery after exit with intact UTF-8.
Evidence reviewed 7 items Current-main behavior: Current main converts stderr data chunks directly with String(chunk).trim() for output, input, and barge-in paths, so a multibyte character split across chunks can be decoded independently.
Shared owner-boundary repair: The PR introduces one local stderr logger that uses the existing streaming decoder for real Readable streams, applies a UTF-8-safe bound, and retains the previous per-chunk behavior for injected non-stream adapters.
Completion behavior: The reused decoder flushes once on either end or close, preserving a decoder tail after a child exit while avoiding duplicate final records.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/meeting-bot/realtime-local-audio-transport.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs src/meeting-bot/realtime-local-audio-transport.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-110703-iwSeaI/target$ node scripts/run-vitest.mjs src/meeting-bot/realtime-local-audio-transport.test.ts
node scripts/run-vitest.mjs src/meeting-bot/realtime-local-audio-transport.test.ts
[test] starting test/vitest/vitest.unit.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-110703-iwSeaI/target

 ✓  unit  src/meeting-bot/realtime-local-audio-transport.test.ts (3 tests) 95ms

 Test Files  1 passed (1)
      Tests  3 passed (3)
   Start at  20:26:36
   Duration  1.48s (transform 1.13s, setup 970ms, import 71ms, tests 95ms, environment 0ms)

[test] passed 1 Vitest shard in 13.10s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-110703-iwSeaI/target$ node scripts/run-vitest.mjs src/meeting-bot/realtime-local-audio-transport.test.ts



































Assertions:

  • PASS expect_output: realtime-local-audio-transport.test.ts

How this fits together

The meeting bot starts local child processes to capture, play, and monitor audio for realtime calls. Their stderr output is routed into operator diagnostics while the audio streams continue into the meeting runtime.

flowchart LR
  A[Local audio commands] --> B[Child process streams]
  B --> C[Meeting audio transport]
  C --> D[UTF-8 diagnostic decoder]
  D --> E[Bounded debug records]
  C --> F[Realtime meeting engine]
Loading

Before merge

  • Resolve merge risk (P1) - This bug fix adds 43 production lines; retain that growth only because the shared helper owns stream completion, UTF-8 safety, and bounded diagnostics for all three process paths.
Agent review details

Security

None.

PR surface

Source +43, Tests +47. Total +90 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 50 7 +43
Tests 1 48 1 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 98 8 +90

Review metrics

Metric Value Why it matters
Production versus test LOC production +43 (50 added, 7 removed); tests +47 (48 added, 1 removed) The positive bug-fix production delta is concentrated in one shared stderr owner; tests cover all three transport receivers.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared transport-boundary helper after ordinary exact-head merge gates; keep decoding and finalization in the existing process decoder rather than duplicating lifecycle logic.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the shared transport-boundary helper after ordinary exact-head merge gates; keep decoding and finalization in the existing process decoder rather than duplicating lifecycle logic.

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

Yes, source-reproducible: current main independently stringifies each stderr chunk, and split UTF-8 bytes therefore reach separate conversions. This read-only review did not execute the repro, but the PR supplies exact-head real subprocess output for the same lifecycle ordering.

Is this the best way to solve the issue?

Yes. Reusing the existing streaming decoder at the shared meeting-audio transport boundary fixes all three stderr consumers without changing commands, delivery, configuration, or process policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head live output from real child processes through the production transport boundary, showing late stderr recovery after exit with intact UTF-8.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head live output from real child processes through the production transport boundary, showing late stderr recovery after exit with intact UTF-8.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is live_output.

Label justifications:

  • P2: Corrupted local meeting-audio diagnostics impair operator troubleshooting but do not alter audio delivery, session state, or authorization.
  • 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 (live_output): The PR body provides exact-head live output from real child processes through the production transport boundary, showing late stderr recovery after exit with intact UTF-8.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head live output from real child processes through the production transport boundary, showing late stderr recovery after exit with intact UTF-8.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Path history includes the meeting-bot extraction and loopback work, and current-main blame places the existing stderr call sites in a recent Peter-authored revision. (role: feature introducer and recent current-main contributor; confidence: medium; commits: 1a2d9e5e5c81, cca67fc84240, 0d411ed0d71e; files: src/meeting-bot/realtime-local-audio-transport.ts)
  • Vincent Koc: Local history records Vincent's consecutive local-audio backpressure and output-waiter repairs in this transport. (role: recent area contributor; confidence: medium; commits: 182c71a4285f, 155a17f912b2; files: src/meeting-bot/realtime-local-audio-transport.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-02T07:51:51.871Z sha f406aa2cd54e0982f4a7e829de8b24356b786b90 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T08:52:23.781Z sha f406aa2cd54e0982f4a7e829de8b24356b786b90 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T20:23:35.608Z sha f406aa2cd54e0982f4a7e829de8b24356b786b90 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-08T11:41:57.009Z sha f406aa2cd54e0982f4a7e829de8b24356b786b90 :: found issues before merge. :: [P1] Rebase the diagnostic helper onto the current audio transport
  • reviewed 2026-08-08T20:44:39.488Z sha f406aa2cd54e0982f4a7e829de8b24356b786b90 :: found issues before merge. :: [P1] Rebase diagnostics without removing loopback verification
  • reviewed August 18, 2026, 9:22 AM ET / 13:22 UTC sha unknown :: needs changes before merge. :: [P1] Rebase diagnostics without removing loopback verification
  • reviewed 2026-08-23T19:47:45.893Z sha ea105f2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-23T20:00:05.314Z sha 3a00d8c :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 18, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L and removed size: M labels Jul 20, 2026
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

Real subprocess behavior proof

The same deliberately split stderr input was exercised through the production local meeting-audio boundary:

child_process stderr → createLocalMeetingRealtimeAudioTransport → logger.debug

Before/after stderr proof

  • Before 42133d0c3c3e: 3 replacement characters, corrupted split UTF-8, no truncation marker, largest record 9,030 bytes.
  • After b1650ba2ea85: 0 replacement characters, intact split UTF-8, one visible truncation marker, largest record 8,244 bytes (8 KiB payload plus marker).
  • The final unterminated FINAL=尾行 stderr tail flushes in both runs.

This is a rendered comparison of the captured production-boundary logs. A live Meet/Teams UI call is not involved in this stderr decoding/framing seam.

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jul 21, 2026
@zhangguiping-xydt
zhangguiping-xydt force-pushed the fix/problem-local-audio-stderr-utf8 branch 2 times, most recently from 45a585b to eca28c1 Compare July 24, 2026 03:05
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 24, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@zhangguiping-xydt
zhangguiping-xydt force-pushed the fix/problem-local-audio-stderr-utf8 branch from 9bfb6d3 to f406aa2 Compare July 24, 2026 08:33
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 24, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 30, 2026
@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Aug 8, 2026
@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Aug 8, 2026
@clawsweeper clawsweeper Bot added clawsweeper-recovery-stuck proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. and removed clawsweeper-recovery-stuck labels Aug 16, 2026
@zhangguiping-xydt
zhangguiping-xydt force-pushed the fix/problem-local-audio-stderr-utf8 branch from f406aa2 to ea105f2 Compare August 23, 2026 19:41
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed agents Agent runtime and tooling size: L labels Aug 23, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Aug 23, 2026
@steipete
steipete merged commit 901b622 into openclaw:main Aug 23, 2026
275 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
…openclaw#110703)

* fix(meeting-bot): preserve split UTF-8 diagnostics

* fix(meeting-bot): stream decoded stderr diagnostics

* test(meeting-bot): type diagnostics monitor callback
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: 🐚 platinum hermit Good normal PR readiness with ordinary 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