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

推荐订阅源

N
Netflix TechBlog - Medium
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
博客园 - Franky
F
Fortinet All Blogs
D
Docker
博客园 - 司徒正美
腾讯CDC
Recent Announcements
Recent Announcements
The Cloudflare Blog
B
Blog RSS Feed
GbyAI
GbyAI
T
Tailwind CSS Blog
雷峰网
雷峰网
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
阮一峰的网络日志
阮一峰的网络日志

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: suppress discord reconnect exhaustion during shutdow...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -175,12 +175,13 @@ describe("runDiscordGatewayLifecycle", () => {

175175

threadStop: ReturnType<typeof vi.fn>;

176176

waitCalls: number;

177177

gatewaySupervisor: { detachLifecycle: ReturnType<typeof vi.fn> };

178+

detachCalls?: number;

178179

}) {

179180

expect(waitForDiscordGatewayStopMock).toHaveBeenCalledTimes(params.waitCalls);

180181

expect(unregisterGatewayMock).toHaveBeenCalledWith("default");

181182

expect(stopGatewayLoggingMock).toHaveBeenCalledTimes(1);

182183

expect(params.threadStop).toHaveBeenCalledTimes(1);

183-

expect(params.gatewaySupervisor.detachLifecycle).toHaveBeenCalledTimes(1);

184+

expect(params.gatewaySupervisor.detachLifecycle).toHaveBeenCalledTimes(params.detachCalls ?? 1);

184185

}

185186186187

it("resolves gateway READY timeouts from config, env, then defaults", () => {

@@ -509,6 +510,60 @@ describe("runDiscordGatewayLifecycle", () => {

509510

});

510511

});

511512513+

it("treats abort-time live reconnect exhaustion as expected shutdown", async () => {

514+

const abortController = new AbortController();

515+

let liveGatewayHandler: ((event: DiscordGatewayEvent) => void) | undefined;

516+

const { lifecycleParams, threadStop, runtimeLog, runtimeError, gatewaySupervisor } =

517+

createLifecycleHarness();

518+

lifecycleParams.abortSignal = abortController.signal;

519+

gatewaySupervisor.attachLifecycle.mockImplementation(

520+

(handler: (event: DiscordGatewayEvent) => void) => {

521+

liveGatewayHandler = handler;

522+

},

523+

);

524+

abortController.signal.addEventListener(

525+

"abort",

526+

() => {

527+

if (!liveGatewayHandler) {

528+

throw new Error("discord gateway lifecycle handler was not attached");

529+

}

530+

liveGatewayHandler(

531+

createGatewayEvent(

532+

"reconnect-exhausted",

533+

"Max reconnect attempts (50) reached after close code 1005",

534+

),

535+

);

536+

},

537+

{ once: true },

538+

);

539+

waitForDiscordGatewayStopMock.mockImplementationOnce(async (waitParams) => {

540+

const actual =

541+

await vi.importActual<typeof import("../monitor.gateway.js")>("../monitor.gateway.js");

542+

const waitPromise = actual.waitForDiscordGatewayStop(waitParams);

543+

abortController.abort(new Error("shutdown"));

544+

return await waitPromise;

545+

});

546+547+

await expect(runDiscordGatewayLifecycle(lifecycleParams)).resolves.toBeUndefined();

548+549+

expect(gatewaySupervisor.attachLifecycle).toHaveBeenCalledTimes(1);

550+

expect(runtimeLog).toHaveBeenCalledWith(

551+

expect.stringContaining("treating reconnect-exhausted during expected shutdown as clean"),

552+

);

553+

expect(runtimeLog).toHaveBeenCalledWith(

554+

expect.stringContaining("Max reconnect attempts (50) reached after close code 1005"),

555+

);

556+

expect(runtimeError).not.toHaveBeenCalledWith(

557+

expect.stringContaining("discord gateway reconnect-exhausted"),

558+

);

559+

expectLifecycleCleanup({

560+

threadStop,

561+

waitCalls: 1,

562+

gatewaySupervisor,

563+

detachCalls: 2,

564+

});

565+

});

566+512567

it("surfaces fatal startup gateway errors while waiting for READY", async () => {

513568

vi.useFakeTimers();

514569

try {