Skip to content

fix(discord): settle voice preprocessing before releasing audio input - #146885

Merged
steipete merged 1 commit into
mainfrom
codex/qa-voice-metadata-exec-20260913
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-voice-metadata-exec-20260913

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.all could reject while the waveform task still owned the input. A try/finally now 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
  • Commit: fcfaf728f86e99075bca498b8daae8a10f3c1636, containing the final try/finally implementation.
  • Production SHA-256: 4b987fb038cf6250b046aeac6366a740cf1ca04367ccc7a6cbcec34eb158c273.
  • Regression-test SHA-256: 490d62b70bc0810dee06692b4bad3b6eff081263c1ab3239336f83eb95dfe563.
  • Recovered result.tar.gz: 18,292,810 bytes; SHA-256 d6cf378ef747132dd64b4cdedb5a10aea5684aa40352207778db7a6d54f91bf6.
  • Recovered final.json SHA-256: 1d574f767ef9f4079e7e07e0d4e3292ac4c096b7418f7c3b33ca8cc967913257.

The supplied main snapshot ce6718fd82a492b7c1f2b068e1c68477fd9a8b7f has no drift from the proof base in the inspected metadata owner, caller, media/process helpers, or related voice/audio lifecycle paths.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: S maintainer Maintainer-authored PR labels Sep 13, 2026
@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 4:42 AM ET / 08:42 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: fcfaf728f86e99075bca498b8daae8a10f3c1636

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and supplied native before-and-after proof.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The captured native Linux report exercises the changed metadata owner through real media/process helpers with probe exit and SIGTERM, showing delayed settlement until waveform cleanup and unchanged success/fallback results. Source hashes match the candidate; artifact access was reviewer-blocked, and no live Discord send is claimed or needed for this internal lifecycle fix.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The captured native Linux report exercises the changed metadata owner through real media/process helpers with probe exit and SIGTERM, showing delayed settlement until waveform cleanup and unchanged success/fallback results. Source hashes match the candidate; artifact access was reviewer-blocked, and no live Discord send is claimed or needed for this internal lifecycle fix.
Evidence reviewed 7 items Introduced lifecycle repair: The complete production module shows that waveform failures already resolve through a placeholder after cleanup. Joining that promise in finally therefore preserves the duration error while preventing early metadata settlement.
Caller owns input cleanup: The voice sender awaits metadata before reading and uploading audio, then removes converted audio in finally; the surrounding temporary workspace also releases its staged input. This establishes the concrete early-cleanup trigger.
Current main still needs the fix: Fetched main retains fail-fast Promise.all for duration and waveform work. A comparison against the proof base showed no changes in the inspected metadata owner, caller, media execution helper, or temporary-file cleanup helper.
Findings None None.
Security None None.

How this fits together

Discord 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +151. Total +151 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 7 0
Tests 1 151 0 +151
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 158 7 +151

Review metrics

None.

Technical review

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

Labels

Label changes:

  • add P2: This repairs a bounded Discord audio-cleanup race triggered by duration-probe failure.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured native Linux report exercises the changed metadata owner through real media/process helpers with probe exit and SIGTERM, showing delayed settlement until waveform cleanup and unchanged success/fallback results. Source hashes match the candidate; artifact access was reviewer-blocked, and no live Discord send is claimed or needed for this internal lifecycle fix.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The captured native Linux report exercises the changed metadata owner through real media/process helpers with probe exit and SIGTERM, showing delayed settlement until waveform cleanup and unchanged success/fallback results. Source hashes match the candidate; artifact access was reviewer-blocked, and no live Discord send is claimed or needed for this internal lifecycle fix.

Label justifications:

  • P2: This repairs a bounded Discord audio-cleanup race triggered by duration-probe failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The captured native Linux report exercises the changed metadata owner through real media/process helpers with probe exit and SIGTERM, showing delayed settlement until waveform cleanup and unchanged success/fallback results. Source hashes match the candidate; artifact access was reviewer-blocked, and no live Discord send is claimed or needed for this internal lifecycle fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured native Linux report exercises the changed metadata owner through real media/process helpers with probe exit and SIGTERM, showing delayed settlement until waveform cleanup and unchanged success/fallback results. Source hashes match the candidate; artifact access was reviewer-blocked, and no live Discord send is claimed or needed for this internal lifecycle fix.

Evidence

What I checked:

  • Introduced lifecycle repair: The complete production module shows that waveform failures already resolve through a placeholder after cleanup. Joining that promise in finally therefore preserves the duration error while preventing early metadata settlement. (extensions/discord/src/voice-message.ts:277, fcfaf728f86e)
  • Caller owns input cleanup: The voice sender awaits metadata before reading and uploading audio, then removes converted audio in finally; the surrounding temporary workspace also releases its staged input. This establishes the concrete early-cleanup trigger. (extensions/discord/src/send.voice.ts:121, fcfaf728f86e)
  • Current main still needs the fix: Fetched main retains fail-fast Promise.all for duration and waveform work. A comparison against the proof base showed no changes in the inspected metadata owner, caller, media execution helper, or temporary-file cleanup helper. (extensions/discord/src/voice-message.ts:278, 912685f44228)
  • Latest release retains the race: The v2026.9.4 source retrieved through GitHub also uses Promise.all without joining waveform work after probe failure. Local release-blob inspection failed; the GitHub content read supplied the release check. (extensions/discord/src/voice-message.ts, 3a9d69db306c)
  • Native before-and-after evidence: The captured PR body links https://github.com/openclaw/openclaw/actions/runs/34744365540 and reports native probe-exit and SIGTERM scenarios where baseline metadata settled early but the candidate waited for waveform completion. Success and fallback results matched, input bytes survived, and no owned children or media residue remained. Both local source hashes match the body's exact-candidate hashes. The body explains artifact recovery separately from wrapper failure. GitHub reports the outer run cancelled; artifact listing and log download were blocked for this reviewer, so the recovered archive was not independently inspected. (fcfaf728f86e)
  • Meaningful regression coverage: The four new cases check settlement ordering for probe failure/cancellation, successful and fallback metadata, preserved input bytes, and removal of waveform output. Existing sender tests mock metadata and therefore do not cover this race. Tests were inspected, not executed during this read-only review. (extensions/discord/src/voice-message.metadata.test.ts:95, fcfaf728f86e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit 175d909 into main Sep 13, 2026
97 checks passed
@steipete
steipete deleted the codex/qa-voice-metadata-exec-20260913 branch September 13, 2026 10:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* 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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR 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.

1 participant