Skip to content

fix(discord): keep recording independent of voice conversations - #139658

Merged
steipete merged 5 commits into
mainfrom
codex/130860-discord-recording-20260905
Sep 6, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/130860-discord-recording-20260905

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Related: #130860, #127426. Follows #139484 and #139572.

What Problem This Solves

Fixes an issue where Discord meeting recordings could lose speech or stop when a voice connection changed, conversation authorization or a reply stalled, or realtime speaker connections were busy. Starting a recording during an in-flight conversation authorization could also miss a participant who was already speaking. Incomplete audio could reach a conversation or active-run control after a receive failure.

Why This Change Was Made

The Discord source now owns recording across connection and manager replacement. Each speaker has one bounded receive stream, and each audio packet retains the recording authority and timestamp under which it arrived. Recording can promote an existing pending receive reservation while conversation keeps its original admission request and authorization checks. Recording, pending conversation input, and serialized responses have separate lifecycle owners; conversation work cannot occupy the recording queue. Replacing an already-registered source transfers its subscription atomically without repeating Discord target validation, preserving dormant captures through lookup outages and carrying pending connection recovery to the new recording. Transport work follows the admitted source subscription; audio publication still requires the exact current recording. Stop and replacement revoke the exact recording; incomplete receive input retires its realtime speaker before recovery. Pending conversation input has explicit decoded-audio, utterance, and text limits, while recording continues. Realtime send and close failures are contained within the conversation owner.

Contiguous recording chunks share batch transcription with authorized stt-tts conversation, but command dispatch waits for the complete utterance. Shared media results distinguish completed empty transcription from omitted input. WAV files remain owned until processing releases them, preserving the cleanup fix from #139484. A retired recording releases its queue slot while an independently authorized conversation retains the same input operation. Pending WAV work is capped process-wide at 128 jobs and 64 MiB before files are created, including across reconnects. Input that loses every owner during the file write is cleaned immediately, before any pending processing queue.

User Impact

Explicitly authorized meeting recordings continue across transport changes and conversation failures, retain short answers and bounded upload chunks, and keep speaker identity and audio-ingress timestamps. Failed or incomplete speech cannot become a partial conversation command. Existing realtime-only setups retain safely bound per-speaker final transcripts when batch transcription is disabled or no backend is available. This limited route waits for every covered batch operation, never duplicates successful or silent batch output, and rejects mixed capture input, failed/oversized/unknown input, and provider continuity resets. It does not promote realtime credentials or start another provider session. /vc status exposes the limited-coverage warning and directs operators to configure batch transcription for full room coverage. The documentation explains the lifecycle, authorization boundary, upload limits, and diagnostics.

Evidence

  • Independent P0–P2 review passed for the refactor. The final compatibility review has no accepted/actionable findings. Its sole status-length report was disproven: /vc status filters to the invocation guild, and the manager owns at most one active connection per guild.

  • A complete 626-case voice run and all 11 cross-plugin integrations passed before rebase. On current main, 106 affected recording/conversation/capture/WAV cases and all 11 cross-plugin integrations passed, including the landed immediate-cleanup regression. The full changed-file gate passed, followed by focused verification of the final owner repairs. Final extension production/test and root integration types, lint, formatting, and diff checks passed. A full-run test polling race was repaired by awaiting the actual publication callback, preserving the assertion and timeout settings.

  • Final compatibility proof: all 16 real-manager cases passed, including /vc status, disabled batch audio, delayed admission, batch settlement/silence/duplicates, capture replacement, provider resets, and bounded pending finals. A broad run passed 640 voice cases and all 11 integrations; its one test failure emitted a provider final before admission completed and passed after waiting for the actual turn-completion promise. All selected changed-file checks passed after fixture typing and status lint repairs, including production/test types, lint, dead-export scans, and boundary guards.

  • CI exposed three missing capture-only fixture methods and a type import cycle. The fixture repair passed canonical root test types and both provider integrations. Shared capture, receipt, and segment-result contracts now live in a true type-only leaf; both runtime and Madge cycle guards pass, all six edited modules emit identical JavaScript, and the leaf emits none. The final full build, all three affected type lanes, lint, 18 focused cases, and independent review passed.

  • An isolated real media-runtime probe confirmed that a setup with only realtime-scoped provider credentials and no local STT returns the canonical no-model/omitted result with no attempted batch backend. The probe used actual provider selection/auth hooks and a network fence; no credentials were promoted.

  • Focused regressions reproduced lost recordings during queued authorization failure, pending initial admission, and realtime speaker-capacity exhaustion; occupancy replacement also reproduced spurious source transitions. Each is covered at its owning boundary.

  • Real libopus invalid-packet, decryption-error, and stream-error cases verify that incomplete speech cannot dispatch. Receive tests cover queue bounds, no-capture authorization, silence finalization, teardown, replacement, long speech, small upload budgets, and WAV cleanup.

  • Live OpenAI speech generation and file transcription passed with synthetic audio using gpt-4o-mini-tts and gpt-4o-transcribe: all three expected markers were recognized, input processing completed, and temporary audio was removed. All eight production source files in that proof match this slice.

  • Discord transport proof uses synthetic connections with real SDK and libopus behavior. No live Discord room was used.

