standing/activation: enroll-activate's switch still holds the lock, deploy exits 11 #1010

Closed
opened 2026-08-30 00:46:37 +00:00 by matou-build-agent · 1 comment

The failure

verdict.json — "verdict": "red", "firstRedLeg": "standing", "legs": {"total": 17, "green": 15, "red": 2, "skip": 0}, commit d1870664. The two reds are the standing prefix wrapper and its inner activation leg, both carrying the same operator text:

the gateway deploy failed — The gateway deploy failed. [There is no old operating
system to roll back to — this server was rented fresh for the community, so nothing
of yours was overwritten.]

This is not the KNOWN frontier. The frontier named in the prompt is pairing never flipping, carried by legs.json's skip reasons. This drive's legs.json has pair green (187 ms) and contains no skipped legs at all ("skip": 0). The red is a new, distinct fault, and it kills the drive inside the standing-community prefix — legs.json records zero device-add legs, so #183's actual subject (adding a member device) was never exercised. The device droplet stood up for it (596233544, clan-lab-rehearsal-0e3657ad) is still stock Ubuntu with nothing but sshd listening (logs/device-units.txt), which is expected given the journey never reached it.

The evidence

The deploy's own transcript, from logs/founding-state.log (standup.deploy.failure.tail):

[gateway] $ systemd-run --pipe --wait --quiet --collect --no-ask-password \
            --service-type=exec --unit=clan-boot-gateway-834da81d \
            -- .../bin/switch-to-configuration boot
[gateway] Could not acquire lock
[gateway] failed with error: switch-to-configuration boot failed on 'gateway' (exit code 11).
1 hosts failed with an error. Check the logs above

The box's journal (logs/gateway-journal.txt) dates the collision exactly:

:1202  Aug 30 00:34:21 systemd[1]: Starting /nix/store/62rvh11vx3hqgy0yrgrgvyarpiz90xar-nixos-system-gateway-.../bin/switch-to-configuration switch...
:1258  Aug 30 00:34:22 systemd[1]: Reexecution requested from client PID 1885 ('.switch-to-conf') (unit clan-switch-gateway-15495c5e.service)...
:1347  Aug 30 00:37:18 systemd[1]: Starting [systemd-run] .../bin/switch-to-configuration boot...
:1350  Aug 30 00:37:18 systemd[1]: clan-boot-gateway-834da81d.service: Main process exited, code=exited, status=11/n/a
:1351  Aug 30 00:37:18 systemd[1]: clan-boot-gateway-834da81d.service: Failed with result 'exit-code'.

The earlier switch was still running when the deploy tried to take the lock — logs/gateway-stall.txt (captured 00:37:41, ~23 s after the deploy already failed) still lists both the wrapper and the switch alive, etime 3 m 20 s (i.e. started 00:34:21):

1884 1837 Ss  6656  03:20  systemd-run --pipe --wait --quiet --collect ... --unit=clan-switch-gateway-15495c5e ... switch-to-configuration switch
1885    1 Ss  5480  03:20  /nix/store/62rvh11vx3hqgy0yrgrgvyarpiz90xar-nixos-system-gateway-.../bin/switch-to-configuration switch

And it was demonstrably still doing work at the moment of the collision — gateway-journal.txt:1348 starts nsncd at 00:37:18, and :1891 has idss-mesh-self-admit-start beginning its retry loop at 00:37:28, ten seconds after the deploy had already been declared failed.

The leg that left that switch running went green. logs/founding-state.log (standup.events) carries the two sentences back to back:

