Skip to content

fix(discord): recover encrypted voice when DAVE transition is zero - #117381

Merged
steipete merged 1 commit into
mainfrom
codex/issue-81518
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/issue-81518

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix encrypted Discord voice receive when the pinned DAVE implementation assigns a valid transition ID of 0 and otherwise surfaces UnencryptedWhenPassthroughDisabled.
  • Recover through the owner/public protocol path: invalidate the poisoned session, send the actual key-package event, and bound reconnect/cooldown behavior without breaking followed-user reconciliation, explicit manual joins, or healthy sessions.
  • Keep recovery inside the Discord voice owner; add real gateway/session regressions covering synchronous poisoned-state mutation, repeated invalidations, same-channel voice updates, and reconnect-storm prevention.

Fixes #81518.

Dependency and runtime evidence

  • Inspected the actual installed @discordjs/[email protected] DAVE declarations and implementation. A real installed DAVESession with lastTransitionId = 0 reproduces UnencryptedWhenPassthroughDisabled before the fix.
  • Exercised the real Discord voice manager and receive-recovery suites against the gateway's actual invalidation/key-package flow; transition zero, poisoned-session cooldown, followed-user suppression, same-channel updates, and explicit manual joins all pass.
  • Two independent source/security reviewers plus an independently invoked Codex review approved the exact landed candidate.
  • Trusted remote proof completed successfully against immutable reviewed patch SHA-256 f19e5e1ab5eb675aebc517f1900e342b0109ed7fab327e386c407c6bb1771025: both complete owner suites; full extension production and extension-test typechecks; changed-file formatting and lint; plugin, security, dependency, database, dead-code, and import-cycle guards; and a full production package/Control UI build. Total remote command time: 5m11s.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: XL maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 11:01 AM ET / 15:01 UTC.

ClawSweeper review

What this changes

This PR treats DAVE transition ID 0 as valid during Discord encrypted voice recovery, invokes the DAVE recovery path when appropriate, and limits repeated rejoin attempts after recovery failure.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 4 items remain

Keep this PR open for maintainer review. The recovery is narrowly scoped to the Discord voice owner and the updated tests cover the stated zero-transition and reconnect-loop cases, but this read-only checkout does not contain the pinned @discordjs/voice source and network access failed, so the required direct dependency-contract check could not be completed before a merge recommendation.

Priority: P1
Reviewed head: f3e9d1b55f78a1102d48c14f7f6267969bde557a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is narrowly designed and well tested, but review confidence is capped until the dependency-owned DAVE recovery behavior is directly verified.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The PR body provides detailed claimed after-fix gateway/session evidence, but this review could not directly inspect the pinned dependency contract that the proof relies on; add or retain redacted runtime output tied to @discordjs/[email protected] after verifying that contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR body provides detailed claimed after-fix gateway/session evidence, but this review could not directly inspect the pinned dependency contract that the proof relies on; add or retain redacted runtime output tied to @discordjs/[email protected] after verifying that contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Owner-local recovery path: The proposed helper only attempts recovery when the connection and networking state are Ready, the DAVE transition is exactly zero, and the session is not already reinitializing; it reports recovered, failed, or not-attempted to the voice manager.
Recovery lifecycle integration: On a passthrough-eligible receive error, the manager tries zero-transition recovery first; a failed invalidation starts bounded decrypt recovery, while other outcomes retain the existing passthrough and threshold-based recovery flow.
Regression coverage: The proposed receive-recovery tests cover transition zero, rejected non-zero or in-progress states, and failures from invalidation; the PR body additionally reports real manager/gateway recovery runs.
Findings None None.
Security None None.

How this fits together

Discord voice receive errors enter the Discord plugin’s voice manager, which decides whether to enable temporary passthrough, repair an encrypted DAVE session, or rejoin the voice channel. The new branch targets a poisoned DAVE transition before audio receive can resume.

flowchart LR
  A[Discord voice gateway] --> B[DAVE session state]
  B --> C[Discord voice manager]
  C --> D{Receive error recovery}
  D --> E[Invalidate transition and send key package]
  D --> F[Bounded leave and rejoin]
  E --> G[Voice receive pipeline]
  F --> G
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR body provides detailed claimed after-fix gateway/session evidence, but this review could not directly inspect the pinned dependency contract that the proof relies on; add or retain redacted runtime output tied to @discordjs/[email protected] after verifying that contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The patch calls DAVE session members that are dependency-owned rather than OpenClaw-owned; direct verification of the pinned @discordjs/[email protected] implementation was unavailable, so the synchronous invalidation and gateway-event assumptions remain unconfirmed.
  • Resolve merge risk (P1) - The recovery deliberately changes session teardown and rejoin behavior after a decrypt failure. Existing followed-user and manual-join flows need the dependency-contract check and the in-progress CI result before merge.
  • Complete next step (P2) - The PR has a concrete fix and an open canonical issue, but the remaining blocker is direct dependency-contract verification and pending CI, not a safe autonomous code repair.
Agent review details

Security

None.

PR surface

Source +108, Tests +922. Total +1030 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 110 2 +108
Tests 2 923 1 +922
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 1033 3 +1030

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #81518
Summary: This PR explicitly proposes the fix for the linked Discord DAVE transition-zero voice-receive regression.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Confirm the pinned DAVE contract (recommended)
    Inspect @discordjs/[email protected] to verify that zero-transition recovery synchronously enters reinitialization and emits the invalidation/key-package events expected by this owner-local path before merging.
  2. Pause for dependency evidence
    Hold the PR until a maintainer can verify the exact installed dependency behavior if that source cannot be inspected in the review environment.