@clawsweeper

clawsweeper Bot commented Sep 6, 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 docs Improvements or additions to documentation channel: discord Channel integration: discord size: XL maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 03:04
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 2:08 AM ET / 06:08 UTC.

ClawSweeper review

What this changes

Separates Discord meeting recording from voice conversations and connection lifetimes, adds bounded audio processing, and preserves a guarded realtime-only transcription fallback.

Merge readiness

✅ Ready for maintainer review

This remains useful work that current main has not absorbed. The earlier realtime-only compatibility blocker is addressed, and this review found no new actionable defect. Maintainer authorship and the protected label also preclude cleanup closure.

Priority: P2
Reviewed head: 7e62e4a7631b22f1d70ec4aba81a5311b3560083

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent lifecycle repair with substantive boundary coverage, a resolved compatibility finding, and no new blocking defect identified.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored PR. Supplied evidence exercises the media transcription pipeline and synthetic Discord manager boundaries; it does not claim a live-room run. The inspected authority checks and rejection coverage establish no unresolved case requiring the authority-proof exception.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored PR. Supplied evidence exercises the media transcription pipeline and synthetic Discord manager boundaries; it does not claim a live-room run. The inspected authority checks and rejection coverage establish no unresolved case requiring the authority-proof exception.
Evidence reviewed 11 items Current main still retires recording with its connection: The fetched main implementation stores transcripts on the voice-session entry and calls retireTranscripts during connection teardown. This establishes a remaining lifecycle problem beyond the already-merged WAV and transcript-domain fixes.
Latest release retains the older source ownership: The v2026.9.2 source starts capture through manager.join with a connection-owned transcript binding and requires a live manager to stop it; it does not contain this branch's independent capture registry.
Publication follows exact capture authority: Capture registrations use object identity for isCurrent, guard the publication callback, and synchronously remove the registration on stop. Batch processing rechecks that capture after transcription; realtime publication additionally checks provider continuity.
Findings None None.
Security None None.

How this fits together

Discord voice receive feeds participant audio into recording and authorized agent conversations. Recording publishes meeting notes through the transcripts provider, while conversation separately controls agent requests and spoken replies.

flowchart TD
  A[Discord participant audio] --> B[Bounded speaker receive]
  C[Explicit capture subscription] --> B
  B --> D[Batch transcription]
  D --> E[Current capture check]
  E --> F[Meeting notes]
  B --> G[Conversation authorization]
  G --> H[Agent requests and voice replies]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1244, Tests +4460, Docs +106. Total +5810 across 59 files.

View PR surface stats
Area Files Added Removed Net
Source 24 1905 661 +1244
Tests 33 5648 1188 +4460
Docs 2 114 8 +106
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 59 7667 1857 +5810

Review metrics

Metric Value Why it matters
Production versus test growth Production net +1,244 lines; tests and test support net +4,460 lines Production growth is justified by separate recording/conversation lifecycle owners, bounded queues, and the documented compatibility fallback.
SDK result extension 1 optional result field with 2 processing states Existing SDK result literals remain valid while consumers can distinguish silence from omitted audio.

Technical review

Best possible solution:

Keep capture lifetime owned by the exact source subscription, with independently authorized conversation and a bounded, explicitly limited realtime fallback.

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

Yes, from source: current main retires the transcript binding when its voice connection stops, so connection replacement can end an otherwise active recording. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes. Moving recording lifetime to the source subscription addresses the owning boundary, while the optional processing result and guarded realtime fallback preserve existing callers and eligible realtime-only setups.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f3f1995be7fe.

Labels

Label justifications:

  • P2: This repairs bounded Discord meeting-recording and conversation lifecycle failures without evidence of a product-wide emergency.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored PR. Supplied evidence exercises the media transcription pipeline and synthetic Discord manager boundaries; it does not claim a live-room run. The inspected authority checks and rejection coverage establish no unresolved case requiring the authority-proof exception.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Pavan Kumar Gondhi: 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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-06T03:11:02.040Z sha dd0211d :: blocked before merge. :: [P1] Check batch STT availability before accepting realtime capture
  • reviewed 2026-09-06T03:45:18.731Z sha 6389844 :: blocked before merge. :: [P1] Check batch STT availability before accepting realtime capture
  • reviewed 2026-09-06T05:51:03.682Z sha 1e29657 :: needs maintainer review before merge. :: none

