Skip to content

fix(discord): handle ffmpeg stderr stream errors in voice playback#101088

Merged
steipete merged 2 commits into
openclaw:mainfrom
masatohoshino:fix/discord-voice-stderr-stream-error
Jul 6, 2026
Merged

fix(discord): handle ffmpeg stderr stream errors in voice playback#101088
steipete merged 2 commits into
openclaw:mainfrom
masatohoshino:fix/discord-voice-stderr-stream-error

Conversation

@masatohoshino

@masatohoshino masatohoshino commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

createDiscordOpusPlaybackStream guarded ffmpeg's stdout stream but left stderr's own error event unhandled. Node rethrows an unhandled EventEmitter error, so a broken stderr pipe could terminate the gateway instead of failing only the Discord voice playback stream.

Why This Change Was Made

Both readable child pipes have the same lifecycle contract. This change installs the same error forwarding on stdout and stderr in one loop, while preserving stderr data capture for ffmpeg diagnostics. The existing stdin EPIPE handling remains separate because it intentionally suppresses write-side shutdown noise.

User Impact

A broken ffmpeg stdout or stderr pipe during Discord voice playback now destroys the playback stream with the original error instead of risking an uncaught process-level exception. Normal decoding and playback are unchanged.

Evidence

Direct sanitized AWS Crabbox proof was attempted twice, but the coordinator reset during its own deployment before a lease or PR execution began. Secretless exact-head GitHub CI therefore remains the execution proof.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: S labels Jul 6, 2026
@steipete steipete self-assigned this Jul 6, 2026
masatohoshino and others added 2 commits July 6, 2026 19:28
createDiscordOpusPlaybackStream guards ffmpeg stdout and stdin against raw
stream 'error' events (an unhandled stream error throws and crashes the
gateway via uncaughtException), but the stderr stream on the same child was
left unguarded. Add the symmetric stderr error handler, routing it through
opusStream.destroy like stdout. Add a regression test covering stdout and
stderr stream errors.
@steipete
steipete force-pushed the fix/discord-voice-stderr-stream-error branch from 86133cb to 258f6fb Compare July 6, 2026 18:29
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Maintainer pass complete on 258f6fb073b55976ed502e31d68e10a34964374a.

I also attempted isolated, secretless AWS Crabbox validation twice. The coordinator reset during its own deployment before either lease was created, so no contributor code ran there; exact-head GitHub CI is the execution gate.

Thanks @masatohoshino for finding and testing the Discord voice crash path.

@steipete
steipete merged commit b6c7a77 into openclaw:main Jul 6, 2026
97 checks passed
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
…penclaw#101088)

* fix(discord): handle ffmpeg stderr stream errors in voice playback

createDiscordOpusPlaybackStream guards ffmpeg stdout and stdin against raw
stream 'error' events (an unhandled stream error throws and crashes the
gateway via uncaughtException), but the stderr stream on the same child was
left unguarded. Add the symmetric stderr error handler, routing it through
opusStream.destroy like stdout. Add a regression test covering stdout and
stderr stream errors.

* refactor(discord): unify ffmpeg stream errors

---------

Co-authored-by: Peter Steinberger <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…penclaw#101088)

* fix(discord): handle ffmpeg stderr stream errors in voice playback

createDiscordOpusPlaybackStream guards ffmpeg stdout and stdin against raw
stream 'error' events (an unhandled stream error throws and crashes the
gateway via uncaughtException), but the stderr stream on the same child was
left unguarded. Add the symmetric stderr error handler, routing it through
opusStream.destroy like stdout. Add a regression test covering stdout and
stderr stream errors.

* refactor(discord): unify ffmpeg stream errors

---------

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

channel: discord Channel integration: discord size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants