feat(cron): serve cron run history from the task ledger

Cron executions now write full-fidelity task_runs rows (detail_json column,
store-key scoped) and cron.runs/CLI/task-maintenance read from the ledger;
legacy cron_run_logs dual-write stays as a revert safety net. Existing
history auto-imports at first state-DB open (verified against a production
DB copy: 2750/2750 rows, byte-identical parity, idempotent). Startup crash
recovery restores finished runs from finalized ledger rows instead of
reporting synthetic interruptions.

Part 1 of 2 for #106041.
This commit is contained in:
Peter Steinberger
2026-07-13 05:48:22 -07:00
parent bfe2786957
commit 4d9052929b
36 changed files with 3179 additions and 523 deletions

View File

@@ -64,7 +64,7 @@ async function waitForCronRunCompletion(params: {
timeoutMs: number;
pollIntervalMs: number;
}): Promise<CronRunLogEntryResult> {
// Poll the run log rather than cron.run because completion state is written asynchronously.
// Poll the task ledger rather than cron.run because completion state is written asynchronously.
const startedAt = Date.now();
for (;;) {
const page = (await callGatewayFromCli("cron.runs", params.opts, {