Skip to main content

Module job_runs

Module job_runs 

Source
Expand description

The run ledger: one row per time a job was meant to run, including the times it didn’t (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §3.1).

It lives in the always-global identity store, beside the work queue, so every channel and version on this computer sees one ledger. The unique index on (job_id, scheduled_for_ms) is the slot lease: a scheduler inserts its slot’s row before it fires, and a second scheduler sharing the job finds the slot taken and doesn’t fire.

Nothing here deletes a run: history is kept forever (§3.1, “Retention: none”). A skip folded into the previous row of the same job and reason keeps its own row, marked collapsed_into that row and left out of history, so its slot stays leased.

Modules§

infra
Infrastructure status (§3.1; the ones P1 writes).
reason
Why a run was skipped, missed or stopped, or how a pending one ended (§3.1; the ones P1 writes).
state
Run states (§3.1).

Structs§

JobFlag
A switch in db_job_flags: its value, when it was set and by whom.
JobRun
One row of db_job_runs. Field meanings are the spec’s table (§3.1).
RunCost
A finished turn’s figures, from the turn ledger (§3.2).

Constants§

OUTCOMES
What a run concluded, separate from whether it ran (§2).
SUMMARY_MAX_CHARS
The longest summary kept (§3.1).

Functions§

clip_summary
text cut to SUMMARY_MAX_CHARS, on a character boundary.