mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 08:41:10 +00:00
feat(cron): configurable failure alerts for repeated job errors (openclaw#24789) thanks @0xbrak
Verified: - pnpm install --frozen-lockfile - pnpm check - pnpm test -- --run src/cron/service.failure-alert.test.ts src/cli/cron-cli.test.ts src/gateway/protocol/cron-validators.test.ts Co-authored-by: 0xbrak <181251288+0xbrak@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -56,6 +56,13 @@ export type CronRunOutcome = {
|
||||
sessionKey?: string;
|
||||
};
|
||||
|
||||
export type CronFailureAlert = {
|
||||
after?: number;
|
||||
channel?: CronMessageChannel;
|
||||
to?: string;
|
||||
cooldownMs?: number;
|
||||
};
|
||||
|
||||
export type CronPayload =
|
||||
| { kind: "systemEvent"; text: string }
|
||||
| {
|
||||
@@ -102,6 +109,8 @@ export type CronJobState = {
|
||||
lastDurationMs?: number;
|
||||
/** Number of consecutive execution errors (reset on success). Used for backoff. */
|
||||
consecutiveErrors?: number;
|
||||
/** Last failure alert timestamp (ms since epoch) for cooldown gating. */
|
||||
lastFailureAlertAtMs?: number;
|
||||
/** Number of consecutive schedule computation errors. Auto-disables job after threshold. */
|
||||
scheduleErrorCount?: number;
|
||||
/** Explicit delivery outcome, separate from execution outcome. */
|
||||
@@ -128,6 +137,7 @@ export type CronJob = {
|
||||
wakeMode: CronWakeMode;
|
||||
payload: CronPayload;
|
||||
delivery?: CronDelivery;
|
||||
failureAlert?: CronFailureAlert | false;
|
||||
state: CronJobState;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user