Skip to main content

Module restore

Module restore 

Source
Expand description

Restart recovery: bring a freshly-spawned agent back to its persisted running state so the daemon resumes it where it stopped.

When the daemon restarts, the CLI reloads each non-terminal run’s blueprint and spawns a fresh agent, then calls restore_agent to overlay the persisted context, jump to the persisted stage + iteration, and restore token totals. The agent keeps the ReadyToInfer marker spawn_agent set, so any inference that was in flight when the daemon stopped is re-issued on the next tick - nothing is left stuck awaiting a job that died with the old process.

Enums§

RestorePriority
How urgently a persisted run should be brought back on restart. Ordered so a higher value restores first (see triage_restores).

Functions§

classify_restore
Classify one persisted run for restart recovery from its on-disk status and whether it is parked mid fan-out (a <run_dir>/fanout.json is present).
restore_agent
Restore a just-spawned entity to the persisted state captured in snapshot (its context), stage_index + iteration (its position), and totals (its running token/tool counts). The agent stays Active + ReadyToInfer so it resumes on the next tick.
triage_restores
Triage a set of persisted runs into the order they should be restored on restart: drop terminal runs, then rank the rest actionable-first (RestorePriority::Active before Blocked), breaking ties by most-recently updated. Each input is (meta, parked_on_fanout) where parked_on_fanout is whether the run has a fanout.json (see classify_restore); the returned RunMetas are ready to reload in order.