Repository navigation
fix(discord): settle voice preprocessing before releasing audio input - #146885
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 4:42 AM ET / 08:42 UTC. ClawSweeper reviewWhat this changesThe PR makes Discord voice metadata processing wait for waveform cleanup before returning a duration-probe error, with regression coverage for failure and success paths. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: fetched main and v2026.9.4 retain the premature-settlement race. No blocking correctness or security findings were identified. Priority: P2 Review scores
Verification
How this fits togetherDiscord voice sends stage audio locally, then calculate its duration and waveform before uploading it. Metadata completion determines when the caller can safely release temporary audio files. flowchart TD
A[Staged voice audio] --> B[Duration probe]
A --> C[Waveform generation]
C --> D[Waveform cleanup]
B --> E[Join metadata work]
D --> E
E --> F[Upload or report error]
F --> G[Release temporary audio]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +151. Total +151 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep metadata responsible for joining its waveform task while preserving existing media cleanup, timeout, and fallback behavior. Do we have a high-confidence way to reproduce the issue? Yes: fail duration probing while waveform processing remains active; current-main Promise.all rejects before the caller's cleanup is safe. Source establishes the path, and the supplied native comparison reports it; this reviewer did not execute it. Is this the best way to solve the issue? Yes: joining the existing waveform task repairs the lifetime invariant at its owner without adding another cleanup mechanism or changing the successful metadata contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 912685f44228. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* temp/pr-146802: (51 commits) improve: reduce worktree filesystem stalls and archive syncs (#146906) fix(ui): avoid extra chat rail work while replies stream (#146883) improve(ui): speed up populated Usage timelines (#146947) test(gateway): retain auth recovery failure diagnostics (#146925) fix(tests): create private temporary home directories (#146931) fix(backup): preserve discovery under concurrent state writes (#146912) fix: keep queued deliveries in their original state directory (#146917) fix(discord): settle voice waveform work before releasing input (#146885) fix(memory): preserve newer indexes and disclose automatic rebuild costs (#146908) fix: retain route ownership while discovering conversations (#146927) refactor: reuse plugin fixture shell runner (#146920) fix(worker): stop preparing disabled live previews (#146896) fix(runtime): support Bun across tooling suite (#146807) chore(i18n): refresh native locales (#146924) perf(secrets): limit expiry metadata to transient credentials (#146882) fix(ui): preserve queued refreshes during session discovery (#146535) test(ui): wait for quiet scrolling and close named file tabs (#146836) fix(ui): prevent Usage hour filters from freezing during DST (#146919) test(ui): share browser page cleanup across layout fixtures (#146805) ci: balance complete PR runtime test groups (#146916) ...
What Problem This Solves
Fixes Discord voice-send cleanup releasing its temporary audio input while waveform processing is still active when duration probing fails.
User Impact
When duration probing fails, the send now waits for waveform processing and cleanup attempts before returning the original error; successful metadata remains unchanged.
Why This Change Was Made
The metadata owner starts duration and waveform work concurrently, but its fail-fast
Promise.allcould reject while the waveform task still owned the input. Atry/finallynow joins that waveform task before metadata completes, keeping cleanup with the existing media and workspace owners. Production changes are +7/−7 (net zero); the four regression cases add 151 test lines.Evidence
The final implementation passed 40 focused tests covering metadata, voice sends, voice-message helpers, and media execution. The normal changed gate passed all 25 selected checks against the explicit
c23e1b27…base.A fresh Linux Testbox execution compared the exact final candidate with its unpatched baseline using the same synthetic audio and native tools. The baseline failed exactly two unit and two native premature-settlement assertions; the candidate passed all four unit and five native tests. Probe exit and SIGTERM cases showed baseline metadata settling while waveform work remained alive, while the candidate stayed pending until that work completed. Success and fallback metadata matched across phases. All ten native cases preserved input bytes and left no owned children or media residue; runtime-error reports were empty.
This proves native media preprocessing through the real media helpers, Execa, filesystem staging, and ffmpeg/ffprobe controls. It does not claim a live Discord send. Strict source inventories were unchanged within each phase, only the metadata owner differed between phases, and all 108,638 dependency entries remained unchanged.
The payload and archive packaging exited 0. The outer wrapper exited 7 because artifact collection exited 9; a subsequent single-file native download exited 0. The recovered archive and all 139 manifested files were independently hash-verified, and the retained Testbox was explicitly stopped and confirmed completed. Earlier failed attempts remain excluded from this proof.
Exact candidate and recovered artifact identity
fcfaf728f86e99075bca498b8daae8a10f3c1636, containing the finaltry/finallyimplementation.4b987fb038cf6250b046aeac6366a740cf1ca04367ccc7a6cbcec34eb158c273.490d62b70bc0810dee06692b4bad3b6eff081263c1ab3239336f83eb95dfe563.result.tar.gz: 18,292,810 bytes; SHA-256d6cf378ef747132dd64b4cdedb5a10aea5684aa40352207778db7a6d54f91bf6.final.jsonSHA-256:1d574f767ef9f4079e7e07e0d4e3292ac4c096b7418f7c3b33ca8cc967913257.The supplied main snapshot
ce6718fd82a492b7c1f2b068e1c68477fd9a8b7fhas no drift from the proof base in the inspected metadata owner, caller, media/process helpers, or related voice/audio lifecycle paths.