Repository navigation
fix(discord): bound realtime exact speech retention - #119250
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: found issues before merge. Reviewed August 4, 2026, 10:21 AM ET / 14:21 UTC. ClawSweeper reviewWhat this changesThe PR bounds retained completed speech in Discord realtime voice sessions and stops only the overflowing guild session. Merge readinessKeep this PR open: its Discord-local lifecycle design is sound, but the advertised 32 KiB safety bound counts UTF-16 code units rather than bytes, so multibyte speech can exceed it substantially. Priority: P1 Review scores
Verification
How this fits togetherDiscord realtime voice keeps completed model speech until its provider bridge and Discord playback can deliver it. The Discord voice manager owns each guild connection and removes a stopped session from the guild-session map. flowchart TD
A[Provider or agent speech] --> B[Discord realtime session]
B --> C[Retained exact speech]
C --> D{Within message and byte budget?}
D -->|Yes| E[Provider bridge and playback]
D -->|No| F[Guild session teardown]
F --> G[Connection and session cleanup]
Decision needed
Why: The linked umbrella issue carries a product-decision signal, and this PR makes a user-visible availability tradeoff when the fixed retention limit is exceeded. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +37, Tests +83. Total +120 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one byte-based accounting rule for queued and active exact speech, add a multibyte overflow regression, and retain the guild-local terminal teardown policy once confirmed. Do we have a high-confidence way to reproduce the issue? Yes in source: current main unconditionally appends completed speech to the retained queue under blocked delivery conditions. The proposed deterministic overflow tests describe the path, but this read-only review did not execute them. Is this the best way to solve the issue? No; the session and manager are the right owners, but the implementation must count bytes rather than UTF-16 code units to satisfy its stated 32 KiB bound. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 52954a1fa8f4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review The byte-accounting finding is fixed at Exact-head proof: 194/194 Discord voice manager tests passed locally and on Blacksmith Testbox: https://github.com/openclaw/openclaw/actions/runs/30919138499 Maintainer decision remains explicit: preserve completed speech while healthy; overflow terminally closes only the affected guild session, with sibling-session continuity covered deterministically. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final exact-head ClawSweeper disposition:
The exact review artifact was produced by https://github.com/openclaw/clawsweeper/actions/runs/30919600251; its direct publication step failed after generation, but the artifact confirms the UTF-8 fix and identifies no remaining code finding. |
* commit 'ca41781ed5fae6f4505e1e166ccb4216dfb3accb': fix(discord): count retained speech bytes test(discord): isolate exact speech overflow test(discord): cover exact speech overflow fix(discord): bound realtime exact speech
Related: #116201
What Problem This Solves
Fixes an issue where Discord realtime voice sessions could retain unbounded completed speech while provider readiness, an active response, or playback prevented delivery. A stalled session could grow memory indefinitely and later emit a large stale backlog.
Why This Change Was Made
DiscordRealtimeVoiceSessionnow owns a fixed exact-speech budget of 32 messages and 32 KiB measured as UTF-8 bytes. The first overflow is terminal for only that guild session: it clears session-owned speech and playback state, reports one terminal error, and ignores late provider or player events.The manager's canonical
entry.stop()path removes the exact current session and destroys its connection idempotently. This stays Discord-local because the shared talkback queue owns pending questions, not completed speech or Discord playback lifecycle.Maintainer decision: preserve completed speech exactly while the session remains healthy; do not silently evict, replace, or coalesce it. If the bounded retention contract is exceeded, close only the affected session and leave sibling guild sessions usable.
No provider, config, environment-variable, protocol, public SDK, or docs surface changes.
User Impact
Discord realtime voice can no longer retain an unbounded completed-speech backlog. When the safety bound is exceeded, the affected voice session stops once instead of risking continued memory growth or later speaking stale responses. Other guild voice sessions continue normally.
Evidence
c238564d2707be5527e83b112025443401e7e2fapassed the full Discord voice manager E2E suite locally and on Blacksmith Testbox: 1 file, 194/194 tests. Run: https://github.com/openclaw/openclaw/actions/runs/30919138499discord-voice-autojoinon the preceding head; the only subsequent production change is the corrected UTF-8 byte metric. Workflow: https://github.com/openclaw/openclaw/actions/runs/30916744848; job: https://github.com/openclaw/openclaw/actions/runs/30916744848/job/92017440511; artifactqa-live-discord-30916744848-1.gpt-realtime-2.1; 3/3 synthesized PCM round trips completed with terminal responses and zero late audio; browser WebRTC applied the remote description and connected.tbx_01kz6g8b094g0zttq4t500x8d6passed extension test types, oxlint, database-first guards, media helper guard, sidecar loader guard, and import-cycle checks.git diff --checkand directoxfmt --checkpassed.The literal overflow cannot be induced through the current live Discord driver without adding a private playback-stall control and a second driver. The proof is therefore intentionally split: deterministic manager E2E owns the overflow and sibling-isolation invariant; live Discord owns transport regression; live OpenAI owns provider/WebRTC regression. This keeps the PR narrow and avoids a new test-only runtime surface.
Scope: production
+40/-0; tests+93/-8; three files.