enroll-activate: gateway cloud-final still fails on converge — #893's fix did not hold #899

Closed
opened 2026-08-27 08:56:49 +00:00 by matou-build-agent · 5 comments

The failure

Drive 20260827T082850Z (--target device, commit ee9aef78) went red at leg standing, propagated from enroll-activate after 247s. 11 legs green, 2 red, 0 skipped — so this is not the known own-VPS pairing frontier (legs.json records no skip reasons at all this run; the drive died before pairing was ever reached). enroll-copy went green first (413631 ms, "726 store paths"), so the system reached the box: this is an activation-side failure, not a transport one.

clan exited 0; the masked_exit detector (internal/clan/errors.go:124-134, tripped by the "failed to" marker at errors.go:338) refused the pass.

Evidence

artifacts/legs.json — the tripping lines, identical on the leg and on the standing wrapper:

{ "leg": "enroll-activate", "status": "red", "ms": 247075,
  "error": "journey leg \"enroll-activate\" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure:
[gateway] Aug 27 08:43:08 idss-gateway-rehearsal-c-0d69 systemd[1]: Failed to start Execute cloud user/final scripts.
[gateway] Aug 27 08:43:32 idss-gateway-rehearsal-c-0d69 systemd[1]: Failed to start Execute cloud user/final scripts." }

That is cloud-final.service dying on the rented gateway during activation, then dying identically on systemd's retry 24 s later.

artifacts/verdict.json — "firstRedLeg": "standing", "legs": {"total": 13, "green": 11, "red": 2, "skip": 0}, "commit": "ee9aef784971f7760b743ca1e1db2233f5c170bd".

logs/founding-state.log — standup.events[] walks clean through enroll-copy ("the system is on the gateway") and into activation, then faults:

{"stage":"enroll-activate","message":"the droplet's resolver is warm — https://git.clan.lol/ reachable over its ssh door (attempt 1/6)"}
{"stage":"enroll-activate","message":"clan reported success but the log shows a real failure: ..."}

with draft.access.ip = 134.199.163.163 and "founded": true, standup.step: "rented".

artifacts/journey.device-.../error-context.md:36 — the app's own S10 fault frame carries the same line with Retry / Switch the access option buttons, so the product is faithfully surfacing a real deploy failure, not a Playwright artefact. artifacts/journey.json is {"rows": null, "fault": null} — the drive never reached its own founding rows.

The gateway's journal was never harvested. logs/ holds device-*.txt only, and logs/device-journal.txt is entirely the member device box: 563 hits for clan-lab-rehearsal-26f45ade, zero for idss-gateway-rehearsal-c-0d69. logs/device-do-forensics.txt probes 134.199.171.52 / droplet 595543661 — the device, not the gateway 134.199.163.163. logs/droplet-journal.txt (named in the harvest contract) is absent; so are logs/gateway-journal.txt / gateway-do-forensics.txt. logs/state-logs.log and logs/broker-journal.txt are both explicit harvest misses (ENOENT ... /test-results/standing-rented/state/logs; dev@100.98.48.68: Permission denied (publickey) — the by-design off-mesh case, #681).

No live-box section was appended to this task, so I had no access line to either box and diagnosed from the harvested logs alone. (device-do-forensics.txt:10 records tcp/22: a FRESH connect succeeded at 08:43:38 — but against the device; nothing in this run ever probed the failing gateway.)

Suspected layer — product, with a harness blindfold on top

Product. internal/clan/vmguest.go:361-393 (rentedHostNetworking). #893 (0ebee23, in this drive's tree — ee9aef78 is a descendant) set exactly four lines as the whole mitigation:

systemd.services.cloud-init-local.restartIfChanged = false;   # :390
systemd.services.cloud-init.restartIfChanged = false;         # :391
systemd.services.cloud-config.restartIfChanged = false;       # :392
systemd.services.cloud-final.restartIfChanged = false;        # :393

There is no wantedBy = [], no unitConfig condition and no masking emitted for any cloud-init unit anywhere in the tree. The #893 rationale comment (vmguest.go:374-389) predicts precisely the signature we got ("the unit crashes, systemd retries it, it crashes identically ... clan's deploy exits 0, the masked_exit detector ... refuses the pass, and enroll-activate reds — on EVERY converge onto the box"). The knob is in, the failure recurred: the #893 ruling did not hold. Either (a) restartIfChanged = false suppresses a restart but not a start — switch-to-configuration will still start a unit the new generation wants that is not currently active, so a converged, already-initialised droplet re-runs the final stage; or (b) cloud-final is now failing for a different reason than #893's IsADirectoryError on /var/lib/cloud/instance. (a) vs (b) is not decidable from this run's evidence — that needs the gateway's own journal, which was not collected.

Harness (the reason it is not decidable). oc_device_evidence (scripts/lib/rehearsal-droplet.sh:1320-1329) keys the gateway harvest solely on artifacts/standing-founded.json:

1323:  local founded="$run_dir/artifacts/standing-founded.json" gw_ip=""
1324:  [[ -f "$founded" ]] && gw_ip="$(jq -r '.ip // empty' "$founded" ...)"
1325:  if [[ -n "$gw_ip" ]]; then ... else
1328:    echo "    device evidence: no standing gateway on record ... — skipping the gateway harvest"

But app/tests/e2e/journey.device.spec.ts:312-319 writes that file only after runRentedPrefix returns (and after enrolOperatorCredential()), so any red inside the prefix — the exact class this red is — silently skips the whole gateway harvest. Meanwhile artifacts/droplet-ip.txt already held the failing gateway's address (134.199.163.163), written mid-prefix at app/tests/e2e/fixtures/rentedPrefix.ts:291. The device branch never consults it (the rented branch does, scripts/smoke-private-path.sh:681-683). Net: a gateway-caused red produced no gateway evidence, with its IP sitting on disk.

What plugging it needs

  1. Un-blindfold the harness first (harness, mechanical). In oc_device_evidence, fall back to artifacts/droplet-ip.txt when standing-founded.json is absent, and skip only when both are — mirroring smoke-private-path.sh:681-683. Extend scripts/tests/device-evidence-order-test.sh (skip-message assertions at :79/:91) with a prefix-red case that must produce logs/gateway-journal.txt. Without this, every future enroll-activate red repeats this diagnosis dead-end.
  2. Decide (a) vs (b) from the next drive's journalctl -u cloud-final -u cloud-config plus ls -ld /var/lib/cloud/instance on the gateway. Do not change Nix before reading cloud-final's real ExecStart error.
  3. If (a): strengthen the gate in rentedHostNetworking() — restartIfChanged is the wrong knob for a unit that is started, not restarted. A condition such as systemd.services.cloud-final.unitConfig.ConditionPathIsSymbolicLink = "/var/lib/cloud/instance" (or wantedBy = [] on a rented converge) lets a genuine first boot run while an already-initialised droplet never re-runs the final stage. Keep networking.useNetworkd = true and the cloud-init .network files intact (GOTCHAS #64/#104/#703, #707's ssh_deletekeys = false).
  4. Pin it at the existing seam — TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit (internal/clan/vmguest_test.go:45-79) is the only test asserting these four lines; extend it to assert the stronger gate. Then go test ./internal/clan, then a --target device re-drive to prove enroll-activate clears.

Note the drive left gateway 134.199.163.163 standing (a device-target red never releases it, ADR 0208), so if it is still inside its lease it can be inspected directly — that is the fastest route to step 2.

drive 20260827T082850Z red at enroll-activate: journey leg "enroll-activate" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure: [gateway] Aug 27 08:43:08 idss-gatew
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260827T082850Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## The failure Drive `20260827T082850Z` (`--target device`, commit `ee9aef78`) went red at leg `standing`, propagated from `enroll-activate` after 247s. 11 legs green, 2 red, **0 skipped** — so this is *not* the known own-VPS pairing frontier (`legs.json` records no skip reasons at all this run; the drive died before pairing was ever reached). `enroll-copy` went green first (413631 ms, "726 store paths"), so the system reached the box: this is an **activation-side** failure, not a transport one. `clan` exited 0; the masked_exit detector (`internal/clan/errors.go:124-134`, tripped by the `"failed to"` marker at `errors.go:338`) refused the pass. ## Evidence `artifacts/legs.json` — the tripping lines, identical on the leg and on the `standing` wrapper: ``` { "leg": "enroll-activate", "status": "red", "ms": 247075, "error": "journey leg \"enroll-activate\" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure: [gateway] Aug 27 08:43:08 idss-gateway-rehearsal-c-0d69 systemd[1]: Failed to start Execute cloud user/final scripts. [gateway] Aug 27 08:43:32 idss-gateway-rehearsal-c-0d69 systemd[1]: Failed to start Execute cloud user/final scripts." } ``` That is `cloud-final.service` dying on the rented gateway during activation, then dying identically on systemd's retry 24 s later. `artifacts/verdict.json` — `"firstRedLeg": "standing"`, `"legs": {"total": 13, "green": 11, "red": 2, "skip": 0}`, `"commit": "ee9aef784971f7760b743ca1e1db2233f5c170bd"`. `logs/founding-state.log` — `standup.events[]` walks clean through `enroll-copy` ("the system is on the gateway") and into activation, then faults: ``` {"stage":"enroll-activate","message":"the droplet's resolver is warm — https://git.clan.lol/ reachable over its ssh door (attempt 1/6)"} {"stage":"enroll-activate","message":"clan reported success but the log shows a real failure: ..."} ``` with `draft.access.ip` = `134.199.163.163` and `"founded": true`, `standup.step: "rented"`. `artifacts/journey.device-.../error-context.md:36` — the app's own S10 fault frame carries the same line with `Retry` / `Switch the access option` buttons, so the product is faithfully surfacing a real deploy failure, not a Playwright artefact. `artifacts/journey.json` is `{"rows": null, "fault": null}` — the drive never reached its own founding rows. **The gateway's journal was never harvested.** `logs/` holds `device-*.txt` only, and `logs/device-journal.txt` is entirely the *member device* box: 563 hits for `clan-lab-rehearsal-26f45ade`, **zero** for `idss-gateway-rehearsal-c-0d69`. `logs/device-do-forensics.txt` probes `134.199.171.52` / droplet `595543661` — the device, not the gateway `134.199.163.163`. `logs/droplet-journal.txt` (named in the harvest contract) is absent; so are `logs/gateway-journal.txt` / `gateway-do-forensics.txt`. `logs/state-logs.log` and `logs/broker-journal.txt` are both explicit harvest misses (`ENOENT ... /test-results/standing-rented/state/logs`; `dev@100.98.48.68: Permission denied (publickey)` — the by-design off-mesh case, #681). **No live-box section was appended to this task**, so I had no access line to either box and diagnosed from the harvested logs alone. (`device-do-forensics.txt:10` records `tcp/22: a FRESH connect succeeded` at 08:43:38 — but against the *device*; nothing in this run ever probed the failing gateway.) ## Suspected layer — product, with a harness blindfold on top **Product.** `internal/clan/vmguest.go:361-393` (`rentedHostNetworking`). #893 (`0ebee23`, in this drive's tree — `ee9aef78` is a descendant) set exactly four lines as the whole mitigation: ```nix systemd.services.cloud-init-local.restartIfChanged = false; # :390 systemd.services.cloud-init.restartIfChanged = false; # :391 systemd.services.cloud-config.restartIfChanged = false; # :392 systemd.services.cloud-final.restartIfChanged = false; # :393 ``` There is **no** `wantedBy = []`, no `unitConfig` condition and no masking emitted for any cloud-init unit anywhere in the tree. The #893 rationale comment (`vmguest.go:374-389`) predicts precisely the signature we got ("the unit crashes, systemd retries it, it crashes identically ... clan's deploy exits 0, the masked_exit detector ... refuses the pass, and enroll-activate reds — on EVERY converge onto the box"). The knob is in, the failure recurred: **the #893 ruling did not hold.** Either (a) `restartIfChanged = false` suppresses a *restart* but not a *start* — `switch-to-configuration` will still start a unit the new generation wants that is not currently active, so a converged, already-initialised droplet re-runs the final stage; or (b) `cloud-final` is now failing for a different reason than #893's `IsADirectoryError` on `/var/lib/cloud/instance`. **(a) vs (b) is not decidable from this run's evidence** — that needs the gateway's own journal, which was not collected. **Harness (the reason it is not decidable).** `oc_device_evidence` (`scripts/lib/rehearsal-droplet.sh:1320-1329`) keys the gateway harvest *solely* on `artifacts/standing-founded.json`: ```sh 1323: local founded="$run_dir/artifacts/standing-founded.json" gw_ip="" 1324: [[ -f "$founded" ]] && gw_ip="$(jq -r '.ip // empty' "$founded" ...)" 1325: if [[ -n "$gw_ip" ]]; then ... else 1328: echo " device evidence: no standing gateway on record ... — skipping the gateway harvest" ``` But `app/tests/e2e/journey.device.spec.ts:312-319` writes that file only *after* `runRentedPrefix` returns (and after `enrolOperatorCredential()`), so any red **inside** the prefix — the exact class this red is — silently skips the whole gateway harvest. Meanwhile `artifacts/droplet-ip.txt` already held the failing gateway's address (`134.199.163.163`), written mid-prefix at `app/tests/e2e/fixtures/rentedPrefix.ts:291`. The device branch never consults it (the rented branch does, `scripts/smoke-private-path.sh:681-683`). Net: a gateway-caused red produced no gateway evidence, with its IP sitting on disk. ## What plugging it needs 1. **Un-blindfold the harness first (harness, mechanical).** In `oc_device_evidence`, fall back to `artifacts/droplet-ip.txt` when `standing-founded.json` is absent, and skip only when *both* are — mirroring `smoke-private-path.sh:681-683`. Extend `scripts/tests/device-evidence-order-test.sh` (skip-message assertions at `:79`/`:91`) with a prefix-red case that must produce `logs/gateway-journal.txt`. Without this, every future `enroll-activate` red repeats this diagnosis dead-end. 2. **Decide (a) vs (b)** from the next drive's `journalctl -u cloud-final -u cloud-config` plus `ls -ld /var/lib/cloud/instance` on the gateway. Do not change Nix before reading `cloud-final`'s real `ExecStart` error. 3. **If (a): strengthen the gate in `rentedHostNetworking()`** — `restartIfChanged` is the wrong knob for a unit that is *started*, not restarted. A condition such as `systemd.services.cloud-final.unitConfig.ConditionPathIsSymbolicLink = "/var/lib/cloud/instance"` (or `wantedBy = []` on a rented converge) lets a genuine first boot run while an already-initialised droplet never re-runs the final stage. Keep `networking.useNetworkd = true` and the cloud-init `.network` files intact (GOTCHAS #64/#104/#703, #707's `ssh_deletekeys = false`). 4. **Pin it at the existing seam** — `TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit` (`internal/clan/vmguest_test.go:45-79`) is the only test asserting these four lines; extend it to assert the stronger gate. Then `go test ./internal/clan`, then a `--target device` re-drive to prove `enroll-activate` clears. Note the drive left gateway `134.199.163.163` standing (a device-target red never releases it, ADR 0208), so if it is still inside its lease it can be inspected directly — that is the fastest route to step 2. drive `20260827T082850Z` red at `enroll-activate`: `journey leg "enroll-activate" went red: founding: stand up the rented server: clan: masked_exit on gateway: clan reported success but the log shows a real failure: [gateway] Aug 27 08:43:08 idss-gatew` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260827T082850Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 073c79de3e67 -->
Author
Member

Blocked — needs-info: the gateway cloud-final journal is required and cannot be obtained from the sandbox

I claimed this and worked it, but the product half cannot be shipped responsibly this iteration — it is waiting on live evidence I have no way to reach. Recording what I found so the next hands don't re-tread it.

Step 1 (the harness blindfold) is already CLOSED

The un-blindfold the ticket asks for in step 1 has already landed in the rehearsal-healer commit 8b34dde ("the gateway harvest keyed on a file the RED never writes"):

  • oc_device_evidence (scripts/lib/rehearsal-droplet.sh:1320-1329) now falls back to artifacts/droplet-ip.txt when standing-founded.json has no .ip, and only calls it a quiet skip when both are absent — mirroring smoke-private-path.sh:681.
  • scripts/tests/device-evidence-order-test.sh gained the prefix-red case (verified here: bash scripts/tests/device-evidence-order-test.sh → OK: 7 checks passed).

So every future enroll-activate red will now harvest logs/gateway-journal.txt. The blindfold is off. Nothing left to do on step 1.

Steps 2–4 (the product fix) are blocked on the gateway journal

The ticket is explicit: "Do not change Nix before reading cloud-final's real ExecStart error", and "(a) vs (b) is not decidable from this run's evidence." That evidence — journalctl -u cloud-final -u cloud-config + ls -ld /var/lib/cloud/instance on the gateway 134.199.163.163 — does not exist:

  • The failing drive 20260827T082850Z predates the healer fix, so its run dir carries no gateway journal (only device-*.txt, all of the member device).
  • From this sandcastle sandbox I cannot reach the box: it trusts only the per-drive rent-operator key (state/rent-operator/id_ed25519, minted into the drive's run dir on matou-workstation — not present here), and outbound tcp/22 to 134.199.163.163 times out. There is no ~/.ssh and no ambient key the box would accept.

A blind re-change to rentedHostNetworking() (internal/clan/vmguest.go:361-393) is exactly what the ticket forbids — #893's own change to these four lines already "did not hold," and this code is fenced by GOTCHAS #64/#104/#703/#707 (breaking networking.useNetworkd darkens the box). I will not guess the gate without the journal.

⏳ TIME-SENSITIVE: the failing gateway is STILL STANDING — harvest before it expires

DO API (this account, now) shows the box the drive left standing is alive:

595543878  idss-gateway-rehearsal-c-0d69  134.199.163.163 / 10.126.0.7  created 2026-08-27T08:30:08Z

Per ADR 0208 a device-target red never releases it, so the exact cloud-final state that failed can be read directly right now — no fresh (expensive) re-drive needed — from matou-workstation, which holds the rent-operator key:

key=/home/swarm/swarm/Matou/idss/test-results/drive-device/20260827T082850Z/state/rent-operator/id_ed25519
ssh -i "$key" -o StrictHostKeyChecking=accept-new root@134.199.163.163 \
  'journalctl -u cloud-final -u cloud-config -u cloud-init -u cloud-init-local --no-pager -n 4000; echo ===; ls -ld /var/lib/cloud/instance; ls -laR /var/lib/cloud/instances 2>/dev/null | head -60'

Paste that output onto this issue and re-add ready-for-agent; the fix then becomes a decidable, seam-pinned change.

My lean for whoever picks it up (NOT applied — needs the journal to confirm)

Strong prior on hypothesis (a): restartIfChanged = false gates the restart-on-change path only. A Type=oneshot/RemainAfterExit cloud-init unit that is newly introduced by the clan generation (relative to what is running on the fresh rented box) is put in switch-to-configuration's start set regardless of restartIfChanged, so it runs the final stage over already-initialised state. If confirmed, the robust gate is to stop the units being started on a converge (e.g. wantedBy = lib.mkForce [ ] on the four cloud-init units, since the box's networkd .network files + host keys already persist as /etc runtime files) — keeping networking.useNetworkd = true and ssh_deletekeys = false intact — pinned at TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit (internal/clan/vmguest_test.go:45-79). But the exact gate (a wantedBy cut vs the ticket's ConditionPathIsSymbolicLink) turns on what ls -ld /var/lib/cloud/instance actually shows — a symlink vs a reborn directory flips the condition — so the journal must come first.

Handing off as needs-info: the slice is not implementable until the gateway cloud-final journal exists (harvest the standing box above, or let the now-un-blindfolded next drive collect it).

## Blocked — `needs-info`: the gateway `cloud-final` journal is required and cannot be obtained from the sandbox I claimed this and worked it, but the **product half cannot be shipped responsibly this iteration** — it is waiting on live evidence I have no way to reach. Recording what I found so the next hands don't re-tread it. ### Step 1 (the harness blindfold) is already CLOSED The un-blindfold the ticket asks for in step 1 has already landed in the rehearsal-healer commit **`8b34dde`** ("the gateway harvest keyed on a file the RED never writes"): - `oc_device_evidence` (`scripts/lib/rehearsal-droplet.sh:1320-1329`) now falls back to `artifacts/droplet-ip.txt` when `standing-founded.json` has no `.ip`, and only calls it a quiet skip when **both** are absent — mirroring `smoke-private-path.sh:681`. - `scripts/tests/device-evidence-order-test.sh` gained the prefix-red case (verified here: `bash scripts/tests/device-evidence-order-test.sh` → **OK: 7 checks passed**). So every **future** `enroll-activate` red will now harvest `logs/gateway-journal.txt`. The blindfold is off. Nothing left to do on step 1. ### Steps 2–4 (the product fix) are blocked on the gateway journal The ticket is explicit: **"Do not change Nix before reading `cloud-final`'s real ExecStart error"**, and "(a) vs (b) is not decidable from this run's evidence." That evidence — `journalctl -u cloud-final -u cloud-config` + `ls -ld /var/lib/cloud/instance` on the **gateway** `134.199.163.163` — does not exist: - The failing drive `20260827T082850Z` **predates** the healer fix, so its run dir carries no gateway journal (only `device-*.txt`, all of the member device). - From this sandcastle sandbox I **cannot reach the box**: it trusts only the per-drive rent-operator key (`state/rent-operator/id_ed25519`, minted into the drive's run dir on matou-workstation — not present here), and outbound `tcp/22` to `134.199.163.163` times out. There is no `~/.ssh` and no ambient key the box would accept. A blind re-change to `rentedHostNetworking()` (`internal/clan/vmguest.go:361-393`) is exactly what the ticket forbids — #893's own change to these four lines already "did not hold," and this code is fenced by GOTCHAS #64/#104/#703/#707 (breaking `networking.useNetworkd` darkens the box). I will not guess the gate without the journal. ### ⏳ TIME-SENSITIVE: the failing gateway is STILL STANDING — harvest before it expires DO API (this account, now) shows the box the drive left standing is alive: ``` 595543878 idss-gateway-rehearsal-c-0d69 134.199.163.163 / 10.126.0.7 created 2026-08-27T08:30:08Z ``` Per ADR 0208 a device-target red never releases it, so **the exact `cloud-final` state that failed can be read directly right now** — no fresh (expensive) re-drive needed — from matou-workstation, which holds the rent-operator key: ```sh key=/home/swarm/swarm/Matou/idss/test-results/drive-device/20260827T082850Z/state/rent-operator/id_ed25519 ssh -i "$key" -o StrictHostKeyChecking=accept-new root@134.199.163.163 \ 'journalctl -u cloud-final -u cloud-config -u cloud-init -u cloud-init-local --no-pager -n 4000; echo ===; ls -ld /var/lib/cloud/instance; ls -laR /var/lib/cloud/instances 2>/dev/null | head -60' ``` Paste that output onto this issue and re-add `ready-for-agent`; the fix then becomes a decidable, seam-pinned change. ### My lean for whoever picks it up (NOT applied — needs the journal to confirm) Strong prior on **hypothesis (a)**: `restartIfChanged = false` gates the *restart-on-change* path only. A `Type=oneshot`/`RemainAfterExit` cloud-init unit that is **newly introduced by the clan generation** (relative to what is running on the fresh rented box) is put in switch-to-configuration's *start* set regardless of `restartIfChanged`, so it runs the final stage over already-initialised state. If confirmed, the robust gate is to stop the units being *started* on a converge (e.g. `wantedBy = lib.mkForce [ ]` on the four cloud-init units, since the box's networkd `.network` files + host keys already persist as `/etc` runtime files) — keeping `networking.useNetworkd = true` and `ssh_deletekeys = false` intact — pinned at `TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit` (`internal/clan/vmguest_test.go:45-79`). But the exact gate (a `wantedBy` cut vs the ticket's `ConditionPathIsSymbolicLink`) turns on what `ls -ld /var/lib/cloud/instance` actually shows — a symlink vs a reborn directory flips the condition — so the journal must come first. Handing off as **`needs-info`**: the slice is not implementable until the gateway `cloud-final` journal exists (harvest the standing box above, or let the now-un-blindfolded next drive collect it).
Owner

needs-info ANSWERED from the live box, under ADR 0174 — un-parked to ready-for-agent. Read this before touching Nix: step 3's proposed gate is wrong, and the failure is not ours.

Gateway 134.199.163.163 was still standing, so I ran exactly the two reads this ticket asked for.

1. ls -ld /var/lib/cloud/instance — the proposed condition would not have worked

lrwxrwxrwx 1 root root 34 Aug 27 08:30 /var/lib/cloud/instance -> /var/lib/cloud/instances/595543878
drwxr-xr-x 6 root root 4096 Aug 25 22:11 /var/lib/cloud/instances/595152509
drwxr-xr-x 6 root root 4096 Aug 27 08:31 /var/lib/cloud/instances/595543878

The symlink exists and names THIS droplet (595543878), written at 08:30 on its genuine first boot. So ConditionPathIsSymbolicLink = "/var/lib/cloud/instance" (step 3) is true on a first boot as well as a converge — it would not have suppressed the re-run, and had it been keyed differently it would have skipped cloud-final on real first boots. Do not land it.

Incidental but worth a separate look: 595152509 (Aug 25) is a stale instance dir baked into the gateway image — the snapshot was taken from a droplet that had already run cloud-init. Not the cause here.

2. cloud-final's real error — nothing of ours failed

The converge's run is clean:

Cloud-init v. 25.2 finished at Thu, 27 Aug 2026 08:43:32 +0000. ... Up 776.76 seconds
main.py[DEBUG]: Ran 8 modules with 0 failures
systemd[1]: cloud-final.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

Eight modules, zero failures, exit 2. Every per-instance module logged already ran (freq=once-per-instance); the only module with frequency always is final-message. The re-run therefore does no work at all.

The exit code comes from the persisted first-boot record, /var/lib/cloud/data/result.json:

"errors": [
 "('scripts-vendor', RuntimeError('Runparts: 2 failures (00-vpc-peering,install-dotty-agent) in 2 attempted commands'))",
 "('scripts-per-instance', RuntimeError('Runparts: 2 failures (machine_id.sh,systemd_automount.sh) in 2 attempted commands'))"
]

Those four are DigitalOcean's own droplet scripts, and they fail because this is NixOS:

subp.py[DEBUG]: Exec format error. Missing #! in script?
Reason: [Errno 8] Exec format error: b'/var/lib/cloud/scripts/per-instance/systemd_automount.sh'
cc_keys_to_console.py[WARNING]: Unable to activate module keys-to-console,
    helper tool not found at /usr/lib/cloud-init/write-ssh-key-fingerprints

00-vpc-peering, install-dotty-agent, machine_id.sh, systemd_automount.sh are DO vendor/per-instance scripts assuming an FHS distro. They have never worked on our gateways and never will. Note also the version step: first boot ran the image's cloud-init 24.2, the converge runs our Nix 25.2 — the switch replaces cloud-init and re-runs the final stage against a result.json written by the older one.

So the chain is

DO's scripts fail on NixOS (harmless, first boot, always) → cloud-init records them in result.json → the converge re-runs cloud-init modules --mode=final, does no work, but exits 2 because that record is non-empty → systemd logs Failed to start Execute cloud user/final scripts → masked_exit (internal/clan/errors.go:124-134) greps "failed to" and reds an activation in which nothing of ours went wrong.

clan exiting 0 was correct. The detector is right to be suspicious of that string in general; it is wrong here.

  1. Stop cloud-final re-running on a converge. It provably does nothing (every module already ran), so suppressing it loses no behaviour. restartIfChanged is indeed the wrong knob for a unit that is started; the honest gate keys on the converge, not on /var/lib/cloud/instance — e.g. wantedBy = [] on the rented converge path, leaving genuine first boot untouched. Keep networking.useNetworkd = true and the cloud-init .network files intact (GOTCHAS #64/#104, #707's ssh_deletekeys = false).
  2. Do not paper over it with SuccessExitStatus=2 — that would swallow genuine recoverable errors for the rest of the gateway's life.
  3. Do not widen the masked_exit allowlist as the primary fix. If a narrow guard is wanted as belt-and-braces, it should name this unit and this cause, never the "failed to" marker generally.
  4. Extend TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit (internal/clan/vmguest_test.go:45-79) to pin whichever gate lands, then go test ./internal/clan, then a --target device re-drive.

Drive context

20260827T082850Z reached 11 green / 2 red / 0 skip — enroll-copy green at 726 store paths, so the closure landed and this is activation-side only. The two reds are one fault (standing wraps enroll-activate). The box is left standing per ADR 0208; it can be reaped once someone has taken whatever else they want from it.

**`needs-info` ANSWERED from the live box, under ADR 0174 — un-parked to `ready-for-agent`. Read this before touching Nix: step 3's proposed gate is wrong, and the failure is not ours.** Gateway `134.199.163.163` was still standing, so I ran exactly the two reads this ticket asked for. ## 1. `ls -ld /var/lib/cloud/instance` — the proposed condition would not have worked ``` lrwxrwxrwx 1 root root 34 Aug 27 08:30 /var/lib/cloud/instance -> /var/lib/cloud/instances/595543878 drwxr-xr-x 6 root root 4096 Aug 25 22:11 /var/lib/cloud/instances/595152509 drwxr-xr-x 6 root root 4096 Aug 27 08:31 /var/lib/cloud/instances/595543878 ``` The symlink **exists and names THIS droplet** (`595543878`), written at 08:30 on its genuine first boot. So `ConditionPathIsSymbolicLink = "/var/lib/cloud/instance"` (step 3) is true on a first boot as well as a converge — it would not have suppressed the re-run, and had it been keyed differently it would have skipped `cloud-final` on real first boots. **Do not land it.** Incidental but worth a separate look: `595152509` (Aug 25) is a **stale instance dir baked into the gateway image** — the snapshot was taken from a droplet that had already run cloud-init. Not the cause here. ## 2. `cloud-final`'s real error — nothing of ours failed The converge's run is clean: ``` Cloud-init v. 25.2 finished at Thu, 27 Aug 2026 08:43:32 +0000. ... Up 776.76 seconds main.py[DEBUG]: Ran 8 modules with 0 failures systemd[1]: cloud-final.service: Main process exited, code=exited, status=2/INVALIDARGUMENT ``` **Eight modules, zero failures, exit 2.** Every per-instance module logged `already ran (freq=once-per-instance)`; the only module with `frequency always` is `final-message`. The re-run therefore does no work at all. The exit code comes from the persisted first-boot record, `/var/lib/cloud/data/result.json`: ```json "errors": [ "('scripts-vendor', RuntimeError('Runparts: 2 failures (00-vpc-peering,install-dotty-agent) in 2 attempted commands'))", "('scripts-per-instance', RuntimeError('Runparts: 2 failures (machine_id.sh,systemd_automount.sh) in 2 attempted commands'))" ] ``` Those four are **DigitalOcean's own droplet scripts**, and they fail because this is NixOS: ``` subp.py[DEBUG]: Exec format error. Missing #! in script? Reason: [Errno 8] Exec format error: b'/var/lib/cloud/scripts/per-instance/systemd_automount.sh' cc_keys_to_console.py[WARNING]: Unable to activate module keys-to-console, helper tool not found at /usr/lib/cloud-init/write-ssh-key-fingerprints ``` `00-vpc-peering`, `install-dotty-agent`, `machine_id.sh`, `systemd_automount.sh` are DO vendor/per-instance scripts assuming an FHS distro. They have never worked on our gateways and never will. Note also the version step: first boot ran the image's **cloud-init 24.2**, the converge runs our Nix **25.2** — the switch replaces cloud-init and re-runs the final stage against a `result.json` written by the older one. ## So the chain is DO's scripts fail on NixOS (harmless, first boot, always) → cloud-init records them in `result.json` → the converge re-runs `cloud-init modules --mode=final`, does no work, but exits **2** because that record is non-empty → systemd logs `Failed to start Execute cloud user/final scripts` → `masked_exit` (`internal/clan/errors.go:124-134`) greps `"failed to"` and reds an activation in which **nothing of ours went wrong**. `clan` exiting 0 was correct. The detector is right to be suspicious of that string in general; it is wrong here. ## Recommended fix — and what NOT to do 1. **Stop `cloud-final` re-running on a converge.** It provably does nothing (every module `already ran`), so suppressing it loses no behaviour. `restartIfChanged` is indeed the wrong knob for a unit that is *started*; the honest gate keys on the converge, not on `/var/lib/cloud/instance` — e.g. `wantedBy = []` on the rented converge path, leaving genuine first boot untouched. Keep `networking.useNetworkd = true` and the cloud-init `.network` files intact (GOTCHAS #64/#104, #707's `ssh_deletekeys = false`). 2. **Do not** paper over it with `SuccessExitStatus=2` — that would swallow genuine recoverable errors for the rest of the gateway's life. 3. **Do not** widen the `masked_exit` allowlist as the primary fix. If a narrow guard is wanted as belt-and-braces, it should name *this* unit and *this* cause, never the `"failed to"` marker generally. 4. Extend `TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit` (`internal/clan/vmguest_test.go:45-79`) to pin whichever gate lands, then `go test ./internal/clan`, then a `--target device` re-drive. ## Drive context `20260827T082850Z` reached **11 green / 2 red / 0 skip** — `enroll-copy` green at 726 store paths, so the closure landed and this is activation-side only. The two reds are one fault (`standing` wraps `enroll-activate`). The box is left standing per ADR 0208; it can be reaped once someone has taken whatever else they want from it.
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=12748
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=12748 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #899 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit 2f077e2f is not a valid commit object (fabricated, or never pushed)
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
  • changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits
  • changed_files: 'internal/clan/vmguest.go' is not in the diff of the claimed commits
  • changed_files: 'internal/clan/vmguest_test.go' is not in the diff of the claimed commits
envelope
{
  "issue": 899,
  "status": "success",
  "commits": [
    "2f077e2f"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/clan/vmguest.go",
    "internal/clan/vmguest_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/clan",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Decide (a) vs (b) from cloud-final's real error before changing Nix": "Ben's on-issue ADR-0174 ruling read gateway 134.199.163.163's live journal: NEITHER (a) restartIfChanged-vs-start nor (b) IsADirectoryError — cloud-final exits 2 from result.json recording DO's own vendor scripts failing Exec-format on NixOS; recorded in GOTCHAS #104 update (#899) and the commit body. Fix rests on that live evidence, not a theory.",
    "Strengthen the gate in rentedHostNetworking() (restartIfChanged is the wrong knob for a started unit)": "internal/clan/vmguest.go rentedHostNetworking(): the four unitConfig.ConditionPathExists boot-finished lines (#898) REPLACED with systemd.services.{cloud-init-local,cloud-init,cloud-config,cloud-final}.wantedBy = lib.mkForce [ ], per Ben's ruling to key on the converge not on /var/lib/cloud/instance; networking.useNetworkd + ssh_deletekeys=false kept intact.",
    "Pin it at the existing seam (TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit); go test ./internal/clan": "internal/clan/vmguest_test.go: test now asserts the four 'wantedBy = lib.mkForce [ ];' lines (red before code change, green after); go test ./internal/clan exit 0, go vet clean.",
    "Un-blindfold the harness (step 1)": "Already landed pre-claim in rehearsal-healer commit 8b34dde (oc_device_evidence falls back to droplet-ip.txt; device-evidence-order-test.sh gained the prefix-red case) — recorded by the prior needs-info comment; not re-done this slice."
  },
  "summary": "Replaced #898's boot-finished condition with wantedBy = lib.mkForce [ ] on the four rented-gateway cloud-init units, per Ben's live-journal ADR-0174 ruling that cloud-final's converge red is DO vendor-script exit 2 from result.json, not IsADirectoryError.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #899 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit 2f077e2f is not a valid commit object (fabricated, or never pushed) - changed_files: 'STATUS.md' is not in the diff of the claimed commits - changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits - changed_files: 'internal/clan/vmguest.go' is not in the diff of the claimed commits - changed_files: 'internal/clan/vmguest_test.go' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 899, "status": "success", "commits": [ "2f077e2f" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/clan/vmguest.go", "internal/clan/vmguest_test.go" ], "tests": [ { "command": "go test ./internal/clan", "exit_code": 0 }, { "command": "go vet ./internal/clan", "exit_code": 0 } ], "criteria": { "Decide (a) vs (b) from cloud-final's real error before changing Nix": "Ben's on-issue ADR-0174 ruling read gateway 134.199.163.163's live journal: NEITHER (a) restartIfChanged-vs-start nor (b) IsADirectoryError — cloud-final exits 2 from result.json recording DO's own vendor scripts failing Exec-format on NixOS; recorded in GOTCHAS #104 update (#899) and the commit body. Fix rests on that live evidence, not a theory.", "Strengthen the gate in rentedHostNetworking() (restartIfChanged is the wrong knob for a started unit)": "internal/clan/vmguest.go rentedHostNetworking(): the four unitConfig.ConditionPathExists boot-finished lines (#898) REPLACED with systemd.services.{cloud-init-local,cloud-init,cloud-config,cloud-final}.wantedBy = lib.mkForce [ ], per Ben's ruling to key on the converge not on /var/lib/cloud/instance; networking.useNetworkd + ssh_deletekeys=false kept intact.", "Pin it at the existing seam (TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit); go test ./internal/clan": "internal/clan/vmguest_test.go: test now asserts the four 'wantedBy = lib.mkForce [ ];' lines (red before code change, green after); go test ./internal/clan exit 0, go vet clean.", "Un-blindfold the harness (step 1)": "Already landed pre-claim in rehearsal-healer commit 8b34dde (oc_device_evidence falls back to droplet-ip.txt; device-evidence-order-test.sh gained the prefix-red case) — recorded by the prior needs-info comment; not re-done this slice." }, "summary": "Replaced #898's boot-finished condition with wantedBy = lib.mkForce [ ] on the four rented-gateway cloud-init units, per Ben's live-journal ADR-0174 ruling that cloud-final's converge red is DO vendor-script exit 2 from result.json, not IsADirectoryError.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Author
Member

close-report for #899 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 899,
  "status": "success",
  "commits": [
    "2f077e233ffd6c841e97fffed160b7f05233f789"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/clan/vmguest.go",
    "internal/clan/vmguest_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/clan",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Decide (a) vs (b) from cloud-final's real error before changing Nix": "Ben's on-issue ADR-0174 ruling read gateway 134.199.163.163's live journal: NEITHER (a) restartIfChanged-vs-start nor (b) IsADirectoryError — cloud-final exits 2 from result.json recording DO's own vendor scripts failing Exec-format on NixOS; recorded in GOTCHAS #104 update (#899) and the commit body. Fix rests on that live evidence, not a theory.",
    "Strengthen the gate in rentedHostNetworking() (restartIfChanged is the wrong knob for a started unit)": "internal/clan/vmguest.go rentedHostNetworking(): the four unitConfig.ConditionPathExists boot-finished lines (#898) REPLACED with systemd.services.{cloud-init-local,cloud-init,cloud-config,cloud-final}.wantedBy = lib.mkForce [ ], per Ben's ruling to key on the converge not on /var/lib/cloud/instance; networking.useNetworkd + ssh_deletekeys=false kept intact.",
    "Pin it at the existing seam (TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit); go test ./internal/clan": "internal/clan/vmguest_test.go: test now asserts the four 'wantedBy = lib.mkForce [ ];' lines (red before code change, green after); go test ./internal/clan exit 0, go vet clean.",
    "Un-blindfold the harness (step 1)": "Already landed pre-claim in rehearsal-healer commit 8b34dde (oc_device_evidence falls back to droplet-ip.txt; device-evidence-order-test.sh gained the prefix-red case) — recorded by the prior needs-info comment; not re-done this slice."
  },
  "summary": "Replaced #898's boot-finished condition with wantedBy = lib.mkForce [ ] on the four rented-gateway cloud-init units, per Ben's live-journal ADR-0174 ruling that cloud-final's converge red is DO vendor-script exit 2 from result.json, not IsADirectoryError.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #899 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 899, "status": "success", "commits": [ "2f077e233ffd6c841e97fffed160b7f05233f789" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/clan/vmguest.go", "internal/clan/vmguest_test.go" ], "tests": [ { "command": "go test ./internal/clan", "exit_code": 0 }, { "command": "go vet ./internal/clan", "exit_code": 0 } ], "criteria": { "Decide (a) vs (b) from cloud-final's real error before changing Nix": "Ben's on-issue ADR-0174 ruling read gateway 134.199.163.163's live journal: NEITHER (a) restartIfChanged-vs-start nor (b) IsADirectoryError — cloud-final exits 2 from result.json recording DO's own vendor scripts failing Exec-format on NixOS; recorded in GOTCHAS #104 update (#899) and the commit body. Fix rests on that live evidence, not a theory.", "Strengthen the gate in rentedHostNetworking() (restartIfChanged is the wrong knob for a started unit)": "internal/clan/vmguest.go rentedHostNetworking(): the four unitConfig.ConditionPathExists boot-finished lines (#898) REPLACED with systemd.services.{cloud-init-local,cloud-init,cloud-config,cloud-final}.wantedBy = lib.mkForce [ ], per Ben's ruling to key on the converge not on /var/lib/cloud/instance; networking.useNetworkd + ssh_deletekeys=false kept intact.", "Pin it at the existing seam (TestRenderGatewayGuest_PublicGatewayKeepsNetworkdAndCloudInit); go test ./internal/clan": "internal/clan/vmguest_test.go: test now asserts the four 'wantedBy = lib.mkForce [ ];' lines (red before code change, green after); go test ./internal/clan exit 0, go vet clean.", "Un-blindfold the harness (step 1)": "Already landed pre-claim in rehearsal-healer commit 8b34dde (oc_device_evidence falls back to droplet-ip.txt; device-evidence-order-test.sh gained the prefix-red case) — recorded by the prior needs-info comment; not re-done this slice." }, "summary": "Replaced #898's boot-finished condition with wantedBy = lib.mkForce [ ] on the four rented-gateway cloud-init units, per Ben's live-journal ADR-0174 ruling that cloud-final's converge red is DO vendor-script exit 2 from result.json, not IsADirectoryError.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
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#899
No description provided.