fix(discord): keep voice diagnostics bounded when ffmpeg errors are multibyte#104230
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 5:07 AM ET / 09:07 UTC. Summary PR surface: Source +3, Tests +20. Total +23 across 2 files. Reproducibility: yes. from current-main source with high confidence: the existing path truncates decoded string units rather than raw stderr bytes, so multibyte diagnostics can violate the stated byte limit. The regression test and direct Node decoder probe verify the relevant boundary behavior. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Merge the plugin-local byte-buffer implementation and regression test so the existing diagnostic contract is enforced in raw bytes while always emitting valid UTF-8. Do we have a high-confidence way to reproduce the issue? Yes, from current-main source with high confidence: the existing path truncates decoded string units rather than raw stderr bytes, so multibyte diagnostics can violate the stated byte limit. The regression test and direct Node decoder probe verify the relevant boundary behavior. Is this the best way to solve the issue? Yes. Bounding raw stderr at the owning ffmpeg child-process boundary is the narrowest maintainable fix, preserves existing playback and error propagation, and avoids introducing a second sanitization path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 107b95e1ad89. Label changesLabel justifications:
Evidence reviewedPR surface: Source +3, Tests +20. Total +23 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (1 earlier review cycle)
|
…fmpeg-stderr-byte-cap
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where users playing Discord voice audio could receive ffmpeg failure diagnostics that exceed the existing 8,192-byte cap when ffmpeg emits multibyte stderr text.
Why This Change Was Made
The Discord voice playback boundary now retains stderr as bytes and decodes the retained prefix safely after ffmpeg exits. This keeps the existing diagnostic cap accurate without changing playback, configuration, or channel behavior.
User Impact
Discord voice playback failures keep a bounded, readable ffmpeg diagnostic even when the underlying error text contains multibyte characters.
Evidence
71fc6655daae1a2496fbc49159ecc544086222b6.ffmpeg-win-x86_64-v7.1.exe -hide_banner -f lavfi -i anullsrc -filter_complex_script <utf8-filter-script> -f null -produced a failing ffmpeg child process withstderrByteLength: 24377,retainedBytes: 8192,decodedByteLength: 8191,replacementCount: 0,decodedEndsWithReplacement: false, andnonAsciiCount: 4004.node scripts/run-vitest.mjs extensions/discord/src/voice/audio.test.ts— passed: 1 file, 7 tests.node_modules\.bin\oxfmt.CMD --check --threads=1 extensions/discord/src/voice/audio.ts extensions/discord/src/voice/audio.test.ts— passed.node_modules\.bin\oxlint.CMD extensions/discord/src/voice/audio.ts extensions/discord/src/voice/audio.test.ts— passed.git diff --check upstream/main...HEAD— passed.python .agents\skills\autoreview\scripts\autoreview --mode branch --base upstream/main— completed with no accepted or actionable findings.