Keep explicit recording owned by its source across connection and manager
replacement. Receive each speaker once, retain packet-time capture authority,
and share completed batch transcription with authorized conversation.

Separate recording progress from conversation admission and replies, fence
incomplete or retired conversation input, and bound receive, conversation,
and queued WAV work. Retain WAV ownership through delayed processing and
cleanup, including when a retired recording hands off to conversation.

Preserve short authorized recording chunks and distinguish completed empty
transcription from omitted media input. Document lifecycle and limit behavior.

Split from #130860. Follows #139484 and #139572. Related: #127426.
Spell the existing channel-resolution union within the plugin and type the
transcript fixture callback with its public SDK contract. This removes a
forbidden normalization-core import and prevents Vitest's private Procedure
type from leaking into generated declarations.

Validation: normalization import guard, all 123 plugin package boundaries,
extension and root integration types, 53 voice cases and two core provider
integrations, and scoped P0-P2 review.
@steipete
steipete force-pushed the codex/130860-discord-recording-20260905 branch from dd0211d to 6389844 Compare September 6, 2026 03:39
Preserve existing per-speaker realtime finals when batch audio is disabled
or the actual media runtime confirms no backend is available. Carry packet
capture receipts through delayed admission and wait for every batch result;
successful, silent, failed, mixed, or incomplete input cannot duplicate or
authorize fallback notes. A provider continuity reset permanently retires
the recording owner until a fresh speaker connection establishes receipts.

Bound pending final text and surface limited coverage through /vc status.
Document the independent batch path and the narrower realtime-only contract.

Related to #130860 and #139658.
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the realtime-only recording regression in 852bf66. Existing per-speaker realtime finals are now retained only when every submitted audio packet belongs to the same current capture and all covering batch work confirms no backend is available. Early finals wait for batch settlement; successful or silent batch input suppresses duplicate notes, and failed, oversized, mixed, unbound, incomplete, or reset-generation input cannot authorize fallback text. Realtime credentials remain in their existing scope, and no extra provider session is started.

The actual /vc status response now exposes the limited-coverage warning and points operators to batch audio transcription for independent room recording. All 16 compatibility cases pass, along with the cross-plugin integrations and selected type/lint/boundary checks. An isolated real media-runtime probe confirmed the no-backend result shape using actual provider/auth hooks; existing live OpenAI speech generation/file transcription proof remains source-matched. Discord transport proof uses synthetic connections plus actual SDK/libopus behavior; no live Discord room was used.

Keep fake transcript managers aligned with the required realtime capability
query. These integration fixtures have no realtime conversation and return
false without weakening the production interface.

Validation: canonical root test types, provider integration, scoped lint,
and independent P0-P2 review passed.
@clawsweeper clawsweeper Bot added 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 6, 2026
Move capture, packet-receipt, and segment-result contracts out of their
runtime owners, breaking the full import graph cycle. Narrow realtime
recording metadata to the three strings it consumes.

All six existing modules emit identical JavaScript; the new leaf emits
none. Validation: both import-cycle guards, three canonical type lanes,
18 focused tests, lint, full build, and scoped P0-P2 review passed.
@steipete
steipete merged commit c6ef1f2 into main Sep 6, 2026
179 checks passed
@steipete
steipete deleted the codex/130860-discord-recording-20260905 branch September 6, 2026 06:20
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 6, 2026
Add bounded archive search, paging, exports, and capture status over the existing
SQLite records. Preserve canonical stored Markdown, public projection privacy,
shared-archive access control, and original capture ownership during title edits.
Only complete plugin metadata can establish that a source is unavailable.

Compare stored dates by instant without rewriting their identity. Select bounded
page keys before projecting notes and participants. Keep storage admission,
schema, indexes, and current occupied-source ID behavior intact.

Related: #130860
Builds on #139572 and #139658.
steipete added a commit that referenced this pull request Sep 6, 2026
Add bounded archive search, paging, exports, and capture status over the existing
SQLite records. Preserve canonical stored Markdown, public projection privacy,
shared-archive access control, and original capture ownership during title edits.
Only complete plugin metadata can establish that a source is unavailable.

Compare stored dates by instant without rewriting their identity. Select bounded
page keys before projecting notes and participants. Keep storage admission,
schema, indexes, and current occupied-source ID behavior intact.

Related: #130860
Builds on #139572 and #139658.
steipete added a commit that referenced this pull request Sep 6, 2026
* feat(transcripts): browse and export saved meeting archives

Add bounded archive search, paging, exports, and capture status over the existing
SQLite records. Preserve canonical stored Markdown, public projection privacy,
shared-archive access control, and original capture ownership during title edits.
Only complete plugin metadata can establish that a source is unavailable.

Compare stored dates by instant without rewriting their identity. Select bounded
page keys before projecting notes and participants. Keep storage admission,
schema, indexes, and current occupied-source ID behavior intact.

