Skip to content

Commit 3fb689a

Browse files
committed
fix(cron): add agentSetupWatchdogMs to strict runtime config schema
OpenClawSchema makes cron strict and did not include agentSetupWatchdogMs, so the new key failed to parse from real config (Unrecognized key), breaking the feature as shipped. Add it to the cron zod schema and a config-parse regression test covering accept / omit / reject cases.
1 parent acc7542 commit 3fb689a

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { describe, it, expect } from "vitest";
2+
import { OpenClawSchema } from "./zod-schema.js";
3+
4+
describe("cron agentSetupWatchdogMs config parsing", () => {
5+
it("accepts a positive integer value", () => {
6+
const parsed = OpenClawSchema.parse({
7+
cron: { agentSetupWatchdogMs: 120000 },
8+
});
9+
expect(parsed.cron?.agentSetupWatchdogMs).toBe(120000);
10+
});
11+
12+
it("parses cleanly when the key is omitted", () => {
13+
const parsed = OpenClawSchema.parse({
14+
cron: { maxConcurrentRuns: 2 },
15+
});
16+
expect(parsed.cron?.agentSetupWatchdogMs).toBeUndefined();
17+
});
18+
19+
it("rejects non-integer values", () => {
20+
expect(() =>
21+
OpenClawSchema.parse({
22+
cron: { agentSetupWatchdogMs: 1500.5 },
23+
}),
24+
).toThrow();
25+
});
26+
27+
it("rejects non-positive values", () => {
28+
expect(() =>
29+
OpenClawSchema.parse({
30+
cron: { agentSetupWatchdogMs: 0 },
31+
}),
32+
).toThrow();
33+
});
34+
});

src/config/zod-schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ export const OpenClawSchema = z
751751
enabled: z.boolean().optional(),
752752
store: z.string().optional(),
753753
maxConcurrentRuns: z.number().int().positive().optional(),
754+
agentSetupWatchdogMs: z.number().int().positive().optional(),
754755
retry: z
755756
.object({
756757
maxAttempts: z.number().int().min(0).max(10).optional(),

0 commit comments

Comments
 (0)