Expand description
Jobs: things that run by themselves, and the one run ledger under them (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §3).
RunLedger writes db_job_runs rows (storage::job_runs) for cron
fires and Drone runs, follows a delivered fire’s turn to its end
(follower), and on startup closes the runs a restart interrupted.
After each change it nudges incidents, which opens one incident per
failing job (§3.4).
Cron fires are never held for a stopped agent: an undelivered fire is
missed, or, under catch-up latest, the job’s one pending fire (§3.2,
§5.2), which the scheduler delivers when the agent is back.
Modules§
- admission
- Letting a run start under its job’s policy
(docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §5.1 “Policy”): overlap,
concurrency groups and the global limit when it wants to start, the
timeout while it runs, and the retry of an infrastructure failure when it
ends. The decisions are
policy.rs; this reads who is running from the ledger and writes the rows. - app_
events - App events: something inside AgentMux happened, and a job on the
app_eventsource starts a run (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2, §3.2.1). - cap_
alert - The alert for a job’s first cap skip of the day (docs/specs/ SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §5.3): one note to the owning leader and one notification to the operator. No Kanban task: a skip is the cap doing its work, not a failure. The job isn’t paused and its runs resume the next day.
- caps
- Spending caps for job runs (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md
§5.3): the defaults Settings → Jobs holds, the figures a job’s
policy.capsmay lower, and the rules that decide, from the spend the ledger found, whether a run may start. Pure:reservation.rsreads the ledger and acts on the answer. - cloud_
events - Cloud jobs report in: the signed run event (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §4.1, §4.2).
- cloud_
hub - Where cloud job events enter this AgentMux (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §4.2).
- definition
- The job definition (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md
§5.1): a trigger, an action, a policy and an owner, as JSON. Published as
schema/agentmux-job.v1.schema.json;definition_tests.rspins the two together. - expect
- A job on the
expectsource is a dead man’s switch: it starts a run when a job it watches has not had a good run lately (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2). Silence is the event: “the nightly report did not come” is the failure nobody sees, and this is how someone does. - file_
watch - File watch: a path in a workspace changed, and a job on the
file_watchsource starts a run (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2). - follower
- The turn follower: a delivered run follows its pane’s
agentturnevents (blockcontroller::health::TurnLedger) to the end of the turn it started or joined, and takes that turn’s cost, output tokens and steps (spec §3.2). - from_
template - A job made from a template, and a template’s update diff (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §5.4).
- incidents
- When a job’s run fails: one incident per job, not one per run (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §3.4).
- paused
- The slots a paused job lets pass: each is counted into one collapsed
skipped (paused)row (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §3.3, Pause / Resume). A paused job has no scheduler task, so a minute timer here walks the paused jobs’ slots since its last look. Pause all’s skips are the scheduler’s own (CronScheduler::fire): those jobs still have their task. - policy
- 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). - poll
- A job on the
pollsource asks AgentMux’s own state a question every so often and starts one run for each item that is new in the answer (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2). Polling spends no agent tokens: the question is one of the App query’s, answered by srv. - remote
- A run delivered to an agent in another channel (#1988, spec §3.2).
- reporters
- The cloud reporters the operator pinned (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §4.2).
- reservation
- Spending caps at work (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md
§5.3): the reservation before a run starts, the stop when a run reaches
its own cap, and the skips a cap makes. The rules are
caps.rs; this reads the spend from the ledger and writes the rows. - verdict
- What a run concluded for the Jobs tab: whether it failed, and whether its job is failing (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §3.4), and the state a job is in (§3.3).
- watchdog
- The watchdog for cloud jobs (docs/specs/SPEC_JOBS_AND_TEMPLATES_2026_10_24.md §4.4).
- webhook_
local - A job on the
webhook_localsource starts a run when a script on this computer POSTs tohttp://127.0.0.1:<port>/agentmux/hook/<job id>with the job’s secret (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2; the route isserver::hook_handlers).
Structs§
- RunLedger
- The run ledger, shared by the cron scheduler, the Drone handlers and the Schedule routes.
Enums§
- Begin
- What inserting a cron slot’s row answered.
Constants§
- BY_
EVENT triggered_byfor an event’s run is this, then:and the source (event:app_event).- BY_
OPERATOR - BY_
SCHEDULER triggered_byfor runs the scheduler starts, and for the operator.- CATCH_
UP_ LATEST - CATCH_
UP_ SKIP - A cron job’s catch-up policy (§5.2): what an undelivered fire leaves.
- DRONE_
STATUS_ INTERRUPTED - The status a Drone run left
runningby a restart gets indb_drone_runs(§3.2). An open string there, like every other status. - FLAG_
PAUSED_ ALL - The identity-store switch Pause all sets (§3.3): while it is on, every
scheduled fire is a collapsed
skipped (paused_all)row and Run now is refused. Only the operator turns it on or off. - OVERLAP_
REFUSAL - What a Run now gets while the job’s previous run is still going and its
policy
overlapisskip. - PAUSED_
ALL_ REFUSAL - What a Run now gets while Pause all is on.
- SOURCE_
CLOUD - SOURCE_
CRON - Job kinds in
job_source(§3.1). - SOURCE_
DRONE - TRIGGER_
CATCH_ UP - TRIGGER_
EVENT - TRIGGER_
MANUAL - TRIGGER_
RETRY - TRIGGER_
SCHEDULE - Run triggers in
trigger(§3.1).
Functions§
- brief_
line - The line a fire’s prompt ends with: the run id, and how to report (§3.2).
A late fire (a catch-up, a pending fire delivered when its agent came
back) also says which slot it was for and when it started, so the agent
can tell its work is late. Plain text: srv rewrites
[AgentMux]markers in anything forwarded. - drone_
cost - The summed
cost_usdof a Drone run’s blocks: only Agent blocks report one, in their output (drone/executor/blocks/agent.rs). Known only when at least one block reported a cost. - missed_
slots - Missed slots of a job’s
scheduleafterbase_msand beforenow_ms: the newest, and the earlier ones as(first, count). The newest is the schedule’s last slot before now, found directly, so it is right after any downtime; only the count of earlier ones stops atcap, so a one-minute job off for a year costs bounded work. - next_
slot_ after - The job’s next fire time after
slot_ms: when a pending fire for that slot expires (§5.2).Nonefor a job whose trigger has no later slot or doesn’t read. - pending_
wake - Woken whenever an agent registers (
reactive::registered), so a pending fire reaches its agent as soon as it is back. - registered_
in_ another_ channel - Whether the agent with
uidis registered by another channel’s AgentMux on this computer and that process is alive: the cross-channel tier the inject path forwards to (Tier 2b, the host-global shared registry). A pending fire whose agent lives there is delivered through it, rather than expiring here unseen.
Type Aliases§
- Block
Hook - Something done to a pane, by its block id: interrupting its turn, stopping a worker.