feat(server): scheduled automatic agent updates (VS-74) #92
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VS-74-scheduled-agent-autoupdate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements VS-74: scheduled / automatic agent updates. On a configurable cadence the server compares every connected agent's reported running binary against the configured channel binary and chunk-streams the update to those that are behind, with no per-agent operator action. Builds directly on VS-73 (#91): it reuses the same
push_agent_update_chunkedpath, so the trust / verification model is identical (configured-channel binary fetched + signature-verified by the VS-20 fetcher, chunked stream over mTLS, agent validates the End-frame SHA-384 before swapping and re-exec'ing).New
agent_autoupdatemoduleAgentAutoUpdatePolicyparsed fromsettings.agentautoupdate:enabled,intervalsecs,batchsize. Disabled by default (AC4).AgentAutoUpdateHandle(ArcSwap) holds the live policy. The sweep reads it every tick and the adminsettingsupdateaction swaps it, soenabled(the kill switch) andbatchsizetake effect without a restart.agents_behind_channel: flags connected agents whose reported running binary SHA-384 differs from the channel binary for their arch. Agents that have not yet reported a hash are left for a later sweep rather than pushed to blindly.run_sweep: finds behind agents, caps tobatchsize, pushes via the shared chunked path.spawn: starts the periodic loop only whenintervalsecs > 0; the loop checks the liveenabledflag each tick.Wiring
AppState.agent_auto_updatehandle (default disabled);start()parses the merged-config policy and spawns the loop.agentautoupdateadded tovervain_config::RUNTIME_EDITABLE_SETTINGS_KEYS, with asettings_overlaylive-apply arm (validate, persist, swap policy).AgentRegistry::connected_ids()enumerates push candidates.push_agent_update_chunked/resolve_agent_idare nowpub(crate)for reuse.Config example
Acceptance criteria
settings.agentautoupdate). See note on "on channel change" below.intervalsecs), kill switch (liveenabled), plusbatchsizepacing.Notes
intervalsecs) change is persisted but only takes effect on the next restart (the tokio interval is fixed at spawn);enabled/batchsizeare live.Tests
13 new unit tests: policy default/parse, behind detection (only mismatched reporters), sweep enabled/disabled/batch-size, and the live overlay apply (kill switch). Full suite green via
just pre-commit(fmt, clippy -D warnings, workspace check, test).