enroll-activate: "the switch finished on the box but the activate command never returned —
                  reaping the hung activate instead of burning the ceiling (#992)"
enroll-activate: "the switch finished on the box after the interrupted activate —
                  /run/current-system matches the built system; the node is a clan member"
enroll-activate: "the device is a clan member"

So the #992 watchdog killed the local CLI and then accepted /run/current-system == toplevel as proof the switch was done. That symlink is written by the activation script, part-way through the switch — the run itself refutes the inference, since PID 1885 was still starting units three minutes later. pair (187 ms), point (422 ms) and deploy (26.9 s) then ran straight into the held lock.

Suspected layer — product (with a second, smaller product defect on top)

1. The completion signal is false (root cause). enroll-activate treats /run/current-system matching the built toplevel as "the switch finished". It is necessary but not sufficient; the switch is only done when the remote clan-switch-<machine>-<id>.service unit has exited and the NixOS switch lock is free. This drive's own healer record (logs/healer-claude.out) locates both call sites at internal/clan/enrollment.go:1181-1188 (the post-interrupt completion probe) and :1234-1250 (the #992 watchdog), sharing probeCurrentSystem at :1263-1283 — those line numbers are the healer's, not independently re-verified here (repo reads outside the run directory are denied to this session).

2. The failure is labelled as the wrong hazard. The deploy frame in founding-state.log classifies the fault as an evaluation problem and asserts a cause it did not establish:

"kind": "config_eval",
"headline": "The gateway deploy failed.",
"detail": "the remote switch died at exit 11 (a switch-to-configuration panic) — on the
           self-deploy path the switch was killed with the unit it stopped, so the
           downstream symptom is a consequence, not the cause (see GOTCHAS #86)"

and the stage line reads "the node's config does not evaluate" — while three lines earlier the same record has "eval preflight passed" and the tail shows the build succeeding and printing /nix/store/62rvh...-nixos-system-gateway-26.11.20260612.173d0ad. Nothing failed to evaluate; nothing panicked; this was not the self-deploy path (the deploy came in over ssh from the drive host, gateway-journal.txt:1340-1341, Accepted publickey for root from 179.65.135.113). The classifier appears to key on the exit code alone and ignore the Could not acquire lock line immediately above it. This misdirects both the operator and the next healer.

3. A harness/diagnostics gap, minor. The drive harvests the offending unit's journal but windows it wrongly:

--- clan-switch-gateway-* journal (redacted, since deploy start) ---
-- No entries --

The unit started at 00:34:21, three minutes before deploy start, so the window that was meant to catch exactly this collision harvested nothing.

What plugging it needs

  1. Replace the proof-of-switch. Gate enroll-activate's "the switch finished" on the remote activation unit being inactive (or the switch lock being free), not on the /run/current-system symlink. Both the post-interrupt probe and the #992 watchdog need it — the watchdog must not reap-and-declare-green on the symlink alone.
  2. Give the still-running switch a bound. Once detected, enroll-activate either waits it out under a named ceiling or reds/blocks naming the in-flight switch. The existing activateWatchdogGrace / activateCeiling values are the reference points.
  3. Make the deploy lock-aware. Could not acquire lock + exit 11 should be classified as a collision (wait for the lock, retry once) rather than as config_eval / a panic. Stop the death-note from asserting GOTCHAS #86 for every non-zero switch exit; have it name the observed exit and the observed stderr.
  4. Widen the clan-switch-* journal harvest to the whole boot, not "since deploy start", so the colliding unit shows up in the next drive's evidence.
  5. Add a GOTCHAS entry for switch-lock contention, distinct from #86, so exit 11 is not read as the panic again.

Access note

No live-box section was appended to this task, so the box was not queried directly; everything above is from the harvested records. The box was still answering at harvest time (logs/gateway-do-forensics.txt: tcp/22: a FRESH connect succeeded), and the harvest happens to carry the two things a live box would have been asked for anyway — the process table showing the switch still alive (gateway-stall.txt) and the unit's exit code (gateway-journal.txt:1350). Nothing in this diagnosis depends on a live query.

drive 20260830T002134Z red at activation: the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this server was rented fresh for the community, so nothing of yours was overwritten.]
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260830T002134Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## The failure `verdict.json` — `"verdict": "red"`, `"firstRedLeg": "standing"`, `"legs": {"total": 17, "green": 15, "red": 2, "skip": 0}`, commit `d1870664`. The two reds are the `standing` prefix wrapper and its inner `activation` leg, both carrying the same operator text: ``` the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this server was rented fresh for the community, so nothing of yours was overwritten.] ``` **This is not the KNOWN frontier.** The frontier named in the prompt is pairing never flipping, carried by `legs.json`'s skip reasons. This drive's `legs.json` has `pair` **green** (187 ms) and contains **no skipped legs at all** (`"skip": 0`). The red is a new, distinct fault, and it kills the drive inside the standing-community prefix — `legs.json` records **zero device-add legs**, so #183's actual subject (adding a member device) was never exercised. The device droplet stood up for it (`596233544`, `clan-lab-rehearsal-0e3657ad`) is still stock Ubuntu with nothing but sshd listening (`logs/device-units.txt`), which is expected given the journey never reached it. ## The evidence The deploy's own transcript, from `logs/founding-state.log` (`standup.deploy.failure.tail`): ``` [gateway] $ systemd-run --pipe --wait --quiet --collect --no-ask-password \ --service-type=exec --unit=clan-boot-gateway-834da81d \ -- .../bin/switch-to-configuration boot [gateway] Could not acquire lock [gateway] failed with error: switch-to-configuration boot failed on 'gateway' (exit code 11). 1 hosts failed with an error. Check the logs above ``` The box's journal (`logs/gateway-journal.txt`) dates the collision exactly: ``` :1202 Aug 30 00:34:21 systemd[1]: Starting /nix/store/62rvh11vx3hqgy0yrgrgvyarpiz90xar-nixos-system-gateway-.../bin/switch-to-configuration switch... :1258 Aug 30 00:34:22 systemd[1]: Reexecution requested from client PID 1885 ('.switch-to-conf') (unit clan-switch-gateway-15495c5e.service)... :1347 Aug 30 00:37:18 systemd[1]: Starting [systemd-run] .../bin/switch-to-configuration boot... :1350 Aug 30 00:37:18 systemd[1]: clan-boot-gateway-834da81d.service: Main process exited, code=exited, status=11/n/a :1351 Aug 30 00:37:18 systemd[1]: clan-boot-gateway-834da81d.service: Failed with result 'exit-code'. ``` The earlier switch was **still running** when the deploy tried to take the lock — `logs/gateway-stall.txt` (captured 00:37:41, ~23 s after the deploy already failed) still lists both the wrapper and the switch alive, `etime` 3 m 20 s (i.e. started 00:34:21): ``` 1884 1837 Ss 6656 03:20 systemd-run --pipe --wait --quiet --collect ... --unit=clan-switch-gateway-15495c5e ... switch-to-configuration switch 1885 1 Ss 5480 03:20 /nix/store/62rvh11vx3hqgy0yrgrgvyarpiz90xar-nixos-system-gateway-.../bin/switch-to-configuration switch ``` And it was demonstrably still doing work at the moment of the collision — `gateway-journal.txt:1348` starts `nsncd` at 00:37:18, and `:1891` has `idss-mesh-self-admit-start` beginning its retry loop at 00:37:28, ten seconds *after* the deploy had already been declared failed. The leg that left that switch running went **green**. `logs/founding-state.log` (`standup.events`) carries the two sentences back to back: ``` enroll-activate: "the switch finished on the box but the activate command never returned — reaping the hung activate instead of burning the ceiling (#992)" enroll-activate: "the switch finished on the box after the interrupted activate — /run/current-system matches the built system; the node is a clan member" enroll-activate: "the device is a clan member" ``` So the #992 watchdog killed the *local* CLI and then accepted `/run/current-system == toplevel` as proof the switch was done. That symlink is written by the activation script, part-way through the switch — the run itself refutes the inference, since PID 1885 was still starting units three minutes later. `pair` (187 ms), `point` (422 ms) and `deploy` (26.9 s) then ran straight into the held lock. ## Suspected layer — product (with a second, smaller product defect on top) **1. The completion signal is false (root cause).** `enroll-activate` treats `/run/current-system` matching the built toplevel as "the switch finished". It is necessary but not sufficient; the switch is only done when the remote `clan-switch-<machine>-<id>.service` unit has exited and the NixOS switch lock is free. This drive's own healer record (`logs/healer-claude.out`) locates both call sites at `internal/clan/enrollment.go:1181-1188` (the post-interrupt completion probe) and `:1234-1250` (the #992 watchdog), sharing `probeCurrentSystem` at `:1263-1283` — those line numbers are the healer's, not independently re-verified here (repo reads outside the run directory are denied to this session). **2. The failure is labelled as the wrong hazard.** The deploy frame in `founding-state.log` classifies the fault as an evaluation problem and asserts a cause it did not establish: ``` "kind": "config_eval", "headline": "The gateway deploy failed.", "detail": "the remote switch died at exit 11 (a switch-to-configuration panic) — on the self-deploy path the switch was killed with the unit it stopped, so the downstream symptom is a consequence, not the cause (see GOTCHAS #86)" ``` and the stage line reads `"the node's config does not evaluate"` — while three lines earlier the same record has `"eval preflight passed"` and the tail shows the build succeeding and printing `/nix/store/62rvh...-nixos-system-gateway-26.11.20260612.173d0ad`. Nothing failed to evaluate; nothing panicked; this was not the self-deploy path (the deploy came in over ssh from the drive host, `gateway-journal.txt:1340-1341`, `Accepted publickey for root from 179.65.135.113`). The classifier appears to key on the exit code alone and ignore the `Could not acquire lock` line immediately above it. This misdirects both the operator and the next healer. **3. A harness/diagnostics gap, minor.** The drive harvests the offending unit's journal but windows it wrongly: ``` --- clan-switch-gateway-* journal (redacted, since deploy start) --- -- No entries -- ``` The unit started at 00:34:21, three minutes *before* deploy start, so the window that was meant to catch exactly this collision harvested nothing. ## What plugging it needs 1. **Replace the proof-of-switch.** Gate `enroll-activate`'s "the switch finished" on the remote activation unit being inactive (or the switch lock being free), not on the `/run/current-system` symlink. Both the post-interrupt probe and the #992 watchdog need it — the watchdog must not reap-and-declare-green on the symlink alone. 2. **Give the still-running switch a bound.** Once detected, `enroll-activate` either waits it out under a named ceiling or reds/blocks naming the in-flight switch. The existing `activateWatchdogGrace` / `activateCeiling` values are the reference points. 3. **Make the deploy lock-aware.** `Could not acquire lock` + exit 11 should be classified as a *collision* (wait for the lock, retry once) rather than as `config_eval` / a panic. Stop the death-note from asserting GOTCHAS #86 for every non-zero switch exit; have it name the observed exit and the observed stderr. 4. **Widen the `clan-switch-*` journal harvest** to the whole boot, not "since deploy start", so the colliding unit shows up in the next drive's evidence. 5. **Add a GOTCHAS entry** for switch-lock contention, distinct from #86, so exit 11 is not read as the panic again. ## Access note **No live-box section was appended to this task**, so the box was not queried directly; everything above is from the harvested records. The box was still answering at harvest time (`logs/gateway-do-forensics.txt`: `tcp/22: a FRESH connect succeeded`), and the harvest happens to carry the two things a live box would have been asked for anyway — the process table showing the switch still alive (`gateway-stall.txt`) and the unit's exit code (`gateway-journal.txt:1350`). Nothing in this diagnosis depends on a live query. drive `20260830T002134Z` red at `activation`: `the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this server was rented fresh for the community, so nothing of yours was overwritten.]` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260830T002134Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 4c82deb1e678 -->
Owner

Closing as a duplicate of #1009 (ADR 0174, session hands). Same drive (20260830T002134Z), same commit, same mechanism — enroll-activate's completion check (592db82b, #992) reads /run/current-system and declares the switch finished while it still holds the NixOS switch lock, so the deploy's switch-to-configuration boot exits 11. #1009 was filed first and names the defective check; work lands there. #854 stays blocked by #1009 only.

**Closing as a duplicate of #1009 (ADR 0174, session hands).** Same drive (`20260830T002134Z`), same commit, same mechanism — enroll-activate's completion check (`592db82b`, #992) reads `/run/current-system` and declares the switch finished while it still holds the NixOS switch lock, so the deploy's `switch-to-configuration boot` exits 11. #1009 was filed first and names the defective check; work lands there. #854 stays blocked by #1009 only.
ben closed this issue 2026-08-30 00:48:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1010
No description provided.