Skip to main content

Module policy

Module policy 

Source
Expand description

What a job’s policy decides about a run before it starts, and what to do when it failed (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §5.1 “Policy”). Pure: the ledger gathers who is running and acts on the answer (admission.rs).

Structs§

Occupancy
Who is running, as the ledger found it, for one job’s next run.

Enums§

Decision
What to do with a run that wants to start.

Constants§

GLOBAL_LIMIT
Unattended agent runs at once, across all jobs (§5.1): the providers’ rate limits.
GROUP_DEPLOY
The built-in concurrency group infrastructure deploys run in, one at a time (§5.1, operator decision 6).
RETRY_BACKOFF_MIN
The wait before retry number 1, 2 and 3, in minutes (§5.1).

Functions§

decide
The policy’s answer for a run of job. waiting is a run that already waits (it keeps its place; the buffer’s one place isn’t counted against it, and it is never skipped).
group_of
The job’s concurrency group: the one it names, or deploy when it declares a deploy output (deploy, deploy:prod…).
infra_retryable
Whether a run that ended should be tried again (§5.1 “Retries”): only an infrastructure failure: the agent never started, its process exited, or the provider answered with a transient error. A run whose agent concluded failed, one that hit its own timeout, and one that finished are never retried; they alert.
retry_delay_ms
Attempt attempt’s retry delay in ms (attempt 1 failed: wait 1 minute).
starts_an_agent
Whether a run of the job is an agent working unattended: a message starts a turn, a spawn starts a worker, a drone can run Agent blocks. Filing a task starts nothing. A job for which this holds is under the spending caps and the limit on agents running at once.