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

推荐订阅源

罗磊的独立博客
I
InfoQ
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
博客园_首页
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
G
Google Developers Blog
WordPress大学
WordPress大学
B
Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
量子位
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
博客园 - 聂微东
Jina AI
Jina AI

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): preserve unsupported payload rows on writes · ...
IWhatsskill · 2026-05-26 · via Recent Commits to openclaw:main

@@ -15,13 +15,17 @@ const { logger, makeStorePath } = setupCronServiceSuite({

1515

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

16161717

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

18+

await writeJobStore(storePath, [job]);

19+

}

20+21+

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

1822

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

1923

await fs.writeFile(

2024

storePath,

2125

JSON.stringify(

2226

{

2327

version: 1,

24-

jobs: [job],

28+

jobs,

2529

},

2630

null,

2731

2,

@@ -130,6 +134,95 @@ describe("cron service store seam coverage", () => {

130134

expect((state.storeFileMtimeMs ?? 0) >= (firstMtime ?? 0)).toBe(true);

131135

});

132136137+

it("preserves unsupported payload-kind rows across full persistence without loading them", async () => {

138+

const { storePath } = await makeStorePath();

139+140+

await writeJobStore(storePath, [

141+

{

142+

id: "valid-job",

143+

name: "valid job",

144+

enabled: true,

145+

createdAtMs: STORE_TEST_NOW - 60_000,

146+

updatedAtMs: STORE_TEST_NOW - 60_000,

147+

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

148+

sessionTarget: "main",

149+

wakeMode: "now",

150+

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

151+

state: {},

152+

},

153+

{

154+

id: "legacy-command",

155+

name: "legacy command",

156+

enabled: true,

157+

createdAtMs: STORE_TEST_NOW - 60_000,

158+

updatedAtMs: STORE_TEST_NOW - 60_000,

159+

schedule: { kind: "cron", expr: "0 8 * * *", tz: "UTC" },

160+

sessionTarget: "main",

161+

wakeMode: "now",

162+

payload: { kind: "command", command: "echo daily" },

163+

state: { lastRunAtMs: STORE_TEST_NOW - 3_600_000 },

164+

},

165+

{

166+

id: "legacy-agentmessage",

167+

name: "legacy agentmessage",

168+

enabled: true,

169+

createdAtMs: STORE_TEST_NOW - 60_000,

170+

schedule: { kind: "cron", expr: "0 9 * * *", tz: "UTC" },

171+

sessionTarget: "isolated",

172+

wakeMode: "now",

173+

payload: { kind: "agentmessage", message: "summarize" },

174+

metadata: { preserve: { nested: true } },

175+

},

176+

]);

177+178+

const state = createStoreTestState(storePath);

179+

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

180+181+

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

182+

expect(() => findJobOrThrow(state, "legacy-command")).toThrow(/unknown cron job id/);

183+

expect(() => findJobOrThrow(state, "legacy-agentmessage")).toThrow(/unknown cron job id/);

184+185+

const valid = findJobOrThrow(state, "valid-job");

186+

valid.name = "valid job renamed";

187+

await persist(state);

188+189+

const config = JSON.parse(await fs.readFile(storePath, "utf8")) as {

190+

jobs: Array<Record<string, unknown>>;

191+

};

192+

expect(config.jobs.map((job) => job.id)).toEqual([

193+

"valid-job",

194+

"legacy-command",

195+

"legacy-agentmessage",

196+

]);

197+

expect(config.jobs[0]?.name).toBe("valid job renamed");

198+

expect(config.jobs[1]).toMatchObject({

199+

id: "legacy-command",

200+

payload: { kind: "command", command: "echo daily" },

201+

state: { lastRunAtMs: STORE_TEST_NOW - 3_600_000 },

202+

});

203+

expect(config.jobs[2]).toMatchObject({

204+

id: "legacy-agentmessage",

205+

payload: { kind: "agentmessage", message: "summarize" },

206+

metadata: { preserve: { nested: true } },

207+

});

208+

expect(config.jobs[2]).not.toHaveProperty("state");

209+

expect(config.jobs[2]).not.toHaveProperty("updatedAtMs");

210+211+

const stateFile = JSON.parse(

212+

await fs.readFile(storePath.replace(/\.json$/, "-state.json"), "utf8"),

213+

) as { jobs: Record<string, unknown> };

214+

expect(Object.keys(stateFile.jobs)).toEqual(["valid-job"]);

215+216+

const invalidPayloadWarns = logger.warn.mock.calls.filter((call) => {

217+

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

218+

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

219+

});

220+

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

221+

"legacy-command",

222+

"legacy-agentmessage",

223+

]);

224+

});

225+133226

it("normalizes jobId-only jobs in memory so scheduler lookups resolve by stable id", async () => {

134227

const { storePath } = await makeStorePath();

135228