/** * Work that is still marked in flight long after anything could be running it: * `automation_runs` rows left `running` by a worker that died, and A2A tasks * stuck `submitted`/`working`/`processing` because nobody polled them (the * only other recovery runs lazily on `tasks/get`). They keep dashboards and * "is it running?" checks lying until something closes them. * * Runs from the scheduler tick, never at module load: each pass is one bounded * UPDATE and is throttled, so cold starts and idle ticks do no sweeping. */ /** Must stay above `REMOTE_AUTOMATION_MAX_ACTIVE_MS` (24h), the longest a run may legitimately stay active. */ export declare const STALE_AUTOMATION_RUN_AFTER_MS: number; /** The lazy A2A recovery fails processing tasks after 30 minutes; this only catches what it never saw. */ export declare const STALE_A2A_TASK_AFTER_MS: number; export declare const REAP_BATCH_LIMIT = 50; export declare const REAP_INTERVAL_MS: number; export declare const AUTOMATION_RUN_ABANDONED_ERROR_CODE = "automation_run_abandoned"; export declare const A2A_TASK_ABANDONED_ERROR_CODE = "a2a_task_abandoned"; /** * Closes `running` automation runs older than the longest legitimate run as * `interrupted` with a typed code — never `success`. Rows are updated * directly, so a months-old run does not email its owner as if it had just * failed. Idempotent: only `running` rows match. */ export declare function reapStaleAutomationRuns(options?: { now?: number; limit?: number; }): Promise; /** * Fails A2A tasks that have shown no activity for a day. An app that never * created the A2A tables has nothing to reap; any other failure is surfaced. */ export declare function reapStaleA2ATasks(options?: { now?: number; limit?: number; }): Promise; export interface StaleWorkReapResult { automationRuns: number; a2aTasks: number; failed: string[]; } /** * One throttled, row-capped pass over both sweeps. Returns null when the * throttle skipped it, so a caller can tell "nothing stuck" from "did not look". */ export declare function reapStaleWork(options?: { now?: number; }): Promise; export declare function resetStaleWorkReapThrottle(): void;