fix(cron): add audit logging for job create/update/remove (openclaw#25090) thanks @MoerAI

Verified:
- pnpm install --frozen-lockfile
- pnpm check
- pnpm test -- --run src/gateway/server-cron.test.ts src/gateway/server-methods/server-methods.test.ts src/gateway/protocol/cron-validators.test.ts

Co-authored-by: MoerAI <26067127+MoerAI@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
ToToKr
2026-03-01 21:55:48 +09:00
committed by GitHub
parent 5b49cc4129
commit 62a7683ce6
2 changed files with 6 additions and 0 deletions

View File

@@ -112,6 +112,7 @@ export const cronHandlers: GatewayRequestHandlers = {
return;
}
const job = await context.cron.add(jobCreate);
context.logGateway.info("cron: job created", { jobId: job.id, schedule: jobCreate.schedule });
respond(true, job, undefined);
},
"cron.update": async ({ params, respond, context }) => {
@@ -158,6 +159,7 @@ export const cronHandlers: GatewayRequestHandlers = {
}
}
const job = await context.cron.update(jobId, patch);
context.logGateway.info("cron: job updated", { jobId });
respond(true, job, undefined);
},
"cron.remove": async ({ params, respond, context }) => {
@@ -183,6 +185,9 @@ export const cronHandlers: GatewayRequestHandlers = {
return;
}
const result = await context.cron.remove(jobId);
if (result.removed) {
context.logGateway.info("cron: job removed", { jobId });
}
respond(true, result, undefined);
},
"cron.run": async ({ params, respond, context }) => {