Revert agent generations that cut off the control plane #35
Reference in New Issue
Block a user
Delete Branch "benvin/agent-safe-apply"
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?
Why: a generation that cuts the agent off from the control plane must roll back durably, never flap.
tomswall try: on-disk snapshot, systemd revert timer, shared flock.appliedover a fresh connection; transport failure reverts.reverted.json(and kept in memory) before restoring.failed; a failed restore keeps the snapshot and timer armed.failed/revertedwith the restore error.failedeven when restore also failed, so the control plane cannot tell the device is left half-applied → include a distinct restore-failure marker in the reported Error (or status).systemd-run; if Arm fails (unit sandboxing, no systemd) the cached config is never loaded after reboot, so the "never fails closed" guarantee in cmd/tomswall/agent.go is lost → on Arm failure in the cached path, apply without the timer (or document the requirement); and add a test for Arm failure on both fetched and cached paths (setup-error report/retry is untested).writeRevertedbefore restore is only logged, then the restore proceeds and the generation re-applies next cycle (flap) → return the error / keep the timer pending instead of continuing silently.Run/Restoreare exported mutable package vars reachable from production code → acceptable, but add a "tests only" doc line, or move the override behind a smallSetRunnerhelper.No findings.