Expand description
Workers — the I/O-bearing edges around the agent’s pure reducer.
Each worker is spawned by super::spawn with its own
super::ShutdownToken and a clone of the reducer’s input
mpsc::Sender<ReducerInput>. Workers never call step() — they
translate I/O into super::ReducerInput values and let the
reducer task do the actual transitions.
Modules§
- activation
- Activation worker. Receives
ActivationIntentfrom the applier, emitsLocalActivationStartedto the reducer, drives the rich activation pipeline (crate::activation), and emitsLocalActivationCompleted/LocalActivationFailedbased on the pipeline’s outcome. - advance_
ticker - Periodic timer that emits
super::super::ReducerInput::AgentAdvanceTickat a fixed interval. Mirror of the CP runtime’sPlanTick. - cert_
renewal - mTLS cert renewal worker. Reads the cert at
cfg.client_certon a timer, computes the remaining-validity fraction, and POSTs/v1/agent/renewwhen belowcfg.renewal_threshold_fraction. The CSR is signed by the host’s SSH ed25519 key (same key as enrollment per RFC-0003 §2), so the renewed cert’s pubkey is unchanged. - heartbeat
- Heartbeat worker: every 60s posts to
/v1/agent/heartbeatwithcurrent_closure+uptime_secs+last_event_seq_by_rollout. Reads CP’sX-Nixfleet-Replay-Fromresponse header; on drift the intent is to walk the durable outbound queue from that seq and re-POST the missed events. - longpoll
- Long-poll worker: holds an open
GET /v1/agent/dispatch?wait=60against the CP. On a 200 with a Dispatch body, fetches + verifies the rollout manifest via the disk-backedManifestCache, asserts the dispatchedtarget_closurematches the manifest’s declaration for this host (RFC-0005 §4.1 advisory-payload contract), then emitsLocalActivateinto the reducer. - manifest_
poll - Periodic agent-side manifest poll. Mirrors CP’s
runtime::workers::manifest_poll: every 30s the worker fetches/v1/fleet.resolved+ each channel’s/v1/rollouts/{id}from CP, verifies signatures + cross-checks each rollout’sfleet_resolved_hashagainst the canonical hash of the just-fetched fleet, then emitsReducerInput::ManifestSetUpdatedso the reducer’s cachedSignedManifestSetreflects the current fleet snapshot. - outbound
- Outbound queue drainer. Periodically scans
{state_dir}/outbound-queue/and POSTs each pending event to/v1/agent/events, deleting on success. Acts as the network-side companion to the applier’sLocalEmitEventwrites. - probe
- Probe worker (RFC-0007 §8). On each
LocalResetProbeCache: - probe_
runners - Per-kind probe runners (RFC-0007 §3.1). Each runner consumes a
ProbeDecl+ returns aRunnerOutcome. Uniform strict-mode semantics: any runtime error →ProbeStatus::Failwith afailure_reasonstring. Per RFC-0007 §6 there is noUnknownor “swallowed error” class.