Related: #130860
Builds on #139572 and #139658.

* refactor(transcripts): distinguish stored and public notes readers

* fix(transcripts): preserve legacy archive reads and speaker identities

Preserve v2026.9.2 requests without paging arguments as the recent
2,000-row window, with UTF-16 clipping and the historical transport
ceiling. Keep modern pages and downloads on their separate byte bounds.

Map stored speaker IDs and labels independently through the public
read projection without parsing provider-only utterance metadata.

* test(transcripts): isolate timezone and cross-plugin E2E fixtures

Run native timezone coverage in a process started with the requested zone.
Keep hello lifecycle coverage on its supplied method list and move the
Gateway/Discord integration proof to the root E2E owner without changing
its assertions or resolved import targets.

* test(transcripts): include archive methods in current inventory

* refactor(transcripts): anchor methods after shipped catalog

Preserve the full v2026.9.2 catalog prefix and every named descriptor while letting later main method additions merge independently.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…claw#139658)

* fix(discord): keep recording independent of voice conversations

Keep explicit recording owned by its source across connection and manager
replacement. Receive each speaker once, retain packet-time capture authority,
and share completed batch transcription with authorized conversation.

Separate recording progress from conversation admission and replies, fence
incomplete or retired conversation input, and bound receive, conversation,
and queued WAV work. Retain WAV ownership through delayed processing and
cleanup, including when a retired recording hands off to conversation.

Preserve short authorized recording chunks and distinguish completed empty
transcription from omitted media input. Document lifecycle and limit behavior.

Split from openclaw#130860. Follows openclaw#139484 and openclaw#139572. Related: openclaw#127426.

* fix(discord): keep package-boundary types portable

Spell the existing channel-resolution union within the plugin and type the
transcript fixture callback with its public SDK contract. This removes a
forbidden normalization-core import and prevents Vitest's private Procedure
type from leaking into generated declarations.

Validation: normalization import guard, all 123 plugin package boundaries,
extension and root integration types, 53 voice cases and two core provider
integrations, and scoped P0-P2 review.

* fix(discord): retain safely bound realtime-only recordings

Preserve existing per-speaker realtime finals when batch audio is disabled
or the actual media runtime confirms no backend is available. Carry packet
capture receipts through delayed admission and wait for every batch result;
successful, silent, failed, mixed, or incomplete input cannot duplicate or
authorize fallback notes. A provider continuity reset permanently retires
the recording owner until a fresh speaker connection establishes receipts.

Bound pending final text and surface limited coverage through /vc status.
Document the independent batch path and the narrower realtime-only contract.

Related to openclaw#130860 and openclaw#139658.

* test(discord): declare capture-only fixture capability

Keep fake transcript managers aligned with the required realtime capability
query. These integration fixtures have no realtime conversation and return
false without weakening the production interface.

Validation: canonical root test types, provider integration, scoped lint,
and independent P0-P2 review passed.

* refactor(discord): make recording contracts a type-only leaf

Move capture, packet-receipt, and segment-result contracts out of their
runtime owners, breaking the full import graph cycle. Narrow realtime
recording metadata to the three strings it consumes.

All six existing modules emit identical JavaScript; the new leaf emits
none. Validation: both import-cycle guards, three canonical type lanes,
18 focused tests, lint, full build, and scoped P0-P2 review passed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…#139875)

* feat(transcripts): browse and export saved meeting archives

Add bounded archive search, paging, exports, and capture status over the existing
SQLite records. Preserve canonical stored Markdown, public projection privacy,
shared-archive access control, and original capture ownership during title edits.
Only complete plugin metadata can establish that a source is unavailable.

Compare stored dates by instant without rewriting their identity. Select bounded
page keys before projecting notes and participants. Keep storage admission,
schema, indexes, and current occupied-source ID behavior intact.

Related: openclaw#130860
Builds on openclaw#139572 and openclaw#139658.

* refactor(transcripts): distinguish stored and public notes readers

* fix(transcripts): preserve legacy archive reads and speaker identities

Preserve v2026.9.2 requests without paging arguments as the recent
2,000-row window, with UTF-16 clipping and the historical transport
ceiling. Keep modern pages and downloads on their separate byte bounds.

Map stored speaker IDs and labels independently through the public
read projection without parsing provider-only utterance metadata.

* test(transcripts): isolate timezone and cross-plugin E2E fixtures

Run native timezone coverage in a process started with the requested zone.
Keep hello lifecycle coverage on its supplied method list and move the
Gateway/Discord integration proof to the root E2E owner without changing
its assertions or resolved import targets.

* test(transcripts): include archive methods in current inventory

* refactor(transcripts): anchor methods after shipped catalog

Preserve the full v2026.9.2 catalog prefix and every named descriptor while letting later main method additions merge independently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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