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

推荐订阅源

N
Netflix TechBlog - Medium
I
InfoQ
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
Recent Announcements
Recent Announcements
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
Docker
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
博客园 - Franky
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog RSS Feed
WordPress大学
WordPress大学
MyScale Blog
MyScale 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
test: tighten gateway restart assertions · openclaw/openc...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -66,6 +66,22 @@ vi.mock("./gateway.js", () => ({

6666

readGatewayCallOptions: vi.fn(() => ({})),

6767

}));

686869+

function requireRestartSentinelPayload(): RestartSentinelPayload {

70+

const payload = writeRestartSentinelMock.mock.calls.at(-1)?.[0];

71+

if (!payload) {

72+

throw new Error("expected restart sentinel payload");

73+

}

74+

return payload;

75+

}

76+77+

function requireScheduledRestartArgs(): NonNullable<ScheduleGatewayRestartArgs> {

78+

const args = scheduleGatewaySigusr1RestartMock.mock.calls.at(-1)?.[0];

79+

if (!args) {

80+

throw new Error("expected scheduled restart args");

81+

}

82+

return args;

83+

}

84+6985

describe("gateway tool restart continuation", () => {

7086

beforeEach(() => {

7187

isRestartEnabledMock.mockReset();

@@ -125,32 +141,26 @@ describe("gateway tool restart continuation", () => {

125141

const scheduledArgs = scheduleGatewaySigusr1RestartMock.mock.calls.at(-1)?.[0];

126142

await scheduledArgs?.emitHooks?.beforeEmit?.();

127143128-

expect(writeRestartSentinelMock).toHaveBeenCalledWith(

129-

expect.objectContaining({

130-

kind: "restart",

131-

status: "ok",

132-

sessionKey: "agent:main:main",

133-

deliveryContext: {

134-

channel: "slack",

135-

to: "slack:C123",

136-

accountId: "workspace-1",

137-

},

138-

threadId: "thread-42",

139-

message: "Gateway restarting now",

140-

continuation: {

141-

kind: "agentTurn",

142-

message: "Reply with exactly: Yay! I did it!",

143-

},

144-

}),

145-

);

146-

expect(scheduleGatewaySigusr1RestartMock).toHaveBeenCalledWith({

147-

delayMs: 250,

148-

reason: "continue after reboot",

149-

emitHooks: expect.objectContaining({

150-

beforeEmit: expect.any(Function),

151-

afterEmitRejected: expect.any(Function),

152-

}),

144+

const payload = requireRestartSentinelPayload();

145+

expect(payload.kind).toBe("restart");

146+

expect(payload.status).toBe("ok");

147+

expect(payload.sessionKey).toBe("agent:main:main");

148+

expect(payload.deliveryContext).toEqual({

149+

channel: "slack",

150+

to: "slack:C123",

151+

accountId: "workspace-1",

152+

});

153+

expect(payload.threadId).toBe("thread-42");

154+

expect(payload.message).toBe("Gateway restarting now");

155+

expect(payload.continuation).toEqual({

156+

kind: "agentTurn",

157+

message: "Reply with exactly: Yay! I did it!",

153158

});

159+

const restartArgs = requireScheduledRestartArgs();

160+

expect(restartArgs.delayMs).toBe(250);

161+

expect(restartArgs.reason).toBe("continue after reboot");

162+

expect(typeof restartArgs.emitHooks?.beforeEmit).toBe("function");

163+

expect(typeof restartArgs.emitHooks?.afterEmitRejected).toBe("function");

154164

expect(result?.details).toEqual({ scheduled: true, delayMs: 250 });

155165

});

156166

@@ -169,14 +179,10 @@ describe("gateway tool restart continuation", () => {

169179

const scheduledArgs = scheduleGatewaySigusr1RestartMock.mock.calls.at(-1)?.[0];

170180

await scheduledArgs?.emitHooks?.beforeEmit?.();

171181172-

expect(writeRestartSentinelMock).toHaveBeenCalledWith(

173-

expect.objectContaining({

174-

continuation: {

175-

kind: "agentTurn",

176-

message: "Reply after restart",

177-

},

178-

}),

179-

);

182+

expect(requireRestartSentinelPayload().continuation).toEqual({

183+

kind: "agentTurn",

184+

message: "Reply after restart",

185+

});

180186

});

181187182188

it("defaults session-scoped restarts to a success continuation", async () => {

@@ -196,15 +202,12 @@ describe("gateway tool restart continuation", () => {

196202

const scheduledArgs = scheduleGatewaySigusr1RestartMock.mock.calls.at(-1)?.[0];

197203

await scheduledArgs?.emitHooks?.beforeEmit?.();

198204199-

expect(writeRestartSentinelMock).toHaveBeenCalledWith(

200-

expect.objectContaining({

201-

sessionKey: "agent:main:main",

202-

continuation: {

203-

kind: "agentTurn",

204-

message: DEFAULT_RESTART_SUCCESS_CONTINUATION_MESSAGE,

205-

},

206-

}),

207-

);

205+

const payload = requireRestartSentinelPayload();

206+

expect(payload.sessionKey).toBe("agent:main:main");

207+

expect(payload.continuation).toEqual({

208+

kind: "agentTurn",

209+

message: DEFAULT_RESTART_SUCCESS_CONTINUATION_MESSAGE,

210+

});

208211

});

209212210213

it("removes the prepared sentinel when restart emission is rejected", async () => {