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

推荐订阅源

J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
C
Check Point Blog
D
Docker
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
量子位
有赞技术团队
有赞技术团队
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
M
MIT News - Artificial intelligence
B
Blog
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
月光博客
月光博客

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 cron catch-up assertions · openclaw/opencla...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -74,6 +74,28 @@ describe("CronService restart catch-up", () => {

7474

};

7575

}

767677+

function expectQueuedSystemEvent(

78+

enqueueSystemEvent: ReturnType<typeof vi.fn>,

79+

expectedText: string,

80+

) {

81+

expect(enqueueSystemEvent).toHaveBeenCalledTimes(1);

82+

const [text, options] = enqueueSystemEvent.mock.calls[0] ?? [];

83+

expect(text).toBe(expectedText);

84+

expect((options as { agentId?: string } | undefined)?.agentId).toBeUndefined();

85+

}

86+87+

function expectInterruptedJobEvent(

88+

onEvent: ReturnType<typeof vi.fn>,

89+

expected: { jobId: string; runAtMs: number },

90+

) {

91+

const event = onEvent.mock.calls

92+

.map(([evt]) => evt as CronEvent)

93+

.find((evt) => evt.action === "finished" && evt.jobId === expected.jobId);

94+

expect(event?.status).toBe("error");

95+

expect(event?.error).toBe("cron: job interrupted by gateway restart");

96+

expect(event?.runAtMs).toBe(expected.runAtMs);

97+

}

98+7799

async function withRestartedCron(

78100

jobs: unknown[],

79101

run: (params: {

@@ -130,10 +152,7 @@ describe("CronService restart catch-up", () => {

130152

},

131153

],

132154

async ({ cron, enqueueSystemEvent, requestHeartbeat }) => {

133-

expect(enqueueSystemEvent).toHaveBeenCalledWith(

134-

"digest now",

135-

expect.objectContaining({ agentId: undefined }),

136-

);

155+

expectQueuedSystemEvent(enqueueSystemEvent, "digest now");

137156

expect(requestHeartbeat).toHaveBeenCalled();

138157139158

const listedJobs = await cron.list({ includeDisabled: true });

@@ -217,9 +236,13 @@ describe("CronService restart catch-up", () => {

217236

},

218237

],

219238

async ({ cron, enqueueSystemEvent, requestHeartbeat, onEvent }) => {

220-

expect(noopLogger.warn).toHaveBeenCalledWith(

221-

expect.objectContaining({ jobId: "restart-stale-running" }),

222-

"cron: marking interrupted running job failed on startup",

239+

const warning = vi

240+

.mocked(noopLogger.warn)

241+

.mock.calls.find(

242+

([, message]) => message === "cron: marking interrupted running job failed on startup",

243+

);

244+

expect((warning?.[0] as { jobId?: string } | undefined)?.jobId).toBe(

245+

"restart-stale-running",

223246

);

224247225248

expect(enqueueSystemEvent).not.toHaveBeenCalled();

@@ -233,15 +256,10 @@ describe("CronService restart catch-up", () => {

233256

expect(updated?.state.lastRunAtMs).toBe(staleRunningAt);

234257

expect(updated?.state.lastError).toBe("cron: job interrupted by gateway restart");

235258

expect(updated?.state.nextRunAtMs).toBeGreaterThan(Date.parse("2025-12-13T17:00:00.000Z"));

236-

expect(onEvent).toHaveBeenCalledWith(

237-

expect.objectContaining({

238-

action: "finished",

239-

jobId: "restart-stale-running",

240-

status: "error",

241-

error: "cron: job interrupted by gateway restart",

242-

runAtMs: staleRunningAt,

243-

}),

244-

);

259+

expectInterruptedJobEvent(onEvent, {

260+

jobId: "restart-stale-running",

261+

runAtMs: staleRunningAt,

262+

});

245263

},

246264

);

247265

});

@@ -269,10 +287,7 @@ describe("CronService restart catch-up", () => {

269287

},

270288

],

271289

async ({ cron, enqueueSystemEvent, requestHeartbeat }) => {

272-

expect(enqueueSystemEvent).toHaveBeenCalledWith(

273-

"catch missed slot",

274-

expect.objectContaining({ agentId: undefined }),

275-

);

290+

expectQueuedSystemEvent(enqueueSystemEvent, "catch missed slot");

276291

expect(requestHeartbeat).toHaveBeenCalled();

277292278293

const listedJobs = await cron.list({ includeDisabled: true });

@@ -317,15 +332,10 @@ describe("CronService restart catch-up", () => {

317332

expect(updated?.state.lastRunAtMs).toBe(staleRunningAt);

318333

expect(updated?.state.nextRunAtMs).toBeUndefined();

319334

expect(updated?.state.lastError).toBe("cron: job interrupted by gateway restart");

320-

expect(onEvent).toHaveBeenCalledWith(

321-

expect.objectContaining({

322-

action: "finished",

323-

jobId: "restart-stale-one-shot",

324-

status: "error",

325-

error: "cron: job interrupted by gateway restart",

326-

runAtMs: staleRunningAt,

327-

}),

328-

);

335+

expectInterruptedJobEvent(onEvent, {

336+

jobId: "restart-stale-one-shot",

337+

runAtMs: staleRunningAt,

338+

});

329339

},

330340

);

331341

});

@@ -413,10 +423,7 @@ describe("CronService restart catch-up", () => {

413423

},

414424

],

415425

async ({ enqueueSystemEvent, requestHeartbeat }) => {

416-

expect(enqueueSystemEvent).toHaveBeenCalledWith(

417-

"replay after backoff elapsed",

418-

expect.objectContaining({ agentId: undefined }),

419-

);

426+

expectQueuedSystemEvent(enqueueSystemEvent, "replay after backoff elapsed");

420427

expect(requestHeartbeat).toHaveBeenCalled();

421428

},

422429

);