Expand description
What app_main starts once the app state exists, in the order it started them: the
hooks that let an agent be reached and resumed, the job run ledger and the cron
scheduler, the sagas an earlier run left unresolved, and the services that run beside
the server. Moved out of app_main without a change in behaviour.
Functions§
- announce_
ready - Tells the launcher srv is ready (the pipe on Windows, then
AGENTMUXSRV-ESTART), logs the boot summary and queues the saga log’s pruning. - attach_
listeners - Hands the LAN listeners their routers and starts the dev proxy.
- install_
lan_ 🔒sync - What this machine sends the machines on the LAN that are behind: fleet Global Memory entries, and the collections (Kanban boards) it shares with them (SPEC_USER_DATA_SYNC_LAYER §4.2).
- install_
message_ 🔒brokers - Starts the services that run beside the server and need the app state. The panes that watch messages are told as they happen: the Audit when a row is written, the Atlas map when a message goes between two agents.
- install_
state_ hooks - Wires delivery and the restart-time resumers to the app state, and starts the native memory watchers.
- install_
turn_ 🔒outcome_ notes - Tells whoever needs to know when a turn’s outcome wasn’t otherwise reported: a worker’s leader
(
worker_notes, SPEC_AGENT_WORKERS_2026_10_15.md §3.3), and, since #2627, whoever sent the message that started a turn which then died of a retryable failure (sender_failure_note). - install_
withhold_ 🔒alert - An Audit row when the registry of withheld values refuses a value or degrades its matching: a line with the counts, never a value.
- open_
stores_ and_ background - Opens every store and starts the background subsystems that need no app state, then what is read from the data folder.
- publish_
instance_ record - Lists this instance for the other AgentMux instances on this machine (
muxspect instances). - queued_
alert 🔒 - A callback that only queues each line;
deliverruns on its own thread. The registry raises an alert from inside message delivery, where the handler’s lock is held, so adeliverthat took that lock there would never return. - resume_
unresolved_ sagas - Compensates the sagas an earlier run left unresolved; non-fatal when it fails.
- serve_
until_ shutdown - Serves the web and WebSocket listeners until one fails or
stdin_tokenis cancelled. - shut_
down - What runs once the servers have stopped: this channel leaves the LAN, then every agent closes.
- spawn_
background_ 🔒task_ sweep - Background-task rows end when their command exits, whose process is gone, or that nothing has reported on for a day (SPEC_BACKGROUND_TASK_STRUCTURED_FEED_AND_SWARM_OWNERSHIP_2026_09_27.md §5).
- spawn_
serving_ loops - Starts the loops that run for as long as the servers do and stop with
stdin_token. - spawn_
spend_ 🔒services - What agents spend through the model gateway is kept across restarts, and a cap reached is acted on (SPEC_ROUTE_AGENT_BRAKES_2026_11_10.md §3).
- spawn_
state_ services - start_
container_ 🔒status - The Atlas map and the Swarm show this machine’s agent containers as they change (
backend::container_status). A machine with no container runtime is looked at once. - start_
data_ home_ services - Starts what is read from the data folder once the stores and watchers exist: widget packages, job templates and the Vault’s secret-file folder.
- start_
job_ ledger_ and_ cron - Opens the job run ledger, closes the runs a restart interrupted, then starts the cron scheduler.