fix(gateway): use rtc_server_id-1 as watch DAVE MLS channelId (WrongGroupId)
Live log (14:52) showed the stream-watch flow reaching STREAM_CREATE + STREAM_SERVER_UPDATE but then DAVE processProposals threw 'ValidationError(WrongGroupId)' -- the Davey MLS session derived the wrong group because connectionOptions.channelId was the guild voice channel id. Per Discord-RE StreamConnection.daveChannelId = BigInt(serverId)-1n, the stream-watch DAVE MLS group is keyed to rtc_server_id-1, not the vc channel. Fix: pass BigInt(serverId)-1n as channelId to the watch Networking. This error also surface as an uncaughtException that crashed the gateway (systemd restarted it). Correct channel id prevents it at the root.
This commit is contained in:
@@ -224,6 +224,20 @@ function connectWatch(
|
||||
"Opening DAVE Networking to watch RTC",
|
||||
);
|
||||
|
||||
// CRITICAL: for a STREAM-WATCH RTC the DAVE MLS group is keyed to
|
||||
// `rtc_server_id - 1` (see Discord-RE StreamConnection.daveChannelId =
|
||||
// BigInt(serverId)-1n), NOT the guild voice channel id. Passing the guild
|
||||
// voice channel id as `connectionOptions.channelId` makes the Davey session
|
||||
// derive the wrong MLS group → "WrongGroupId" on proposals → never Ready.
|
||||
// `serverId` stays the rtc_server_id (used in the voice identify server_id).
|
||||
const daveChannelId = (() => {
|
||||
try {
|
||||
return (BigInt(serverId) - 1n).toString();
|
||||
} catch {
|
||||
return channelId; // fallback: non-numeric serverId — use channel id
|
||||
}
|
||||
})();
|
||||
|
||||
const net = new Networking(
|
||||
{
|
||||
endpoint,
|
||||
@@ -231,7 +245,7 @@ function connectWatch(
|
||||
userId: botId,
|
||||
sessionId: sessionId ?? "none",
|
||||
token,
|
||||
channelId,
|
||||
channelId: daveChannelId,
|
||||
},
|
||||
{ daveEncryption: true },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user