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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Blog — PlanetScale
Blog — PlanetScale
博客园 - Franky
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
D
Docker
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
N
Netflix TechBlog - Medium
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
H
Help Net Security
B
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(discord): align internal gateway and component parity...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -56,6 +56,16 @@ class TestGatewayPlugin extends GatewayPlugin {

5656

}

5757

}

585859+

type GatewaySessionState = {

60+

sessionId: string | null;

61+

resumeGatewayUrl: string | null;

62+

sequence: number | null;

63+

};

64+65+

function gatewaySessionState(gateway: GatewayPlugin): GatewaySessionState {

66+

return gateway as unknown as GatewaySessionState;

67+

}

68+5969

describe("GatewayPlugin", () => {

6070

afterEach(() => {

6171

vi.useRealTimers();

@@ -263,20 +273,71 @@ describe("GatewayPlugin", () => {

263273

expect(gateway.sockets).toHaveLength(2);

264274

});

265275266-

it("re-identifies after non-resumable gateway closes", async () => {

276+

it.each([GatewayCloseCodes.InvalidSeq, GatewayCloseCodes.AlreadyAuthenticated])(

277+

"re-identifies after non-resumable gateway close %s",

278+

async (closeCode) => {

279+

vi.useFakeTimers();

280+

const gateway = new TestGatewayPlugin({

281+

autoInteractions: false,

282+

url: "wss://gateway.example.test",

283+

});

284+285+

gateway.connect(false);

286+

gateway.sockets[0]?.emit("open");

287+

gateway.sockets[0]?.emit("close", closeCode);

288+

await vi.advanceTimersByTimeAsync(2_000);

289+290+

expect(gateway.connectCalls).toEqual([false, false]);

291+

expect(gateway.sockets).toHaveLength(2);

292+

},

293+

);

294+295+

it("clears resume state after invalid session false", async () => {

267296

vi.useFakeTimers();

268297

const gateway = new TestGatewayPlugin({

269298

autoInteractions: false,

270299

url: "wss://gateway.example.test",

271300

});

301+

const sessionState = gatewaySessionState(gateway);

302+

sessionState.sessionId = "session1";

303+

sessionState.resumeGatewayUrl = "wss://resume.example.test";

304+

sessionState.sequence = 123;

272305273306

gateway.connect(false);

274307

gateway.sockets[0]?.emit("open");

275-

gateway.sockets[0]?.emit("close", GatewayCloseCodes.InvalidSeq);

308+

(

309+

gateway as unknown as {

310+

handlePayload(payload: { op: number; d: unknown }, resume: boolean): void;

311+

}

312+

).handlePayload({ op: GatewayOpcodes.InvalidSession, d: false }, true);

276313

await vi.advanceTimersByTimeAsync(2_000);

277314278315

expect(gateway.connectCalls).toEqual([false, false]);

279-

expect(gateway.sockets).toHaveLength(2);

316+

expect(sessionState.sessionId).toBeNull();

317+

expect(sessionState.resumeGatewayUrl).toBeNull();

318+

expect(sessionState.sequence).toBeNull();

319+

});

320+321+

it("includes close code details when reconnect attempts are exhausted", async () => {

322+

vi.useFakeTimers();

323+

const gateway = new TestGatewayPlugin({

324+

autoInteractions: false,

325+

reconnect: { maxAttempts: 0 },

326+

url: "wss://gateway.example.test",

327+

});

328+

const errorSpy = vi.fn();

329+

gateway.emitter.on("error", errorSpy);

330+331+

gateway.connect(false);

332+

gateway.sockets[0]?.emit("open");

333+

gateway.sockets[0]?.emit("close", 1006);

334+

await vi.advanceTimersByTimeAsync(30_000);

335+336+

expect(errorSpy).toHaveBeenCalledWith(

337+

new Error("Max reconnect attempts (0) reached after close code 1006"),

338+

);

339+

expect(gateway.connectCalls).toEqual([false]);

340+

expect(gateway.sockets).toHaveLength(1);

280341

});

281342282343

it("does not reconnect after fatal gateway closes", async () => {