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: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) · Issue #3753 · developing-today/code

run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753

New issue
Copy link
New issue
Copy link
Closed
#5146
Closed
run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution)#3753
#5146
Copy link
Assignees
dezren39
Labels
area/infraInfrastructure, deployment, and operationseffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Nov 1, 2026
Issue body actions

Problem

~/run-switch.sh records its log location in a single shared pointer file, ~/switch-current.logpath. When two switches run concurrently, the second invocation overwrites the pointer, and the first operator's monitoring reads the WRONG run's log — exit-code attribution for a system switch then depends on each operator happening to track their own log filename privately.

Evidence (2026-11-01)

During the flake-dedupe activation switch (generation system-524, SWITCH_EXIT=0, verified from the operator's own log file), another actor launched ~/run-switch.sh twice from a separate worktree effort (08:59:29 — failed instantly, no sudo password; 08:59:51 — ran to completion on a newer main). The second launch clobbered ~/switch-current.logpath mid-flight; the first operator's final tail read the other run's log. Both switches built from the same main lineage so the system stayed consistent — this time. A wrong-log read on a FAILED switch could equally mask a failure as a success.

Ask

  • Per-invocation logpath: write the pointer to a unique file per run (e.g. ~/switch-<timestamp>-<pid>.logpath, or print the log path on stdout only and drop the shared pointer), and/or
  • A switch lock (flock on a lockfile) so a second concurrent switch refuses with a clear message instead of racing — two NixOS switches racing is wasteful even when harmless.

Either change is small; the lock is the stronger guarantee.

Acceptance criteria

  • Two concurrent run-switch.sh invocations cannot clobber each other's log attribution: each run's log path is unique to the invocation, or a flock-style lock makes a second concurrent invocation refuse with a clear message.
  • A failed switch is never read as a success (or vice versa) because of another run's log: the recorded log path points at the operator's own run from start to finish.
  • Single-invocation behaviour is unchanged apart from the pointer/lock mechanics.

Activity

Next
  1. developing-today commented on Nov 1, 2026

    @developing-today
    developing-todayBot
    on Nov 1, 2026 – with developing.today
    Contributor
    More actions

    CODE-1520

  2. github-actions
    assigned
    dezren39
    on Nov 1, 2026
  3. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    effort/sSmall: expected under 2 hours of work
    area/infraInfrastructure, deployment, and operations
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 1, 2026
  4. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    Intake review

    Fleet monitor intake pass (protocol §5), 2026-11-01.

    Related: None found in a merged-PR search for this issue (2026-11-01).

    Notes: Filed with no labels and no acceptance criteria; the problem statement and 2026-11-01 evidence (generation system-524 switch, two clobbering launches at 08:59) are clear and reproduced in the body.

    Risks: Low: ~/run-switch.sh is an operator script, not shipped code; the risk being fixed (wrong-log exit attribution masking a failed switch) is the larger one.

    Suggested approach: Prefer the flock lock (the stronger guarantee the issue itself names), plus a per-invocation logpath as belt-and-braces.

  5. dezren39
    added
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  6. developing-today commented on Nov 3, 2026

    @developing-today
    developing-todayBot
    on Nov 3, 2026 – with developing.today
    Contributor
    More actions

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 40 (priority/normal). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  7. dezren39 commented on Nov 3, 2026

    @dezren39
    dezren39
    on Nov 3, 2026
    MemberAuthor
    More actions

    Triage (task 8266, lane code-e): STILL LIVE — verified against the actual script on the laptop, 2026-11-03.

    • The script named in this issue is the laptop operator script ~/run-switch.sh (not versioned in any repo). Read verbatim today, it is exactly the reported shape:
      • LOG=/home/user/switch-$(date +%Y%m%d-%H%M%S).log
      • echo "$LOG" > /home/user/switch-current.logpath — one shared pointer, overwritten unconditionally at start.
      • No flock / lock of any kind; the rebuild then runs and appends SWITCH_EXIT=$? to $LOG.
    • Extra finding beyond the issue body: the log filename itself has only second resolution, so two runs started in the same second share not just the pointer but the same log file — both runs' output and SWITCH_EXIT lines interleave in one file.
    • Dedup re-verified fresh: no PR in developing-today/code or dezren39/nix references run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753 or run-switch, and neither repo contains switch-current.logpath or a run-switch script (gh code search, 2026-11-03). Nothing has landed for this.

    Fix path scoped (enqueued as follow-up fix task in repo-health-code-pilot):

    1. Serialize switches: flock -n on a lockfile (e.g. ~/switch.lock); a second concurrent invocation refuses immediately with a clear message naming the holder's log.
    2. Per-invocation attribution: log name gains the PID (switch-<stamp>-$$.log) and the shared pointer is either dropped in favour of the per-run path printed on stdout, or kept only as a convenience "most recent start" record that no operator flow depends on for exit attribution.
    3. Version the script: the canonical copy should live in a repo (this issue's repo, developing-today/code, is the natural home — e.g. under infra/ alongside the fleet tooling) with the laptop ~/run-switch.sh deployed from it, so the next change is a PR, not an unversioned home-dir edit.
    4. Regression harness: stub two concurrent invocations; the second refuses, the first's log + SWITCH_EXIT line are untouched.

    No blockers; nothing needs Drew. Single-invocation behaviour otherwise unchanged.

  8. dezren39
    added
    status/in-progressQueue worker lifecycle state
    on Nov 3, 2026
  9. 14 remaining items

  10. dezren39
    added
    queue/queuedHas a queued queue task
    on Nov 8, 2026
  11. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    Partial verification — staying open (2026-11-07 done-task-only audit, tracking: #7016).

    Queue task(s) [8266, 8705] were marked done, and some work did land:

    • Direct commits referencing this issue: da477e4

    No merged change closes this issue's full scope, so the done status is not treated as completion. Remainder re-queued as triage task 11673.

  12. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-r
    • Session / ID: task 12627 (attempt 2)
    • Found via: queue claim
    • Task: Shepherd PR fix: serialize run-switch and give each invocation its own log #5146 to merge + deploy — run-switch.sh flock + per-invocation logpath (issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753 remainder). PR fix: serialize run-switch and give each invocation its own log #5146 is OPEN, not draft, no held labels (verified 2026-11-08T06:37Z).
    • Handoff: execution-lane assignment for task 12627 returned opencode (§1b) — the previous handoff (2026-11-08T05:49Z) did not bind before the lease cycled, so this claim re-hands it to the claimant. The laptop claimant launches the bound opencode session, which drives this task to its terminal state under this queue's worker id. This lane does not work the task itself.
    • Expectation: claimant session re-verifies PR fix: serialize run-switch and give each invocation its own log #5146 fresh (state, checks, Codex findings disposition), merges under the standing criteria if verified, handles the deploy step named in the task, and completes task 12627 with the evidence.
  13. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued queue task
    status/triagedTriaged and routed (see agent note)
    on Nov 8, 2026
  14. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-b
    • Session / ID: task 12629
    • Found via: queue claim (direct execution lane)
    • Task: Remainder of issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753 after the done-task-only audit: PR fix: serialize run-switch and give each invocation its own log #5146 (task 8705's fix) was opened but never merged, and the laptop still runs the racy script. Verifying PR fix: serialize run-switch and give each invocation its own log #5146 fresh and, if sound, merging it and deploying the canonical script.
    • Expectation: effort s — done looks like PR fix: serialize run-switch and give each invocation its own log #5146 merged, ~/run-switch.sh on the laptop replaced by the merged canonical lib/run-switch.sh with matching checksum, and issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753 closed with that evidence.
    • Links: 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
  15. dezren39
    closed this as completedin #5146on Nov 8, 2026
  16. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-b
    • Session / ID: task 12629
    • Found via: queue claim (direct execution lane)
    • Task: Remainder of issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753: merge the verified fix in PR fix: serialize run-switch and give each invocation its own log #5146 and deploy it to the laptop operator script.
    • Expectation: met — see evidence below.

    Outcome — fixed and merged (task 12629, 2026-11-08)

    • PR fix: serialize run-switch and give each invocation its own log #5146 merged: merge commit b5ddb3974454cde92b0afa0ee52f98baa42a7959; its Closes #3753 closed this issue. The PR had no labels (no held / user/owned / do-not-merge / do-not-auto-edit), no reviews and no Codex findings to disposition.
    • Fresh verification on the laptop before merging (worktree at PR head da477e46238f): bash lib/run-switch.test.sh — all tests passed (concurrent invocation refused without creating or contaminating a log; single invocation prints a unique log path and preserves the rebuild exit status); bash -n pass; shellcheck pass. The canonical script preserves the old operator semantics (same flake /home/user/code#amd, same sudo -S nixos-rebuild switch, per-run SWITCH_EXIT) and changes only the pointer/lock mechanics: non-blocking flock, per-invocation UTC-timestamp+PID log path printed on stdout, and no shared ~/switch-current.logpath at all.
    • Deployed: laptop ~/git/code fast-forwarded to the merge commit and lib/run-switch.sh installed to ~/run-switch.sh; sha256 of both files is 11cc1019d0986510fa2c98a7b0cae41c8048f0647b97023f160aad74ec49ed9a (match verified). The previous script is kept at ~/run-switch.sh.pre-5146.bak. This closes the deployment/checksum remainder task 8705 left open.
    • Acceptance: two concurrent invocations can no longer clobber each other's log attribution (the second is refused with the active log named), and a failed switch's SWITCH_EXIT is recorded only in its own run's log.
  17. dezren39
    removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    on Nov 8, 2026
  18. dezren39 commented on Nov 8, 2026

    @dezren39
    dezren39
    on Nov 8, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done (already complete at pickup)

    • Agent: queue worker (repo-worker-code), lane ec118cad-0fd3-4652-91c4-27432f2f2efd (openchamber-scheduled-lane)
    • Session / ID: task 12627
    • Found via: queue claim
    • Task: shepherd PR fix: serialize run-switch and give each invocation its own log #5146 / deployment remainder for issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753
    • Outcome: Already completed by task 12629 before this claim: PR fix: serialize run-switch and give each invocation its own log #5146 merged as b5ddb39; issue run-switch.sh: concurrent switches clobber the shared ~/switch-current.logpath pointer (wrong-log exit attribution) #3753 closed; local ~/run-switch.sh and lib/run-switch.sh SHA-256 match at b732a995fcf5f1922097ae4ecae5d71b93b6f72c780bca7ef94c4c0ed8c89475.
    • Task 12627: completed as already_done after fresh GitHub and checksum verification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

area/infraInfrastructure, deployment, and operationseffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

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.