GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) · Issue #3817 · developing-today/code

run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) #3817

New issue
Copy link
New issue
Copy link
Closed
#7362
Closed
run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained)#3817
#7362
Copy link
Assignees
dezren39
Labels
effort/mMedium: expected under 1 day of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/lowNice to have; do when convenientsource/humanFiled directly by a human

Description

@developing-today
developing-today
bot
opened on Nov 1, 2026
Issue body actions

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.sh started 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@amd via 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 and system.autoUpgrade appears 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-byte sudo: no password was provided logs 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 switch runs from the wt-pm-collector-nix fleet 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:

  1. 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.
  2. 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.sh invocations 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

Next
  1. developing-today
    added
    priority/lowNice to have; do when convenient
    on Nov 1, 2026
  2. github-actions
    assigned
    dezren39
    on Nov 1, 2026
  3. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    Member
    More actions

    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.

  4. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/humanFiled directly by a human
    effort/mMedium: expected under 1 day of work
    status/needs-triageNot yet triaged; needs a first look
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    queue/queuedHas a queued queue task
    task/triageQueue packet kind: verify, reproduce, and route this item
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 2, 2026
  5. 27 remaining items

  6. dezren39
    removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 8, 2026
  7. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    Member
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-i
    • Session / ID: task 12642
    • Found via: queue claim · repo-health-code-pilot
    • Task: Fix run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) #3817 — guard run-switch.sh: flock + evaluated-commit logging so overlapping switches cannot land stale trees.
    • Verified fresh (2026-11-08T06:37Z): issue run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) #3817 OPEN, no hard-stop labels. Laptop ~/run-switch.sh is still the unguarded 226-byte script (no flock, no rev-parse). PR fix: serialize run-switch and give each invocation its own log #5146 (for run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753, open, mergeable, no live queue task) already adds canonical lib/run-switch.sh with flock + per-invocation logs but no evaluated-commit logging or HEAD-moved warning — per the earlier triage path on this issue, the run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) #3817 guard will be stacked onto that branch rather than a competing PR, then deployed to the laptop.
    • Expectation: PR fix: serialize run-switch and give each invocation its own log #5146 updated with evaluated-commit + tree-state logging, HEAD-moved end-of-build warning, and a gen-524 drill in lib/run-switch.test.sh; merged under standing criteria; canonical script deployed to ~/run-switch.sh.
    • Links: task 12642 · PR fix: serialize run-switch and give each invocation its own log #5146 · issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753
  8. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    queue/queuedHas a queued queue task
    status/triagedTriaged and routed (see agent note)
    on Nov 8, 2026
  9. dezren39
    added a commit that references this issue on Nov 8, 2026

    Merge pull request #7362 from developing-today/queue/12642-3817-run-s…

    1cd8139
  10. dezren39
    closed this as completedin #7362on Nov 8, 2026
  11. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    Member
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-i
    • Session / ID: task 12642
    • Found via: queue claim · repo-health-code-pilot
    • Task: Fix run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) #3817 — guard run-switch.sh against overlapping/stale-tree switches. Done: fixed and merged, and deployed.
    • What changed: PR fix: log evaluated commit in run-switch and warn when HEAD moves during build (#3817) #7362 (merged 2026-11-08T06:46Z, merge commit 1cd8139) stacks the run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) #3817 guard onto the canonical lib/run-switch.sh from 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 records EVALUATED_COMMIT + TREE_STATE + SWITCH_STARTED_AT in 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.
    • Tests: bash lib/run-switch.test.sh on the laptop — all scenarios pass, including the new gen-524 drill (stubbed build commits mid-build; oracle is a real temp git repo's rev-parse HEAD) and the refusal-names-commit check. Re-run against the deployed bytes after deployment: all pass.
    • Deployment: laptop primary ff-pulled to the merge commit; ~/run-switch.sh replaced with the merged canonical script (sha256 b732a995… matches lib/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.
    • Outcome: issue run-switch.sh: overlapping switches snapshot stale trees and land surprise generations (gen 524, 2026-11-01, explained) #3817 closed by PR fix: log evaluated commit in run-switch and warn when HEAD moves during build (#3817) #7362. No behavior change to the deploy pattern otherwise (same flake target, same sudo-via-stdin).
    • Links: PR fix: log evaluated commit in run-switch and warn when HEAD moves during build (#3817) #7362 · PR fix: serialize run-switch and give each invocation its own log #5146 · task 12642
  12. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 8, 2026
  13. developing-today commented on Nov 8, 2026

    @developing-today
    developing-todayBot
    on Nov 8, 2026 – with developing.today
    ContributorAuthor
    More actions

    🤖 Agent note · correction to note 6718389512

    • Agent: queue worker (repo-worker-code), lane code-i · task 12642
    • The deployment backup named in my done note was misdescribed: ~/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.sh is the PR fix: log evaluated commit in run-switch and warn when HEAD moves during build (#3817) #7362 merged script (sha256 b732a995…).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

effort/mMedium: expected under 1 day of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/lowNice to have; do when convenientsource/humanFiled directly by a human

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.