Technical review

Best possible solution:

Retain the owner-local recovery design, but inspect the exact @discordjs/[email protected] DAVE implementation or its installed distribution to confirm the zero-transition invalidation semantics, then merge only if the pending checks preserve the existing healthy, followed-user, and manual voice-session behavior.

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

Yes, at source level: the proposed tests construct a real DAVE session with lastTransitionId = 0 and exercise the receive-recovery branch. Independent confirmation against the installed pinned dependency could not run because that package source is absent and network retrieval failed.

Is this the best way to solve the issue?

Unclear: keeping the repair in the Discord voice owner is the right architectural boundary, but its exact dependency-owned recovery contract still needs direct inspection before this can be confirmed as the best safe fix.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7cc2e6d83003.

Labels

Label justifications:

  • P1: A broken encrypted Discord voice receive path can leave connected voice users unable to transcribe or respond until recovery succeeds.
  • merge-risk: 🚨 compatibility: The patch changes recovery-time disconnect and rejoin behavior for existing Discord voice sessions, including followed-user state.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body provides detailed claimed after-fix gateway/session evidence, but this review could not directly inspect the pinned dependency contract that the proof relies on; add or retain redacted runtime output tied to @discordjs/[email protected] after verifying that contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Owner-local recovery path: The proposed helper only attempts recovery when the connection and networking state are Ready, the DAVE transition is exactly zero, and the session is not already reinitializing; it reports recovered, failed, or not-attempted to the voice manager. (extensions/discord/src/voice/receive-recovery.ts:161, f3e9d1b55f78)
  • Recovery lifecycle integration: On a passthrough-eligible receive error, the manager tries zero-transition recovery first; a failed invalidation starts bounded decrypt recovery, while other outcomes retain the existing passthrough and threshold-based recovery flow. (extensions/discord/src/voice/manager.ts:1810, f3e9d1b55f78)
  • Regression coverage: The proposed receive-recovery tests cover transition zero, rejected non-zero or in-progress states, and failures from invalidation; the PR body additionally reports real manager/gateway recovery runs. (extensions/discord/src/voice/receive-recovery.test.ts:145, f3e9d1b55f78)
  • Current-main provenance: The current receive-error/rejoin path dates to the recent Discord voice implementation represented by this blame range; the proposed head is a separate follow-up commit rather than behavior already present on current main. (extensions/discord/src/voice/manager.ts:1810, 75830f027af8)
  • Pinned dependency verification blocked: extensions/discord/package.json pins @discordjs/voice to 0.19.2, but no installed package source was present in this read-only checkout and GitHub source retrieval failed due unavailable DNS. Direct inspection of the DAVE method’s synchronous mutation and emitted-event contract therefore remains incomplete. (extensions/discord/package.json:12, 7cc2e6d83003)

Likely related people:

  • steipete: Git history shows repeated substantial work on the Discord voice manager and receive-recovery surface, including recent voice behavior changes. (role: primary Discord voice contributor; confidence: high; commits: 527c8cee0c87, 069616f33b63, 35f80a15645f; files: extensions/discord/src/voice/manager.ts, extensions/discord/src/voice/receive-recovery.ts)
  • DaigoSoup: Current-main blame attributes the existing receive-error and decrypt-recovery implementation to this contributor’s recent touch of the voice manager. (role: recent area contributor; confidence: medium; commits: 75830f027af8; files: extensions/discord/src/voice/manager.ts)
  • geekhuashan: The history includes a focused Discord voice connection and auto-join race repair, which is adjacent to the proposed leave/rejoin recovery behavior. (role: adjacent voice lifecycle contributor; confidence: medium; commits: 46d8e9650346; files: extensions/discord/src/voice/manager.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Inspect the exact @discordjs/[email protected] implementation or installed distribution for recoverFromInvalidTransition, reinitializing, and its gateway event emissions.
  • Let the pending Discord channel-runtime and package/build checks complete against the latest force-pushed head.

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 (1 earlier review cycle)
  • reviewed 2026-08-01T12:19:12.265Z sha e886313 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/issue-81518 branch from e886313 to f3e9d1b Compare August 1, 2026 14:56
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed 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 Aug 1, 2026
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer rank-up proof for exact reviewed head f3e9d1b: the dependency is pinned to @discordjs/voice 0.19.2. We inspected the actual installed CommonJS distribution: dist/index.js lines 855-861 set the reinitializing state synchronously during recoverFromInvalidTransition; lines 953-964 contain the falsy lastTransitionId=0 bug; lines 1663-1676 define the Ready-state networking/gateway event ordering. Public dist/index.d.mts exposes lastTransitionId, reinitializing and recoverFromInvalidTransition at lines 615, 635 and 685; the voice send signatures are at lines 898 and 905. The actual Blacksmith owner run exercised the exported real DAVESession with native opcode 31 followed by binary opcode 26, reproduced the zero-transition failure before the repair, and passed both owner suites, production/test type checks, scoped guards and the full packaged production build. All current required checks have now passed; the sole unrelated intermittent SQLite session-flip job passed on its one ordinary rerun, consistent with passing runs on two current main commits. No dependency internals or production owner bytes changed in the rebase.

@steipete
steipete merged commit 30972ed into main Aug 1, 2026
184 of 192 checks passed
@steipete
steipete deleted the codex/issue-81518 branch August 1, 2026 15:57
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Discord voice: UnencryptedWhenPassthroughDisabled + lastTransitionId===0 breaks voice reception (DAVE mandatory since April 2026)

1 participant