deploy-services: the gateway↔guest mesh peer flaps with no relay fallback — the services deploy dies mid-closure-copy (ssh 255), and a bare sops token mislabels it missing_var and eats the transport retry #1210

Closed
opened 2026-09-04 02:49:46 +00:00 by matou-build-agent · 3 comments

Drive 20260904T014213Z (test-results/drive-device/20260904T014213Z), target device, red at leg deploy-services (27/28 green, leg took 18m22s). Signature db4e706c778c. Commit under test: 432ffed1.

deploy failed (clean-retry): provision: deploy node-req-0003: clan: deploy failed on 1 node(s):
node-req-0003: clan: missing_var on node-req-0003: a required secret has not been generated:
/nix/store/hi0fdcqdkmzwxhzlx7y6z2yf6d5lw8ix-expand-response-params
/nix/store/y64m3miy9jd5h6hfwkdigbgp8ipb4cmr-python-namespaces-hook.sh
Committed 2 files to git: sops/secrets/node-req-0003-age.key/users/gateway, sops/secrets/node-req-0003-age.key/secret
Committed sops/machines/node-req-0003 to git
[node-req-0003] failed with error: nix build failed for 'node-req-0003' (exit code 255).
1 hosts failed with an error. Check the logs above

The message is a lie in two directions and there are two distinct defects. The secret it names was generated — the very lines it quotes are clan committing it successfully.


