惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
WordPress大学
WordPress大学
IT之家
IT之家
G
Google Developers Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler
V
V2EX
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
V
Visual Studio Blog
有赞技术团队
有赞技术团队
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: recover Discord voice auto-join after resume · openc...
steipete · 2026-05-01 · via Recent Commits to openclaw:main

@@ -5,6 +5,7 @@ import { createVoiceReceiveRecoveryState } from "./receive-recovery.js";

5566

const {

77

createConnectionMock,

8+

getVoiceConnectionMock,

89

joinVoiceChannelMock,

910

entersStateMock,

1011

createAudioPlayerMock,

@@ -83,8 +84,11 @@ const {

8384

return connection;

8485

};

858687+

const getVoiceConnectionMock = vi.fn((): MockConnection | undefined => undefined);

88+8689

return {

8790

createConnectionMock,

91+

getVoiceConnectionMock,

8892

joinVoiceChannelMock: vi.fn(() => createConnectionMock()),

8993

entersStateMock: vi.fn(async (_target?: unknown, _state?: string, _timeoutMs?: number) => {

9094

return undefined;

@@ -118,6 +122,7 @@ vi.mock("./sdk-runtime.js", () => ({

118122

createAudioPlayer: createAudioPlayerMock,

119123

createAudioResource: vi.fn(),

120124

entersState: entersStateMock,

125+

getVoiceConnection: getVoiceConnectionMock,

121126

joinVoiceChannel: joinVoiceChannelMock,

122127

}),

123128

}));

@@ -189,6 +194,8 @@ describe("DiscordVoiceManager", () => {

189194

});

190195191196

beforeEach(() => {

197+

getVoiceConnectionMock.mockReset();

198+

getVoiceConnectionMock.mockReturnValue(undefined);

192199

joinVoiceChannelMock.mockReset();

193200

joinVoiceChannelMock.mockImplementation(() => createConnectionMock());

194201

entersStateMock.mockReset();

@@ -313,6 +320,52 @@ describe("DiscordVoiceManager", () => {

313320

expectConnectedStatus(manager, "1002");

314321

});

315322323+

it("destroys stale tracked voice connections before joining", async () => {

324+

const staleConnection = createConnectionMock();

325+

const connection = createConnectionMock();

326+

getVoiceConnectionMock.mockReturnValueOnce(staleConnection);

327+

joinVoiceChannelMock.mockReturnValueOnce(connection);

328+

const manager = createManager();

329+330+

await manager.join({ guildId: "g1", channelId: "1001" });

331+332+

expect(getVoiceConnectionMock).toHaveBeenCalledWith("g1");

333+

expect(staleConnection.destroy).toHaveBeenCalledTimes(1);

334+

expectConnectedStatus(manager, "1001");

335+

});

336+337+

it("does not throw when stale tracked voice connections are already destroyed", async () => {

338+

const staleConnection = createConnectionMock();

339+

staleConnection.state.status = "destroyed";

340+

staleConnection.destroy.mockImplementation(() => {

341+

throw new Error("Cannot destroy VoiceConnection - it has already been destroyed");

342+

});

343+

getVoiceConnectionMock.mockReturnValueOnce(staleConnection);

344+

joinVoiceChannelMock.mockReturnValueOnce(createConnectionMock());

345+

const manager = createManager();

346+347+

await expect(manager.join({ guildId: "g1", channelId: "1001" })).resolves.toMatchObject({

348+

ok: true,

349+

});

350+351+

expect(staleConnection.destroy).not.toHaveBeenCalled();

352+

});

353+354+

it("does not throw when leaving an already destroyed voice connection", async () => {

355+

const connection = createConnectionMock();

356+

connection.destroy.mockImplementation(() => {

357+

throw new Error("Cannot destroy VoiceConnection - it has already been destroyed");

358+

});

359+

joinVoiceChannelMock.mockReturnValueOnce(connection);

360+

const manager = createManager();

361+362+

await manager.join({ guildId: "g1", channelId: "1001" });

363+

connection.state.status = "destroyed";

364+365+

await expect(manager.leave({ guildId: "g1" })).resolves.toMatchObject({ ok: true });

366+

expect(connection.destroy).not.toHaveBeenCalled();

367+

});

368+316369

it("removes voice listeners on leave", async () => {

317370

const connection = createConnectionMock();

318371

joinVoiceChannelMock.mockReturnValueOnce(connection);

@@ -850,4 +903,15 @@ describe("DiscordVoiceManager", () => {

850903

await expect(listener.handle(undefined, undefined as never)).resolves.not.toThrow();

851904

expect(autoJoinSpy).toHaveBeenCalledTimes(1);

852905

});

906+907+

it("DiscordVoiceResumedListener: runs autoJoin on gateway resume", async () => {

908+

const manager = createManager();

909+

const autoJoinSpy = vi.spyOn(manager, "autoJoin").mockResolvedValue(undefined);

910+911+

const { DiscordVoiceResumedListener } = managerModule;

912+

const listener = new DiscordVoiceResumedListener(manager);

913+914+

await expect(listener.handle(undefined, undefined as never)).resolves.not.toThrow();

915+

expect(autoJoinSpy).toHaveBeenCalledTimes(1);

916+

});

853917

});