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

推荐订阅源

罗磊的独立博客
The GitHub Blog
The GitHub Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
小众软件
小众软件
博客园_首页
G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Docker
B
Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow 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(cron): skip malformed persisted jobs · openclaw/openc...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -13,8 +13,12 @@ const { logger, makeStorePath } = setupCronServiceSuite({

1313

const STORE_TEST_NOW = Date.parse("2026-03-23T12:00:00.000Z");

14141515

async function writeSingleJobStore(storePath: string, job: Record<string, unknown>) {

16+

await writeJobStore(storePath, [job]);

17+

}

18+19+

async function writeJobStore(storePath: string, jobs: Array<Record<string, unknown>>) {

1620

await fs.mkdir(path.dirname(storePath), { recursive: true });

17-

await fs.writeFile(storePath, JSON.stringify({ version: 1, jobs: [job] }, null, 2), "utf8");

21+

await fs.writeFile(storePath, JSON.stringify({ version: 1, jobs }, null, 2), "utf8");

1822

}

19232024

function createStoreTestState(storePath: string) {

@@ -118,6 +122,70 @@ describe("cron service store load: missing sessionTarget", () => {

118122

expect(() => assertSupportedJobSpec(bogus)).toThrow(/missing sessionTarget/);

119123

});

120124125+

it("skips malformed persisted schedule and payload shapes without rewriting the store", async () => {

126+

const { storePath } = await makeStorePath();

127+128+

await writeJobStore(storePath, [

129+

{

130+

id: "valid-job",

131+

name: "valid job",

132+

enabled: true,

133+

createdAtMs: STORE_TEST_NOW - 60_000,

134+

updatedAtMs: STORE_TEST_NOW - 60_000,

135+

schedule: { kind: "every", everyMs: 60_000 },

136+

sessionTarget: "main",

137+

wakeMode: "now",

138+

payload: { kind: "systemEvent", text: "tick" },

139+

state: {},

140+

},

141+

{

142+

id: "bad-schedule",

143+

name: "bad schedule",

144+

enabled: true,

145+

createdAtMs: STORE_TEST_NOW - 60_000,

146+

updatedAtMs: STORE_TEST_NOW - 60_000,

147+

schedule: ["every", 60_000],

148+

sessionTarget: "main",

149+

wakeMode: "now",

150+

payload: { kind: "systemEvent", text: "tick" },

151+

state: {},

152+

},

153+

{

154+

id: "bad-payload",

155+

name: "bad payload",

156+

enabled: true,

157+

createdAtMs: STORE_TEST_NOW - 60_000,

158+

updatedAtMs: STORE_TEST_NOW - 60_000,

159+

schedule: { kind: "every", everyMs: 60_000 },

160+

sessionTarget: "main",

161+

wakeMode: "now",

162+

payload: ["systemEvent", "tick"],

163+

state: {},

164+

},

165+

]);

166+

const beforeRaw = await fs.readFile(storePath, "utf-8");

167+

const warnSpy = vi.spyOn(logger, "warn");

168+169+

const state = createStoreTestState(storePath);

170+

await ensureLoaded(state);

171+

await ensureLoaded(state, { forceReload: true });

172+173+

expect(state.store?.jobs.map((job) => job.id)).toEqual(["valid-job"]);

174+

expect(findJobOrThrow(state, "valid-job").state.nextRunAtMs).toBe(STORE_TEST_NOW);

175+

await expect(fs.readFile(storePath, "utf-8")).resolves.toBe(beforeRaw);

176+177+

const invalidShapeWarns = warnSpy.mock.calls.filter((call) => {

178+

const msg = typeof call[1] === "string" ? call[1] : "";

179+

return msg.includes("skipped invalid persisted job");

180+

});

181+

expect(invalidShapeWarns).toHaveLength(2);

182+

expect(invalidShapeWarns.map((call) => (call[0] as { reason?: string }).reason)).toEqual([

183+

"missing-schedule",

184+

"missing-payload",

185+

]);

186+

warnSpy.mockRestore();

187+

});

188+121189

it("warns once per jobId across repeated forceReload cycles", async () => {

122190

const { storePath } = await makeStorePath();

123191