The deploy dials node-req-0003 — the VM guest — over its mesh address (ADR 0223 §1: the guest owns wt0, the gateway's clan seam deploys straight to it). The peer was disconnected for the entire deploy window.

Timeline from logs/gateway-journal.txt (peer WXclh4sLQ1cPNMVtGVKF9Q0PNK2Hfy++NRx8j4B2tEg=, the only peer on the gateway — VM mode's host never joins, ADR 0223 §3):

line time event
:1585-1587 02:15:44 peer connects — configure WireGuard endpoint to: 10.126.0.5:34622
:1598 02:19:38 ICE disconnected, do not switch to Relay. Reset priority to: None
:1643 02:25:43 Dump stat: Status: Connecting, SentOffer: 15, … SwitchToRelay: 0, RelayConnected: 0
:1664-1665 02:34:05 the deploy fails — switch-journal harvest empty, then provision deploy failed
:1671-1673 02:34:13 peer reconnects — 8s too late
:1675 02:35:43 Status: Connected
:1676 02:38:20 ICE disconnected, do not switch to Relay again
:1694-1695 02:41:52 the retry/offboard fails the same way (classified config_eval this time)
:1984-1986 02:42:26 reconnects, endpoint now 170.64.195.65:34622 (the public IP, not the VPC one)
:1992 02:42:56 disconnected again

So the link holds for ~4 minutes and is down for 8–15. Relay is not supported by remote peer appears 24 times in the gateway journal; RelayConnected: 0 and SwitchToRelay: 0 in every state dump. Meanwhile the guest's own view (logs/device-guest-mesh-status.log, harvested 02:42) reads Relays: 2/2 Available, Peers count: 1/1 Connected, wt0 up at 100.110.142.185 — the two ends disagree about whether a relay exists, and that asymmetry is the thing to chase.

The mechanism is structural, not a blip. docs/adr/0223-vm-guest-joins-the-mesh.md:16-17 puts the guest on QEMU user-mode (SLIRP) networking — logs/device-guest-unit.log confirms -netdev user,id=net0,hostfwd=…. SLIRP is an inbound-less, re-mapping NAT: the endpoint the gateway learns is the host's outer mapping, it changes under it (10.126.0.5 → 170.64.195.65 across the run), and UDP hole-punching cannot hold it open. With relay refused, there is no second path, so the peer sits in Connecting for minutes at a time.

The closure copy died inside one of those windows. The store paths in the excerpt (…-expand-response-params, …-python-namespaces-hook.sh) are copying path lines — the transport dropped mid-copy, ssh returned 255, and clan wrapped it as nix build failed for 'node-req-0003' (exit code 255).

This needs a design ruling, which is why I did not touch it. The options are not equivalent: make the relay path actually work between gateway and guest; give the guest bridged/tap networking instead of SLIRP; forward the guest's WireGuard UDP port through the host; or have the deploy gate on peer liveness and wait rather than dial into a dead window. Each changes what a deploy does and what the community's device sees.

Defect 2 (mechanical, and it ate the recovery): the sops token steals the classification

internal/clan/errors.go:252-259 classifies missing_var on a bare substring:

case strings.Contains(both, "missing var") || strings.Contains(both, "no such secret") ||
     strings.Contains(both, "vars generate") || strings.Contains(both, "sops") ||

Clan prints Committed 2 files to git: sops/secrets/node-req-0003-age.key/… and Committed sops/machines/node-req-0003 to git on the success path of vars generation. Those lines are in the output handed to Classify, so "sops" matches and the transport death is labelled a missing secret — with the remedy "run vars generate for the node", for a secret clan had just finished generating.

This is precisely the false-positive class the disk case fixed at errors.go:234-250 (#374), whose comment already names this exact hazard: an expand-response-params copy line carrying a bare esp. logSaysDisk scans line by line so progress noise cannot trip a match. The secret case never got the same treatment.

The cost is not just a confusing message. updateNode (internal/clan/adapter.go:626-645) carries exactly ONE sanctioned transport retry for #563, gated at :639:

if f == nil || f.Kind != FailConnectivity || ctx.Err() != nil {
    return out
}

Classified missing_var, the reconnect-and-retry never fired — the one recovery mechanism built for an ssh-transport death was disabled by a substring match on a success line.

A related gap sits alongside it. The #563 exit-255 case (errors.go:210-217) reads the process exit code, and internal/clan/errors_transport_test.go:15-33 pins it that way (Classify("gateway", 255, …)). But clan-cli here aggregates: it prints 1 hosts failed with an error and exits non-255, carrying the 255 only inside the per-node wrapper text. So the transport case did not fire either, on the exact failure it was written for. Note the second attempt at :1695 classified the same fault config_eval — the same event lands in two different classes depending on which progress noise happens to be in the excerpt.

Notes for whoever takes defect 2

  • Suggested shape: a logSaysSecret line scanner mirroring logSaysDisk, anchoring sops to failure lines and exempting clan's Committed … progress; plus reading (exit code 255) out of clan's per-node wrapper, not only the process exit.
  • No existing test asserts a bare sops substring → missing_var. internal/clan/errors_missingvar_test.go:10-14 uses only real clan phrases (Couldn't find var: …), and errors_transport_test.go:78-83 uses error: Couldn't find var: x for machine: gateway. So this can be fixed without editing any assertion.
  • Targeted check: go test ./internal/clan.
  • Worth a docs/GOTCHAS.md entry — this is the third bare-substring theft in this classifier (#374 disk, #563 transport, now secrets).

Suspected layer

  • Defect 1: guest mesh transport — docs/adr/0223-vm-guest-joins-the-mesh.md §1/§3, the guest's SLIRP NIC (vm/manager.go), and the NetBird relay path between gateway and guest. Infra + product behaviour.
  • Defect 2: internal/clan/errors.go classification order, consumed by internal/clan/adapter.go:639. Mechanical, unit-testable.

The journey harness itself is sound: app/tests/e2e/journey.device.spec.ts:895-937 red at waitForDeployActive (:906) because the deploy genuinely failed server-side. No selector, ceiling, or fixture is at fault.

Absent from the evidence

No droplet-journal.txt (this drive harvests device-journal.txt / gateway-journal.txt instead). The nix build's own stderr is nowhere in the run directory — the control plane logs only the classified WARN, so the Failure.Tail (#546) for node-req-0003 never reached disk; the device was offboarded at 02:41:52 and state/clan-config-snapshot/tree.txt consequently holds no machines/node-req-0003/. Capturing that tail would have made this diagnosis a minute's work instead of an hour's.

Why I refused rather than healed

Refusal rule 3 (product-behaviour surface), on both defects. Defect 1 alters what a deploy does and what a community's device sees, on infra outside this checkout, and cannot be tested on this machine. Defect 2 also changes what a deploy does — it re-arms the one-shot transport retry on a live box — and changes the operator-facing remedy; it is diagnosis wiring in the control plane, not harness, fixtures, scripts/, or test plumbing.

Healing defect 2 alone would also not have made this leg green: with the peer down for fourteen minutes, an immediate reconnect-and-retry lands in the same dead window. It would have bought a truthful error message and burned a paid re-drive for nothing.

confident: false — defect 1 needs a ruling on the guest's network shape before anyone writes code. Defect 2 is confidently actionable on its own and could be split out.

drive 20260904T014213Z red at deploy-services: deploy failed (clean-retry): provision: deploy node-req-0003: clan: deploy failed on 1 node(s): node-req-0003: clan: missing_var on node-req-0003: a required secret has not been generated: /nix/store/
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260904T014213Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

Drive `20260904T014213Z` (`test-results/drive-device/20260904T014213Z`), target `device`, red at leg **`deploy-services`** (27/28 green, leg took 18m22s). Signature `db4e706c778c`. Commit under test: `432ffed1`. ``` deploy failed (clean-retry): provision: deploy node-req-0003: clan: deploy failed on 1 node(s): node-req-0003: clan: missing_var on node-req-0003: a required secret has not been generated: /nix/store/hi0fdcqdkmzwxhzlx7y6z2yf6d5lw8ix-expand-response-params /nix/store/y64m3miy9jd5h6hfwkdigbgp8ipb4cmr-python-namespaces-hook.sh Committed 2 files to git: sops/secrets/node-req-0003-age.key/users/gateway, sops/secrets/node-req-0003-age.key/secret Committed sops/machines/node-req-0003 to git [node-req-0003] failed with error: nix build failed for 'node-req-0003' (exit code 255). 1 hosts failed with an error. Check the logs above ``` The message is a lie in two directions and there are **two distinct defects**. The secret it names *was* generated — the very lines it quotes are clan committing it successfully. --- ## Defect 1 (the cause of the red): the gateway↔guest mesh link flaps, and there is no relay to fall back to The deploy dials `node-req-0003` — the VM guest — over its mesh address (ADR 0223 §1: the guest owns `wt0`, the gateway's clan seam deploys straight to it). The peer was **disconnected** for the entire deploy window. Timeline from `logs/gateway-journal.txt` (peer `WXclh4sLQ1cPNMVtGVKF9Q0PNK2Hfy++NRx8j4B2tEg=`, the only peer on the gateway — VM mode's host never joins, ADR 0223 §3): | line | time | event | |---|---|---| | `:1585-1587` | 02:15:44 | peer connects — `configure WireGuard endpoint to: 10.126.0.5:34622` | | `:1598` | 02:19:38 | **`ICE disconnected, do not switch to Relay. Reset priority to: None`** | | `:1643` | 02:25:43 | `Dump stat: Status: Connecting, SentOffer: 15, … SwitchToRelay: 0, RelayConnected: 0` | | `:1664-1665` | **02:34:05** | **the deploy fails** — switch-journal harvest empty, then `provision deploy failed` | | `:1671-1673` | 02:34:13 | peer reconnects — **8s too late** | | `:1675` | 02:35:43 | `Status: Connected` | | `:1676` | 02:38:20 | `ICE disconnected, do not switch to Relay` again | | `:1694-1695` | 02:41:52 | the retry/offboard fails the same way (classified `config_eval` this time) | | `:1984-1986` | 02:42:26 | reconnects, endpoint now `170.64.195.65:34622` (the *public* IP, not the VPC one) | | `:1992` | 02:42:56 | disconnected again | So the link holds for ~4 minutes and is down for 8–15. `Relay is not supported by remote peer` appears **24 times** in the gateway journal; `RelayConnected: 0` and `SwitchToRelay: 0` in every state dump. Meanwhile the guest's own view (`logs/device-guest-mesh-status.log`, harvested 02:42) reads `Relays: 2/2 Available`, `Peers count: 1/1 Connected`, `wt0` up at `100.110.142.185` — **the two ends disagree about whether a relay exists**, and that asymmetry is the thing to chase. The mechanism is structural, not a blip. `docs/adr/0223-vm-guest-joins-the-mesh.md:16-17` puts the guest on QEMU **user-mode (SLIRP) networking** — `logs/device-guest-unit.log` confirms `-netdev user,id=net0,hostfwd=…`. SLIRP is an inbound-less, re-mapping NAT: the endpoint the gateway learns is the *host's* outer mapping, it changes under it (10.126.0.5 → 170.64.195.65 across the run), and UDP hole-punching cannot hold it open. With relay refused, there is no second path, so the peer sits in `Connecting` for minutes at a time. The closure copy died inside one of those windows. The store paths in the excerpt (`…-expand-response-params`, `…-python-namespaces-hook.sh`) are `copying path` lines — the transport dropped mid-copy, ssh returned 255, and clan wrapped it as `nix build failed for 'node-req-0003' (exit code 255)`. **This needs a design ruling, which is why I did not touch it.** The options are not equivalent: make the relay path actually work between gateway and guest; give the guest bridged/tap networking instead of SLIRP; forward the guest's WireGuard UDP port through the host; or have the deploy gate on peer liveness and wait rather than dial into a dead window. Each changes what a deploy does and what the community's device sees. ## Defect 2 (mechanical, and it ate the recovery): the `sops` token steals the classification `internal/clan/errors.go:252-259` classifies `missing_var` on a **bare substring**: ```go case strings.Contains(both, "missing var") || strings.Contains(both, "no such secret") || strings.Contains(both, "vars generate") || strings.Contains(both, "sops") || ``` Clan prints `Committed 2 files to git: sops/secrets/node-req-0003-age.key/…` and `Committed sops/machines/node-req-0003 to git` on the **success** path of vars generation. Those lines are in the output handed to `Classify`, so `"sops"` matches and the transport death is labelled a missing secret — with the remedy "run vars generate for the node", for a secret clan had just finished generating. This is precisely the false-positive class the *disk* case fixed at `errors.go:234-250` (#374), whose comment already names this exact hazard: an `expand-response-params` copy line carrying a bare `esp`. `logSaysDisk` scans line by line so progress noise cannot trip a match. The secret case never got the same treatment. **The cost is not just a confusing message.** `updateNode` (`internal/clan/adapter.go:626-645`) carries exactly ONE sanctioned transport retry for #563, gated at `:639`: ```go if f == nil || f.Kind != FailConnectivity || ctx.Err() != nil { return out } ``` Classified `missing_var`, the reconnect-and-retry **never fired** — the one recovery mechanism built for an ssh-transport death was disabled by a substring match on a success line. A related gap sits alongside it. The #563 exit-255 case (`errors.go:210-217`) reads the **process** exit code, and `internal/clan/errors_transport_test.go:15-33` pins it that way (`Classify("gateway", 255, …)`). But clan-cli here *aggregates*: it prints `1 hosts failed with an error` and exits non-255, carrying the 255 only inside the per-node wrapper text. So the transport case did not fire either, on the exact failure it was written for. Note the second attempt at `:1695` classified the same fault `config_eval` — the same event lands in two different classes depending on which progress noise happens to be in the excerpt. ### Notes for whoever takes defect 2 - Suggested shape: a `logSaysSecret` line scanner mirroring `logSaysDisk`, anchoring `sops` to failure lines and exempting clan's `Committed …` progress; plus reading `(exit code 255)` out of clan's per-node wrapper, not only the process exit. - **No existing test asserts a bare `sops` substring → `missing_var`.** `internal/clan/errors_missingvar_test.go:10-14` uses only real clan phrases (`Couldn't find var: …`), and `errors_transport_test.go:78-83` uses `error: Couldn't find var: x for machine: gateway`. So this can be fixed without editing any assertion. - Targeted check: `go test ./internal/clan`. - Worth a `docs/GOTCHAS.md` entry — this is the third bare-substring theft in this classifier (#374 disk, #563 transport, now secrets). ## Suspected layer - **Defect 1:** guest mesh transport — `docs/adr/0223-vm-guest-joins-the-mesh.md` §1/§3, the guest's SLIRP NIC (`vm/manager.go`), and the NetBird relay path between gateway and guest. Infra + product behaviour. - **Defect 2:** `internal/clan/errors.go` classification order, consumed by `internal/clan/adapter.go:639`. Mechanical, unit-testable. The journey harness itself is sound: `app/tests/e2e/journey.device.spec.ts:895-937` red at `waitForDeployActive` (`:906`) because the deploy genuinely failed server-side. No selector, ceiling, or fixture is at fault. ## Absent from the evidence No `droplet-journal.txt` (this drive harvests `device-journal.txt` / `gateway-journal.txt` instead). **The nix build's own stderr is nowhere in the run directory** — the control plane logs only the classified WARN, so the `Failure.Tail` (#546) for `node-req-0003` never reached disk; the device was offboarded at 02:41:52 and `state/clan-config-snapshot/tree.txt` consequently holds no `machines/node-req-0003/`. Capturing that tail would have made this diagnosis a minute's work instead of an hour's. ## Why I refused rather than healed **Refusal rule 3 (product-behaviour surface)**, on both defects. Defect 1 alters what a deploy does and what a community's device sees, on infra outside this checkout, and cannot be tested on this machine. Defect 2 also changes what a deploy does — it re-arms the one-shot transport retry on a live box — and changes the operator-facing remedy; it is diagnosis wiring in the control plane, not harness, fixtures, `scripts/`, or test plumbing. Healing defect 2 alone would also **not** have made this leg green: with the peer down for fourteen minutes, an immediate reconnect-and-retry lands in the same dead window. It would have bought a truthful error message and burned a paid re-drive for nothing. `confident: false` — defect 1 needs a ruling on the guest's network shape before anyone writes code. Defect 2 is confidently actionable on its own and could be split out. drive `20260904T014213Z` red at `deploy-services`: `deploy failed (clean-retry): provision: deploy node-req-0003: clan: deploy failed on 1 node(s): node-req-0003: clan: missing_var on node-req-0003: a required secret has not been generated: /nix/store/` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260904T014213Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: db4e706c778c -->
Author
Member

Ruled by agent under ADR 0174 — veto anytime. Session-runner drain of #1210.

This ticket names two distinct defects. I split them: defect 2 was a two-way door — landed and proven. Defect 1 is a one-way door — parked ready-for-human with the ruling menu below. The ticket stays open on defect 1.


Defect 2 — LANDED (commit b93701e2)

The clan failure classifier stops letting clan's vars-generation success noise steal a transport death. Two compounding bare-substring thefts in internal/clan/errors.go, fixed:

  1. A bare sops substring matched clan's Committed sops/secrets/<node>-age.key/… to git git-commit progress — the vars-generation success path. So the ssh-transport death (nix build failed … (exit code 255)) was mislabelled missing_var: a required secret has not been generated, for a secret clan had just finished generating. Now logSaysSecret scans line by line, mirroring logSaysDisk (#374): the self-identifying failure phrases (couldn't find var, no such secret, missing var) match anywhere, but the weak sops/vars generate tokens must ride a failure marker on their own line — which Committed … lines never carry.
  2. The (exit code 255) wrapper. clan-cli AGGREGATES per-node failures: it prints 1 hosts failed with an error and exits non-255, carrying the 255 only inside the per-node nix build failed for '<node>' (exit code 255) wrapper. The #563 transport case read only the process exit code, so it never fired on the exact failure it was written for. Classify now matches the (exit code 255) wrapper alongside exit == 255.

Together these re-arm the one sanctioned #563 transport retry (adapter.go updateNode, gated on FailConnectivity).

Proof: +4 pins in internal/clan/errors_secretscan_test.go (red before, green after); go test ./internal/clan green; go build ./... clean. No existing assertion changed — the fix adds cases, it regresses none. GOTCHAS #159 (the third bare-substring theft in this classifier: #374 disk, #563 transport, now secrets). STATUS.md updated.

Why two-way (ADR 0174 §1): revertible with a single commit; provable by the new unit tests (no live infra, no credentials); not on the one-way-door list. Re-arming the already-sanctioned, idempotent, one-shot #563 retry on the class it was written for is mechanical control-plane wiring — no security-posture widening, no trust surface, no spend. Advances #1210.

Honest limit: this does NOT green the drive. With the peer down ~14 minutes (defect 1), an immediate reconnect-and-retry lands in the same dead window. Defect 2 buys a truthful error and a re-armed retry — not a passing leg.


Why human (defect 1 — the red's cause)

Ben's ruling — a network-shape decision, one-way. The deploy-services red is the gateway↔guest mesh peer flapping with no relay to fall back to: the link holds ~4 min and is down 8–15 min at a stretch (gateway journal :1598 ICE disconnected, do not switch to Relay; Relay is not supported by remote peer ×24; the closure copy died inside one of those windows → ssh 255). The mechanism is structural, not a blip: ADR 0223 §1 puts the guest on QEMU user-mode (SLIRP) networking — an inbound-less re-mapping NAT whose outer endpoint changes under the peer (10.126.0.5 → 170.64.195.65 across the run), so UDP hole-punching cannot hold, and with relay refused there is no second path. The two ends even disagree about whether a relay exists (guest reads Relays: 2/2 Available; gateway RelayConnected: 0).

This is a one-way door under ADR 0174 §3: it changes what a deploy does and what a community's device sees, on infra outside this checkout, and cannot be tested on this machine. It needs a ruling before anyone writes code.

Proposed default rulings (pick one):

  • (A) Make the relay path actually work gateway↔guest — chase the asymmetry where the guest sees Relays: 2/2 but the gateway sees RelayConnected: 0 / Relay is not supported by remote peer. Smallest behavioural change; keeps SLIRP.
  • (B) Give the guest bridged/tap networking instead of SLIRP (vm/manager.go) — a stable, hole-punchable endpoint; changes the device's host-network posture.
  • (C) Forward the guest's WireGuard UDP port through the host — keeps SLIRP but adds an inbound hostfwd; a small deliberately-inbound surface (posture note).
  • (D) Gate the deploy on peer liveness — wait for Connected rather than dial into a dead window; changes deploy timing/ceilings, treats the flap as a fact of life rather than fixing it.

My lean: (A) first (diagnose the relay asymmetry — cheapest, no posture change), with (D) as a resilience backstop regardless. But this is a product/infra decision, so I did not adopt a default under §1.

Two follow-ups for whoever takes defect 1 (I did not act on these — no door here):

  • The nix build's own stderr never reached disk — the control plane logged only the classified WARN, so Failure.Tail (#546) for node-req-0003 was lost and state/clan-config-snapshot/tree.txt holds no machines/node-req-0003/ (offboarded 02:41:52). Capturing that tail would make this a minute's diagnosis. Worth its own ticket.
  • This drive harvested no droplet-journal.txt (it captured device-journal.txt/gateway-journal.txt).

Routing: relabelled ready-for-session → ready-for-human for defect 1's network-shape ruling. Not closed — the red's cause is unresolved. Ruled by agent under ADR 0174; veto the defect-2 landing anytime (revert b93701e2).

**Ruled by agent under ADR 0174 — veto anytime.** Session-runner drain of #1210. This ticket names **two distinct defects**. I split them: **defect 2 was a two-way door — landed and proven. Defect 1 is a one-way door — parked `ready-for-human` with the ruling menu below.** The ticket stays open on defect 1. --- ## Defect 2 — LANDED (commit `b93701e2`) The clan failure classifier stops letting clan's vars-generation **success** noise steal a transport death. Two compounding bare-substring thefts in `internal/clan/errors.go`, fixed: 1. **A bare `sops` substring** matched clan's `Committed sops/secrets/<node>-age.key/… to git` git-commit progress — the vars-generation **success** path. So the ssh-transport death (`nix build failed … (exit code 255)`) was mislabelled `missing_var: a required secret has not been generated`, for a secret clan had just finished generating. Now `logSaysSecret` scans line by line, mirroring `logSaysDisk` (#374): the self-identifying failure phrases (`couldn't find var`, `no such secret`, `missing var`) match anywhere, but the weak `sops`/`vars generate` tokens must ride a failure marker on their own line — which `Committed …` lines never carry. 2. **The `(exit code 255)` wrapper.** clan-cli AGGREGATES per-node failures: it prints `1 hosts failed with an error` and exits **non-255**, carrying the 255 only inside the per-node `nix build failed for '<node>' (exit code 255)` wrapper. The #563 transport case read only the **process** exit code, so it never fired on the exact failure it was written for. `Classify` now matches the `(exit code 255)` wrapper alongside `exit == 255`. Together these re-arm the one sanctioned #563 transport retry (`adapter.go` `updateNode`, gated on `FailConnectivity`). **Proof:** `+4` pins in `internal/clan/errors_secretscan_test.go` (red before, green after); `go test ./internal/clan` green; `go build ./...` clean. **No existing assertion changed** — the fix adds cases, it regresses none. GOTCHAS #159 (the third bare-substring theft in this classifier: #374 disk, #563 transport, now secrets). STATUS.md updated. **Why two-way (ADR 0174 §1):** revertible with a single commit; provable by the new unit tests (no live infra, no credentials); not on the one-way-door list. Re-arming the already-sanctioned, idempotent, one-shot #563 retry on the class it was written for is mechanical control-plane wiring — no security-posture widening, no trust surface, no spend. Advances #1210. **Honest limit:** this does **NOT** green the drive. With the peer down ~14 minutes (defect 1), an immediate reconnect-and-retry lands in the same dead window. Defect 2 buys a truthful error and a re-armed retry — not a passing leg. --- ## Why human (defect 1 — the red's cause) **Ben's ruling — a network-shape decision, one-way.** The `deploy-services` red is the gateway↔guest mesh peer **flapping with no relay to fall back to**: the link holds ~4 min and is down 8–15 min at a stretch (gateway journal `:1598` `ICE disconnected, do not switch to Relay`; `Relay is not supported by remote peer` ×24; the closure copy died inside one of those windows → ssh 255). The mechanism is structural, not a blip: ADR 0223 §1 puts the guest on QEMU **user-mode (SLIRP)** networking — an inbound-less re-mapping NAT whose outer endpoint changes under the peer (`10.126.0.5` → `170.64.195.65` across the run), so UDP hole-punching cannot hold, and with relay refused there is no second path. The two ends even disagree about whether a relay exists (guest reads `Relays: 2/2 Available`; gateway `RelayConnected: 0`). This is a one-way door under ADR 0174 §3: it **changes what a deploy does and what a community's device sees**, on infra outside this checkout, and **cannot be tested on this machine**. It needs a ruling before anyone writes code. **Proposed default rulings (pick one):** - **(A) Make the relay path actually work** gateway↔guest — chase the asymmetry where the guest sees `Relays: 2/2` but the gateway sees `RelayConnected: 0` / `Relay is not supported by remote peer`. Smallest behavioural change; keeps SLIRP. - **(B) Give the guest bridged/tap networking** instead of SLIRP (`vm/manager.go`) — a stable, hole-punchable endpoint; changes the device's host-network posture. - **(C) Forward the guest's WireGuard UDP port** through the host — keeps SLIRP but adds an inbound hostfwd; a small deliberately-inbound surface (posture note). - **(D) Gate the deploy on peer liveness** — wait for `Connected` rather than dial into a dead window; changes deploy timing/ceilings, treats the flap as a fact of life rather than fixing it. My lean: **(A)** first (diagnose the relay asymmetry — cheapest, no posture change), with **(D)** as a resilience backstop regardless. But this is a product/infra decision, so I did not adopt a default under §1. **Two follow-ups for whoever takes defect 1** (I did not act on these — no door here): - The nix build's own stderr never reached disk — the control plane logged only the classified WARN, so `Failure.Tail` (#546) for `node-req-0003` was lost and `state/clan-config-snapshot/tree.txt` holds no `machines/node-req-0003/` (offboarded 02:41:52). Capturing that tail would make this a minute's diagnosis. Worth its own ticket. - This drive harvested no `droplet-journal.txt` (it captured `device-journal.txt`/`gateway-journal.txt`). --- **Routing:** relabelled `ready-for-session` → `ready-for-human` for defect 1's network-shape ruling. Not closed — the red's cause is unresolved. Ruled by agent under ADR 0174; veto the defect-2 landing anytime (revert `b93701e2`).
Owner

Session's decision brief for defect 1 (Ben — the drive is parked on this). Defect 2 landed twice over (runner's b93701e2 + session pins; note b77aabf8 briefly shipped conflict markers from the race, fixed in ec378c93 — post-mortem in that commit).

One fact the ticket's options don't name: the relay refusal looks like a netbird VERSION asymmetry. The guest runs netbird 0.31.1 (the nixos-24.11 pin, 50ab793 — the only nixpkgs whose services.netbird.tunnels module the image can use, eef024dc). The gateway runs the deployed side's netbird (clan-core's newer nixpkgs). Netbird's NEW relay protocol landed ~0.33 and is what current clients negotiate; the gateway logs Relay is not supported by remote peer (24×, about the guest) while the guest reports Relays: 2/2 Available (its old-protocol view) — the exact two-ends-disagree asymmetry the ticket flags as the thing to chase.

Options, cheapest-first:

  • A. Align the guest's netbird version with the deployed side — override just the netbird package in the guest image (keep the 24.11 tunnels module, inject the newer package; the module wiring is version-tolerant). Tests the relay hypothesis directly: with relay negotiating, the deploy rides a stable relayed path through every SLIRP flap. Two-way (one image commit, revertible), and arguably REQUIRED by the behavioural-mirror rule — a guest that cannot speak the community's relay protocol is not mirroring the deployed dialect. Recommended first move; I can land it and the next drive is the proof.
  • D. Deploy gates on peer liveness (wait-for-Connected before dialing, plus the now-re-armed transport retry) — complement, not cure: the direct link holds only ~4 min and the closure copy is longer, so without a relay this just picks a luckier start.
  • B. hostfwd the guest's WireGuard UDP through the host — gives the direct path a stable endpoint, but netbird has no per-peer static-endpoint knob to advertise it cleanly; fiddly, half a fix.
  • C. Bridged/tap networking for the guest — the structural end-state candidate, but it touches host networking on member devices (root, bridge on a single-NIC droplet) and deserves its own ADR; not a mid-arc move.

Proposed ruling (veto anytime): A now under ADR 0174 (two-way), D as a follow-up ticket, C parked to a phase-7-retro ADR. If you rule A, I'll land the package override and re-fire; if the relay then negotiates but deploys still flap out, B/C get their real evidence.

**Session's decision brief for defect 1 (Ben — the drive is parked on this).** Defect 2 landed twice over (runner's `b93701e2` + session pins; note `b77aabf8` briefly shipped conflict markers from the race, fixed in `ec378c93` — post-mortem in that commit). **One fact the ticket's options don't name: the relay refusal looks like a netbird VERSION asymmetry.** The guest runs netbird **0.31.1** (the nixos-24.11 pin, `50ab793` — the only nixpkgs whose `services.netbird.tunnels` module the image can use, eef024dc). The gateway runs the deployed side's netbird (clan-core's newer nixpkgs). Netbird's NEW relay protocol landed ~0.33 and is what current clients negotiate; the gateway logs `Relay is not supported by remote peer` (24×, about the guest) while the guest reports `Relays: 2/2 Available` (its old-protocol view) — the exact two-ends-disagree asymmetry the ticket flags as the thing to chase. **Options, cheapest-first:** - **A. Align the guest's netbird version with the deployed side** — override just the `netbird` *package* in the guest image (keep the 24.11 `tunnels` module, inject the newer package; the module wiring is version-tolerant). Tests the relay hypothesis directly: with relay negotiating, the deploy rides a stable relayed path through every SLIRP flap. Two-way (one image commit, revertible), and arguably REQUIRED by the behavioural-mirror rule — a guest that cannot speak the community's relay protocol is not mirroring the deployed dialect. **Recommended first move; I can land it and the next drive is the proof.** - **D. Deploy gates on peer liveness** (wait-for-Connected before dialing, plus the now-re-armed transport retry) — complement, not cure: the direct link holds only ~4 min and the closure copy is longer, so without a relay this just picks a luckier start. - **B. hostfwd the guest's WireGuard UDP** through the host — gives the direct path a stable endpoint, but netbird has no per-peer static-endpoint knob to advertise it cleanly; fiddly, half a fix. - **C. Bridged/tap networking for the guest** — the structural end-state candidate, but it touches host networking on member devices (root, bridge on a single-NIC droplet) and deserves its own ADR; not a mid-arc move. **Proposed ruling (veto anytime): A now under ADR 0174 (two-way), D as a follow-up ticket, C parked to a phase-7-retro ADR.** If you rule A, I'll land the package override and re-fire; if the relay then negotiates but deploys still flap out, B/C get their real evidence.
Owner

Defect 1 diagnosis corrected, then LANDED (defect 2 landed earlier in b93701e2).

Verification against drive 12's journals and the pinned sources reshaped the ticket's two claims:

  • "The device is behind a NAT" — imprecise but pointing at something real. The device is a droplet with a public IP (this is why phase 5's full-install device held rock solid). The NAT is one we render: QEMU's SLIRP user-net inside the droplet, which had only four loopback TCP forwards and no UDP path at all — the guest's WireGuard was reachable only through the ephemeral mapping a guest-initiated flow leaves behind, which libslirp expires under idle. That expiry is the dead window the drive red on.
  • "netbird version skew" — RIGHT (and my mid-drive "disproved" was a misread, owned in GOTCHAS #160: the handshaker's received offer, running version 0.31.1 names the remote peer — the guest — not the logging gateway). The image's 24.11 pin ships netbird 0.31.1; the plane and the first machines update rebuild run clan-core's 0.72.3. 0.31 predates the rels:// relay protocol, hence 24× Relay is not supported by remote peer.
  • Third fault, not in the ticket: management advertised an empty relay list (update relay server URLs: []) — the plane ran coturn but no rels:// relay daemon, and the 0.72 client's only fallback IS the rels:// relay (the 0.30-era TURN switch is gone from the client's connection logic). Even two 0.72 peers would have had no fallback. A home-NAT member device — the peer class the relay role exists for — would hit this wall permanently.

Landed (f251e1f8):

  1. Pinned direct path — system-scope netdev adds hostfwd=udp::51820-:51820; GuestMeshJoin passes --external-ip-map <host outward IP> so the guest offers the droplet's stable door as an ICE candidate. Guest firewall opens 51820/udp (the 24.11 tunnels module doesn't; the deployed clients module does — contract now identical across the flip). User scope stays loopback-only (founding never joins; operator laptops may already bind 51820).
  2. Client lockstep — flake.nix overlays the guest image's pkgs.netbird from clan-core's own nixpkgs (verified: image now evals netbird 0.72.3). Module dialects still differ by design; the wire version cannot.
  3. Relay plane — netbird-relay daemon on the gateway (loopback :8013, fronted at mesh.<apex>:443/relay — the ADR 0214 decision-2 shape, no new WAN port), advertised via settings.Relay.Addresses, shared secret = new netbird-relay clan var generator (own generator, GOTCHAS #5; asserted by name).

ADR 0223 + ADR 0214 amended; GOTCHAS #160. Contract pins: TestCreate_WireGuardUDPForwardIsSystemScopeOnly, TestGuestMeshJoin_AdvertisesHostOutwardIP, TestNetbird_RelayPlaneAdvertisedAndServed, front-door /relay route pins.

Arming: nix/flake drift ⇒ next fire re-founds + rebuilds the snapshot (rule 3a, correct — the relay must land on the gateway); the vm-guest payload slot is presence-keyed, so I force-restaged it (rm vm-guest.tar).

Ruled by session under ADR 0174 — veto anytime. Advances #1153.

**Defect 1 diagnosis corrected, then LANDED** (defect 2 landed earlier in `b93701e2`). Verification against drive 12's journals and the pinned sources reshaped the ticket's two claims: - **"The device is behind a NAT" — imprecise but pointing at something real.** The device is a droplet with a public IP (this is why phase 5's full-install device held rock solid). The NAT is one *we* render: QEMU's SLIRP user-net inside the droplet, which had only four loopback TCP forwards and **no UDP path at all** — the guest's WireGuard was reachable only through the ephemeral mapping a guest-initiated flow leaves behind, which libslirp expires under idle. That expiry is the dead window the drive red on. - **"netbird version skew" — RIGHT** (and my mid-drive "disproved" was a misread, owned in GOTCHAS #160: the handshaker's `received offer, running version 0.31.1` names the **remote** peer — the guest — not the logging gateway). The image's 24.11 pin ships netbird 0.31.1; the plane and the first `machines update` rebuild run clan-core's 0.72.3. 0.31 predates the rels:// relay protocol, hence 24× `Relay is not supported by remote peer`. - **Third fault, not in the ticket:** management advertised an **empty relay list** (`update relay server URLs: []`) — the plane ran coturn but no rels:// relay daemon, and the 0.72 client's only fallback IS the rels:// relay (the 0.30-era TURN switch is gone from the client's connection logic). Even two 0.72 peers would have had no fallback. A home-NAT member device — the peer class the relay role exists for — would hit this wall permanently. **Landed (`f251e1f8`):** 1. **Pinned direct path** — system-scope netdev adds `hostfwd=udp::51820-:51820`; `GuestMeshJoin` passes `--external-ip-map <host outward IP>` so the guest offers the droplet's stable door as an ICE candidate. Guest firewall opens 51820/udp (the 24.11 tunnels module doesn't; the deployed clients module does — contract now identical across the flip). User scope stays loopback-only (founding never joins; operator laptops may already bind 51820). 2. **Client lockstep** — flake.nix overlays the guest image's `pkgs.netbird` from clan-core's own nixpkgs (verified: image now evals netbird **0.72.3**). Module dialects still differ by design; the wire version cannot. 3. **Relay plane** — `netbird-relay` daemon on the gateway (loopback :8013, fronted at `mesh.<apex>:443/relay` — the ADR 0214 decision-2 shape, no new WAN port), advertised via `settings.Relay.Addresses`, shared secret = new `netbird-relay` clan var generator (own generator, GOTCHAS #5; asserted by name). ADR 0223 + ADR 0214 amended; GOTCHAS #160. Contract pins: `TestCreate_WireGuardUDPForwardIsSystemScopeOnly`, `TestGuestMeshJoin_AdvertisesHostOutwardIP`, `TestNetbird_RelayPlaneAdvertisedAndServed`, front-door `/relay` route pins. **Arming:** nix/flake drift ⇒ next fire re-founds + rebuilds the snapshot (rule 3a, correct — the relay must land on the gateway); the vm-guest payload slot is presence-keyed, so I force-restaged it (`rm vm-guest.tar`). Ruled by session under ADR 0174 — veto anytime. Advances #1153.
ben closed this issue 2026-09-04 09:44:58 +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#1210
No description provided.