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
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#1210
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Drive
20260904T014213Z(test-results/drive-device/20260904T014213Z), targetdevice, red at legdeploy-services(27/28 green, leg took 18m22s). Signaturedb4e706c778c. Commit under test:432ffed1.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 ownswt0, the gateway's clan seam deploys straight to it). The peer was disconnected for the entire deploy window.Timeline from
logs/gateway-journal.txt(peerWXclh4sLQ1cPNMVtGVKF9Q0PNK2Hfy++NRx8j4B2tEg=, the only peer on the gateway — VM mode's host never joins, ADR 0223 §3)::1585-1587configure WireGuard endpoint to: 10.126.0.5:34622:1598ICE disconnected, do not switch to Relay. Reset priority to: None:1643Dump stat: Status: Connecting, SentOffer: 15, … SwitchToRelay: 0, RelayConnected: 0:1664-1665provision deploy failed:1671-1673:1675Status: Connected:1676ICE disconnected, do not switch to Relayagain:1694-1695config_evalthis time):1984-1986170.64.195.65:34622(the public IP, not the VPC one):1992So the link holds for ~4 minutes and is down for 8–15.
Relay is not supported by remote peerappears 24 times in the gateway journal;RelayConnected: 0andSwitchToRelay: 0in every state dump. Meanwhile the guest's own view (logs/device-guest-mesh-status.log, harvested 02:42) readsRelays: 2/2 Available,Peers count: 1/1 Connected,wt0up at100.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-17puts the guest on QEMU user-mode (SLIRP) networking —logs/device-guest-unit.logconfirms-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 inConnectingfor 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) arecopying pathlines — the transport dropped mid-copy, ssh returned 255, and clan wrapped it asnix 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
sopstoken steals the classificationinternal/clan/errors.go:252-259classifiesmissing_varon a bare substring:Clan prints
Committed 2 files to git: sops/secrets/node-req-0003-age.key/…andCommitted sops/machines/node-req-0003 to giton the success path of vars generation. Those lines are in the output handed toClassify, 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: anexpand-response-paramscopy line carrying a bareesp.logSaysDiskscans 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: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, andinternal/clan/errors_transport_test.go:15-33pins it that way (Classify("gateway", 255, …)). But clan-cli here aggregates: it prints1 hosts failed with an errorand 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:1695classified the same faultconfig_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
logSaysSecretline scanner mirroringlogSaysDisk, anchoringsopsto failure lines and exempting clan'sCommitted …progress; plus reading(exit code 255)out of clan's per-node wrapper, not only the process exit.sopssubstring →missing_var.internal/clan/errors_missingvar_test.go:10-14uses only real clan phrases (Couldn't find var: …), anderrors_transport_test.go:78-83useserror: Couldn't find var: x for machine: gateway. So this can be fixed without editing any assertion.go test ./internal/clan.docs/GOTCHAS.mdentry — this is the third bare-substring theft in this classifier (#374 disk, #563 transport, now secrets).Suspected layer
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.internal/clan/errors.goclassification order, consumed byinternal/clan/adapter.go:639. Mechanical, unit-testable.The journey harness itself is sound:
app/tests/e2e/journey.device.spec.ts:895-937red atwaitForDeployActive(: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 harvestsdevice-journal.txt/gateway-journal.txtinstead). The nix build's own stderr is nowhere in the run directory — the control plane logs only the classified WARN, so theFailure.Tail(#546) fornode-req-0003never reached disk; the device was offboarded at 02:41:52 andstate/clan-config-snapshot/tree.txtconsequently holds nomachines/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
20260904T014213Zred atdeploy-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/20260904T014213Zon matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was capturedRuled 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-humanwith 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:sopssubstring matched clan'sCommitted sops/secrets/<node>-age.key/… to gitgit-commit progress — the vars-generation success path. So the ssh-transport death (nix build failed … (exit code 255)) was mislabelledmissing_var: a required secret has not been generated, for a secret clan had just finished generating. NowlogSaysSecretscans line by line, mirroringlogSaysDisk(#374): the self-identifying failure phrases (couldn't find var,no such secret,missing var) match anywhere, but the weaksops/vars generatetokens must ride a failure marker on their own line — whichCommitted …lines never carry.(exit code 255)wrapper. clan-cli AGGREGATES per-node failures: it prints1 hosts failed with an errorand exits non-255, carrying the 255 only inside the per-nodenix 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.Classifynow matches the(exit code 255)wrapper alongsideexit == 255.Together these re-arm the one sanctioned #563 transport retry (
adapter.goupdateNode, gated onFailConnectivity).Proof:
+4pins ininternal/clan/errors_secretscan_test.go(red before, green after);go test ./internal/clangreen;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-servicesred 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:1598ICE 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.65across 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 readsRelays: 2/2 Available; gatewayRelayConnected: 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):
Relays: 2/2but the gateway seesRelayConnected: 0/Relay is not supported by remote peer. Smallest behavioural change; keeps SLIRP.vm/manager.go) — a stable, hole-punchable endpoint; changes the device's host-network posture.Connectedrather 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):
Failure.Tail(#546) fornode-req-0003was lost andstate/clan-config-snapshot/tree.txtholds nomachines/node-req-0003/(offboarded 02:41:52). Capturing that tail would make this a minute's diagnosis. Worth its own ticket.droplet-journal.txt(it captureddevice-journal.txt/gateway-journal.txt).Routing: relabelled
ready-for-session→ready-for-humanfor 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 (revertb93701e2).Session's decision brief for defect 1 (Ben — the drive is parked on this). Defect 2 landed twice over (runner's
b93701e2+ session pins; noteb77aabf8briefly shipped conflict markers from the race, fixed inec378c93— 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 whoseservices.netbird.tunnelsmodule 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 logsRelay is not supported by remote peer(24×, about the guest) while the guest reportsRelays: 2/2 Available(its old-protocol view) — the exact two-ends-disagree asymmetry the ticket flags as the thing to chase.Options, cheapest-first:
netbirdpackage in the guest image (keep the 24.11tunnelsmodule, 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.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.
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:
received offer, running version 0.31.1names the remote peer — the guest — not the logging gateway). The image's 24.11 pin ships netbird 0.31.1; the plane and the firstmachines updaterebuild run clan-core's 0.72.3. 0.31 predates the rels:// relay protocol, hence 24×Relay is not supported by remote peer.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):hostfwd=udp::51820-:51820;GuestMeshJoinpasses--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).pkgs.netbirdfrom clan-core's own nixpkgs (verified: image now evals netbird 0.72.3). Module dialects still differ by design; the wire version cannot.netbird-relaydaemon on the gateway (loopback :8013, fronted atmesh.<apex>:443/relay— the ADR 0214 decision-2 shape, no new WAN port), advertised viasettings.Relay.Addresses, shared secret = newnetbird-relayclan 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/relayroute 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.
config_eval— the one-shot transport retry never fires and the operator is told to fix a flake that is fine #1272