Repository navigation
Description
What happened
During the flake-fold activation attempts on 2026-11-01, the laptop's system profile advanced 523 -> 524 at 09:30:41 CST through an activation neither fold attempt produced (both died at build). Investigation (laptop-hygiene-2026-11-01.md, Addendum 9) traced it completely:
- The activation was
~/run-switch.shstarted 08:35:22 CST (its own log:~/switch-20261101-083522.log,SWITCH_EXIT=0, "Done. The new configuration is /nix/store/vnsmm27..."). It evaluated the laptop primary at 51dee68 — pre-fold main. The fold's pull to 5828cb8 only landed at 08:58:12, while this build was already running. Nix snapshots a path flake's tree at eval time, so the ~55-minute build on the loaded box faithfully built and switched the stale tree. Gen 524 therefore contains no fold units (verified), and everything on it is healthy. - The launcher was an agent session over the sandbox's multiplexed SSH connection (logind session 3462, opened 08:00:06 CST), feeding the sudo password from 1Password item
user@amdvia stdin — the fleet's established deploy pattern (see the archived deploy-chain-2220 executor: run the switch after merges, vault-fed sudo). It was not a systemd timer (the laptop has no nixos-upgrade/autoUpgrade unit andsystem.autoUpgradeappears nowhere in the flake), not cron (none exists), and not a local GUI session (no local login; the password arrived via stdin, cf. the 75-bytesudo: no password was providedlogs at 03:56:01 and 08:59:29 when a feed was missed). - This is a standing rhythm, not a one-off: successful run-switch activations landed at 03:42, 05:05, 08:10 and 09:31 CST that night (starts 02:07 / 03:56 / 07:11 / 08:35), plus direct
nixos-rebuild switchruns from thewt-pm-collector-nixfleet worktree at 01:11 / 01:48 / 02:21. Agent sessions switch the laptop to current main after merges, roughly every 1-2.5 hours, and builds take 35-95 minutes under load — which is why a switch can land long after, and far away from, the work that launched it.
Why this is filed
The mechanism works as designed, but it has two sharp edges worth a guard:
- No lock. Two switches ran concurrently on 2026-11-01 (08:35 and the fold's 08:59 attempt) and contended; nothing prevents overlapping builds/activations.
- Silent staleness. A switch whose build spans a merge/pull lands the old configuration with a success exit, indistinguishable from a fresh deploy unless you diff the resulting generation. It cost the fold run about an hour of confusion ("an activation neither attempt produced").
Suggested minimal guard for run-switch.sh: take an flock for the duration, and log the primary's HEAD at eval time into the switch log (plus a warning at the end if HEAD moved during the build). No behavior change otherwise.
Interaction with the pending fold (code#3720 / PR #3722)
There is no autonomous switcher: nothing fires on a timer. But at the observed cadence, once main is green again (the id checkPhase failures, code#3787, are the current blocker), the next routine fleet switch will incidentally complete the fold: the primary is kept at origin main by pm-git-sync (fold modules already merged), and home-manager.backupFileExtension = "backup" means the 16 hand-installed unit files still in place will be renamed to *.backup rather than blocking activation. Whoever notices the fold land should still run the runbook's verification (store links, timers, one drain run) and retire the reaper's bootstrap worktree, per ~/.local/state/flake-fold-backup-2026-11-01/.
Filed from the gen-524 investigation, 2026-11-01. Priority: low — documentation/guard, no live breakage.
Acceptance criteria
- Overlapping
run-switch.shinvocations cannot silently build stale trees: a second switch started while one is running (or while the tree moved since eval) is refused, queued, or loudly warned with the evaluated commit named — the mechanism is the fixer's choice, the surprise-generation outcome is what must be impossible. - A switch's log records the evaluated commit and tree state so a landed generation can always be traced to its source tree after the fact.
- The 2026-11-01 gen-524 sequence is reproducible as a test scenario or documented drill: stale-tree switch is caught before activation.
Activity
dezren39 commentedon Nov 2, 2026
Intake review
Related: the flake-fold activation attempts and laptop-hygiene-2026-11-01.md Addendum 9 (named in the body as the investigation source).
Notes: The incident itself is fully explained in the body (gen 524 = a healthy stale-tree build, not a fault in the fold), and everything on gen 524 verified healthy — what remains is the standing rhythm: agent sessions switch the laptop after merges every 1–2.5h with 35–95-minute builds, so overlap is structural, not accidental. Already carried priority/low; this pass adds kind/source/effort/status and the acceptance section.
Risks: a stale-tree switch can silently revert freshly landed units (it nearly masked the fold), and the failure is invisible precisely because the stale build succeeds.
Suggested approach: a lockfile/flock in run-switch.sh plus an eval-time commit stamp compared again before activation; abort or re-eval when HEAD moved during the build.
— fleet monitor intake enrichment, 2026-11-02.
27 remaining items
dezren39 commentedon Nov 8, 2026
🤖 Agent note · picked up
Merge pull request #7362 from developing-today/queue/12642-3817-run-s…
dezren39 commentedon Nov 8, 2026
🤖 Agent note · done
lib/run-switch.shfrom PR fix: serialize run-switch and give each invocation its own log #5146 (which merged mid-shift at 06:39Z closing issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753; its flock + per-invocation logs were the base). The script now recordsEVALUATED_COMMIT+TREE_STATE+SWITCH_STARTED_ATin every switch log, warns loudly at the end of the log (HEAD MOVED DURING BUILD, naming both commits) if HEAD moved during the build, and a refused concurrent invocation names the running switch's evaluated commit as well as its log.bash lib/run-switch.test.shon the laptop — all scenarios pass, including the new gen-524 drill (stubbed build commits mid-build; oracle is a real temp git repo'srev-parse HEAD) and the refusal-names-commit check. Re-run against the deployed bytes after deployment: all pass.~/run-switch.shreplaced with the merged canonical script (sha256 b732a995… matcheslib/run-switch.sh), mode 700; the unguarded 226-byte original is kept at~/run-switch.sh.bak-20261108-pre-3817. No real switch was run.developing-today commentedon Nov 8, 2026
🤖 Agent note · correction to note 6718389512
~/run-switch.sh.bak-20261108-pre-3817(sha256 11cc1019…) is the PR fix: serialize run-switch and give each invocation its own log #5146 canonical script that lane code-b (task 12629) deployed at ~06:40Z, not the unguarded original. The unguarded 226-byte original is preserved at~/run-switch.sh.pre-5146.bak(sha256 c38ca02f…). The deployed result is unchanged:~/run-switch.shis the PR fix: log evaluated commit in run-switch and warn when HEAD moves during build (#3817) #7362 merged script (sha256 b732a995…).