enroll/join: the member grant's mesh admission is placeholder material — netbird up rejects mesh.internal and no device can land #956

Closed
opened 2026-08-28 20:46:24 +00:00 by matou-build-agent · 4 comments

Failure

Drive 20260828T202109Z (--target device), red at leg approve after the full 300 s ceiling; 23/24 legs green (artifacts/verdict.json, artifacts/legs.json).

The Playwright fixture races the Connected card against the strip's refusal alert and neither ever rendered:

Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first()
Error: element(s) not found

The device end says why (artifacts/join-transcript.txt, held PTY exited 1):

level=ERROR msg="install command did not reach Pending" component=agent
  err="join: mesh admission: meshup: netbird up:
       netbird [up --setup-key $\x11\xc5\xc1\xbfJ\xd64Պ... --management-url mesh.internal]:
       exit status 1: Error: call service setConfig method: rpc error: code = Unknown
       desc = failed to update profile config: parse "mesh.internal": invalid URI for request"

Evidence

The defect is the admission material the community CA mints for a member device:

  • internal/enroll/community_ca.go:210-219 — MeshAdmissionFor returns, for any non-gateway role:
    • internal/enroll/community_ca.go:216 — Management: "mesh.internal". A bare hostname. netbird's --management-url requires an absolute URI, so setConfig refuses it before a single packet leaves the box.
    • internal/enroll/community_ca.go:215 — SetupKey: randBytes(32). Thirty-two raw random bytes, not a Netbird setup key. agent/internal/meshup/meshup.go:46 passes it through string(adm.SetupKey), which is the binary argv printed in the error above. Even with a valid management URL this key could not be redeemed.
    • The function's own doc comment names it: "placeholder material until the management plane mints real setup keys — #844's rung".
  • internal/enroll/enroll.go:290 — Redeemable() is true on Management != "" alone, so placeholder material reads as redeemable.
  • internal/join/land.go:86-90 — Enroll therefore calls Mesh.Join unconditionally for a member device and returns before ConfirmEnrolled when it fails.
  • agent/cmd/agent/wiring_prod.go:69 — production wiring is the real meshup.New(run) (the fake is dev-only, wiring_dev.go:40), so the drive hits real netbird.
  • netbird is present and healthy on the device — logs/device-journal.txt:1407, Started netbird.service - NetBird mesh network client at 20:37:15, three seconds before the 20:37:18 failure. This is the material, not a missing binary (ADR 0100's errNetbirdAbsent path was not taken).
  • There is no Netbird management plane to point a corrected URL at. The only netbird server config in the tree is spikes/kanidm-netbird/clan/modules/netbird.nix — a spike module, not referenced by the shipped clan config. No .nix under the deployed community declares services.netbird.server.

Why this fires now

0ca9192c ("the published curl|sh install doorway waits on the operator's decision instead of exiting 0 at 'connection request sent'") implemented ADR 0209 decision 1. Before it, agent enroll returned at Pending and the landing had no production caller, so the placeholder admission was never redeemed against real netbird. The drive now walks the landing for real and hits the rung that was never built.

Secondary: the failure has no operator-facing surface

Worth fixing alongside, because it is what cost this run 300 s and a whole droplet:

  • dashboard/src/components/device-add/PendingDevicesSurface.vue:40-48 renders data-status="pending-device-error" only from the Approve verb's own error (useAsyncGuard). A landing that dies on the device end never touches it.
  • internal/join/land.go:87-89 returns the mesh failure to the device's terminal and nothing reports it back to the control plane, so the request sits at Approved forever.
  • app/tests/e2e/fixtures/deviceAdd.ts:202-209 can therefore only time out. The gateway journal carries no ConfirmEnrolled for this request, consistent with a request stuck at Approved.

ADR 0209's honesty rule ("never a line the machine cannot back") arguably cuts both ways here: a landing that failed should be visible to the operator who approved it, not only to whoever is watching the device's terminal.

Suspected layer

The enrollment/mesh seam — internal/enroll (grant minting) and the mesh control plane that does not yet exist under the community's clan config. Not the agent adapter: agent/internal/meshup/meshup.go did exactly the right thing with what it was handed, and failed loud.

What plugging it needs

This is #844's rung and needs a ruling before code, because the two ways forward differ in scope and both touch ADR 0209 §3 ("the mesh address is a first-class fact, reported at landing"):

  1. Build the management plane. Promote spikes/kanidm-netbird/clan/modules/netbird.nix into the shipped clan config (management + signal + TURN, kanidm-backed per ADR 0039), give the gateway a real management URL, and have MeshAdmissionFor mint a genuine single-use setup key against it instead of randBytes(32). This is the ADR 0209 §3 end state — the device joins a real mesh and reports a real wt0 address. It is a multi-commit slice with a dependency and NixOS-service surface.
  2. Gate the landing until (1) lands. Stop minting placeholder admission for member roles so Redeemable() is honestly false, and let the landing skip mesh admission the way the founding gateway already does (internal/join/land.go:83-90, #907). The device would land at Connected with an empty mesh address — which ADR 0209 §3 permits as "an honest empty, never a fabricated one" — but the fleet then cannot route to a service on a member device, so this is a knowing deferral, not a fix.

Either way, the secondary surface gap should close too: ConfirmEnrolled (or a sibling call) needs a path for the device to report a failed landing, and PendingDevicesSurface.vue needs to render it, so the next red fails in seconds rather than burning a 300 s ceiling and a stood-up droplet.

A healer cannot take this: it is a dependency/infra change outside this checkout, the choice between (1) and (2) is a design ruling, and neither is verifiable on this machine.

drive 20260828T202109Z red at approve: expect(locator).toBeVisible() failed Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first() Expected: visible Timeout: 300000ms Error: element(
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T202109Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure Drive `20260828T202109Z` (`--target device`), red at leg `approve` after the full 300 s ceiling; 23/24 legs green (`artifacts/verdict.json`, `artifacts/legs.json`). The Playwright fixture races the Connected card against the strip's refusal alert and neither ever rendered: ``` Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first() Error: element(s) not found ``` The device end says why (`artifacts/join-transcript.txt`, held PTY exited 1): ``` level=ERROR msg="install command did not reach Pending" component=agent err="join: mesh admission: meshup: netbird up: netbird [up --setup-key $\x11\xc5\xc1\xbfJ\xd64Պ... --management-url mesh.internal]: exit status 1: Error: call service setConfig method: rpc error: code = Unknown desc = failed to update profile config: parse "mesh.internal": invalid URI for request" ``` ## Evidence The defect is the admission material the community CA mints for a member device: - `internal/enroll/community_ca.go:210-219` — `MeshAdmissionFor` returns, for any non-gateway role: - `internal/enroll/community_ca.go:216` — `Management: "mesh.internal"`. A bare hostname. netbird's `--management-url` requires an absolute URI, so `setConfig` refuses it before a single packet leaves the box. - `internal/enroll/community_ca.go:215` — `SetupKey: randBytes(32)`. Thirty-two raw random bytes, not a Netbird setup key. `agent/internal/meshup/meshup.go:46` passes it through `string(adm.SetupKey)`, which is the binary argv printed in the error above. Even with a valid management URL this key could not be redeemed. - The function's own doc comment names it: "placeholder material until the management plane mints real setup keys — #844's rung". - `internal/enroll/enroll.go:290` — `Redeemable()` is true on `Management != ""` alone, so placeholder material reads as redeemable. - `internal/join/land.go:86-90` — `Enroll` therefore calls `Mesh.Join` unconditionally for a member device and returns before `ConfirmEnrolled` when it fails. - `agent/cmd/agent/wiring_prod.go:69` — production wiring is the real `meshup.New(run)` (the fake is dev-only, `wiring_dev.go:40`), so the drive hits real netbird. - netbird is present and healthy on the device — `logs/device-journal.txt:1407`, `Started netbird.service - NetBird mesh network client` at 20:37:15, three seconds before the 20:37:18 failure. This is the material, not a missing binary (ADR 0100's `errNetbirdAbsent` path was not taken). - **There is no Netbird management plane to point a corrected URL at.** The only netbird server config in the tree is `spikes/kanidm-netbird/clan/modules/netbird.nix` — a spike module, not referenced by the shipped clan config. No `.nix` under the deployed community declares `services.netbird.server`. ### Why this fires now `0ca9192c` ("the published curl|sh install doorway waits on the operator's decision instead of exiting 0 at 'connection request sent'") implemented ADR 0209 decision 1. Before it, `agent enroll` returned at Pending and the landing had no production caller, so the placeholder admission was never redeemed against real netbird. The drive now walks the landing for real and hits the rung that was never built. ### Secondary: the failure has no operator-facing surface Worth fixing alongside, because it is what cost this run 300 s and a whole droplet: - `dashboard/src/components/device-add/PendingDevicesSurface.vue:40-48` renders `data-status="pending-device-error"` only from the *Approve verb's* own error (`useAsyncGuard`). A landing that dies on the device end never touches it. - `internal/join/land.go:87-89` returns the mesh failure to the device's terminal and nothing reports it back to the control plane, so the request sits at Approved forever. - `app/tests/e2e/fixtures/deviceAdd.ts:202-209` can therefore only time out. The gateway journal carries no `ConfirmEnrolled` for this request, consistent with a request stuck at Approved. ADR 0209's honesty rule ("never a line the machine cannot back") arguably cuts both ways here: a landing that failed should be visible to the operator who approved it, not only to whoever is watching the device's terminal. ## Suspected layer The enrollment/mesh seam — `internal/enroll` (grant minting) and the mesh control plane that does not yet exist under the community's clan config. Not the agent adapter: `agent/internal/meshup/meshup.go` did exactly the right thing with what it was handed, and failed loud. ## What plugging it needs This is #844's rung and needs a ruling before code, because the two ways forward differ in scope and both touch ADR 0209 §3 ("the mesh address is a first-class fact, reported at landing"): 1. **Build the management plane.** Promote `spikes/kanidm-netbird/clan/modules/netbird.nix` into the shipped clan config (management + signal + TURN, kanidm-backed per ADR 0039), give the gateway a real management URL, and have `MeshAdmissionFor` mint a genuine single-use setup key against it instead of `randBytes(32)`. This is the ADR 0209 §3 end state — the device joins a real mesh and reports a real `wt0` address. It is a multi-commit slice with a dependency and NixOS-service surface. 2. **Gate the landing until (1) lands.** Stop minting placeholder admission for member roles so `Redeemable()` is honestly false, and let the landing skip mesh admission the way the founding gateway already does (`internal/join/land.go:83-90`, #907). The device would land at Connected with an empty mesh address — which ADR 0209 §3 permits as "an honest empty, never a fabricated one" — but the fleet then cannot route to a service on a member device, so this is a knowing deferral, not a fix. Either way, the secondary surface gap should close too: `ConfirmEnrolled` (or a sibling call) needs a path for the device to report a *failed* landing, and `PendingDevicesSurface.vue` needs to render it, so the next red fails in seconds rather than burning a 300 s ceiling and a stood-up droplet. A healer cannot take this: it is a dependency/infra change outside this checkout, the choice between (1) and (2) is a design ruling, and neither is verifiable on this machine. drive `20260828T202109Z` red at `approve`: `expect(locator).toBeVisible() failed Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first() Expected: visible Timeout: 300000ms Error: element(` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T202109Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: c1ac37bc5a0d -->
Owner

RULED by Ben (2026-08-28): option 1 — build the management plane

The community mesh controller ships on the gateway per ADR 0039 (management + signal + relay, a peer on every node); placeholder admission is never shipped. Routing ready-for-session → needs-design: this is a spec-sized slice, not a session fix.

Scope sketch for the design lane (from today's evidence, drive 20260828T202109Z):

  • Promote spikes/kanidm-netbird/clan/modules/netbird.nix (268 lines: management + signal + coturn, OIDC config, WireGuard 51820/udp fleet-wide, peer auto-login by setup key) into the shipped clan config, rendered by both gateway renders (GOTCHAS #12). The spike's own header names the split: daemons + config are declarative; minting a setup key and approving peers are runtime provisioning the control plane must do.
  • A real management URL for the gateway (the front door or a dedicated door on the apex) and its TLS pin; identity per carrier — kanidm OIDC on the kanidm path (ADR 0038/0039), the idss-idp device-authorization flow on IDIP (internal/idp/deviceapprove.go, ADR 0199).
  • enroll.MeshAdmissionFor becomes a MeshMinter port on the ledger's Approve: the gateway control plane mints a single-use setup key from its own management API at approve time and the grant carries it; the founding gateway still gets none (#907). ADR 0209 §3 (address reported by the device at landing) stands.
  • The gateway itself becomes a peer of its own management plane at first deploy (ADR 0159 ordering), so the wt0-bound service renders stop being declarative-only.
  • Secondary (from #956): ConfirmEnrolled or a sibling for a failed landing, rendered by PendingDevicesSurface.vue.

Why option 1 over gating (option 2): gating only moves the wall one leg — assess and nextcloud-on-device (ADR 0210 mesh route) need the mesh regardless.

## RULED by Ben (2026-08-28): option 1 — build the management plane The community mesh controller ships on the gateway per ADR 0039 (management + signal + relay, a peer on every node); placeholder admission is never shipped. Routing `ready-for-session` → `needs-design`: this is a spec-sized slice, not a session fix. **Scope sketch for the design lane** (from today's evidence, drive `20260828T202109Z`): - Promote `spikes/kanidm-netbird/clan/modules/netbird.nix` (268 lines: management + signal + coturn, OIDC config, WireGuard 51820/udp fleet-wide, peer auto-login by setup key) into the shipped clan config, rendered by both gateway renders (GOTCHAS #12). The spike's own header names the split: daemons + config are declarative; minting a setup key and approving peers are runtime provisioning the control plane must do. - A real management URL for the gateway (the front door or a dedicated door on the apex) and its TLS pin; identity per carrier — kanidm OIDC on the kanidm path (ADR 0038/0039), the idss-idp device-authorization flow on IDIP (`internal/idp/deviceapprove.go`, ADR 0199). - `enroll.MeshAdmissionFor` becomes a `MeshMinter` port on the ledger's Approve: the gateway control plane mints a single-use setup key from its own management API at approve time and the grant carries it; the founding gateway still gets none (#907). ADR 0209 §3 (address reported by the device at landing) stands. - The gateway itself becomes a peer of its own management plane at first deploy (ADR 0159 ordering), so the `wt0`-bound service renders stop being declarative-only. - Secondary (from #956): `ConfirmEnrolled` or a sibling for a *failed* landing, rendered by `PendingDevicesSurface.vue`. Why option 1 over gating (option 2): gating only moves the wall one leg — `assess` and `nextcloud-on-device` (ADR 0210 mesh route) need the mesh regardless.
Owner

Design tier — ADR 0214 drafted (local 7f316018, pushing behind the in-flight IDIP publish)

docs/adr/0214-community-mesh-plane-ships-on-the-gateway.md — six decisions, all two-way doors under ADR 0174:

  1. Both gateway renders ship the mesh plane (management :8011, signal :8012, coturn) promoted from the kanidm-netbird spike's content (not the file), gated on GatewayFacts.Mesh; generators netbird-datastore / netbird-coturn; no netbird dashboard.
  2. Off-box reach through the front door on mesh.<apex> (gRPC path routes); admission Management = https://mesh.<apex>:443, TLSPin dropped to empty.
  3. The control plane is Netbird's only user — one service identity per carrier (kanidm / idss-idp client-credentials); members never log in, devices admit by setup key only. Named verification V1: a client-credentials token creates/owns the Netbird account and mints a key on both carriers (fallback: service user + PAT as a clan var).
  4. MeshMinter port beside Granter; Ledger.Approve mints a single-use, request-TTL, node-<requestID> setup key via the local management API; nil minter = honest ErrNoMeshPlane at Approve; enroll.MeshAdmissionFor deleted; management plane is NOT the address oracle (ADR 0209 stands).
  5. Gateway peers its own plane at first deploy (idss-mesh-self-admit oneshot) and the ADR 0159 meshBound() ordering ships in the same slice for every wt0-binding unit.
  6. Failed landing reports back — ReportLandingFailed sibling to ConfirmEnrolled, LandingError on the view, rendered as pending-device-error (✎ state on p3-device-add-app).

CONTEXT.md gains mesh plane and setup key.

Next (needs Ben): /to-spec is user-invocation-only — run it against ADR 0214 to mint the child spec (no-triage), then /slice-map → /to-tickets. Phase 5 (#854) stays parked until the minter slice lands.

## Design tier — ADR 0214 drafted (local `7f316018`, pushing behind the in-flight IDIP publish) `docs/adr/0214-community-mesh-plane-ships-on-the-gateway.md` — six decisions, all two-way doors under ADR 0174: 1. **Both gateway renders ship the mesh plane** (management `:8011`, signal `:8012`, coturn) promoted from the `kanidm-netbird` spike's *content* (not the file), gated on `GatewayFacts.Mesh`; generators `netbird-datastore` / `netbird-coturn`; no netbird dashboard. 2. **Off-box reach through the front door on `mesh.<apex>`** (gRPC path routes); admission `Management = https://mesh.<apex>:443`, `TLSPin` dropped to empty. 3. **The control plane is Netbird's only user** — one service identity per carrier (kanidm / `idss-idp` client-credentials); members never log in, devices admit by setup key only. Named verification **V1**: a client-credentials token creates/owns the Netbird account and mints a key on both carriers (fallback: service user + PAT as a clan var). 4. **`MeshMinter` port beside `Granter`**; `Ledger.Approve` mints a single-use, request-TTL, `node-<requestID>` setup key via the local management API; nil minter = honest `ErrNoMeshPlane` at Approve; `enroll.MeshAdmissionFor` deleted; management plane is NOT the address oracle (ADR 0209 stands). 5. **Gateway peers its own plane at first deploy** (`idss-mesh-self-admit` oneshot) and the ADR 0159 `meshBound()` ordering ships in the same slice for every `wt0`-binding unit. 6. **Failed landing reports back** — `ReportLandingFailed` sibling to `ConfirmEnrolled`, `LandingError` on the view, rendered as `pending-device-error` (✎ state on `p3-device-add-app`). CONTEXT.md gains **mesh plane** and **setup key**. **Next (needs Ben):** `/to-spec` is user-invocation-only — run it against ADR 0214 to mint the child spec (`no-triage`), then `/slice-map` → `/to-tickets`. Phase 5 (#854) stays parked until the minter slice lands.
Owner

Pipeline run in auto mode on Ben's instruction: spec #960 → slice map 7e705fcb (5 slices in docs/slices/device-add) → tickets #961 plane render + V1 (frontier) · #962 front-door mesh.<apex> (← 961) · #963 MeshMinter at Approve (← 961, 962; closes this rung) · #964 gateway self-peer + ADR 0159 ordering (← 961) · #965 failed-landing report (frontier). All ready-for-agent + priority. This ticket and #854 are now blocked by #963 so the phase-5 executor parks honestly instead of red-driving.

Pipeline run in auto mode on Ben's instruction: spec **#960** → slice map `7e705fcb` (5 slices in `docs/slices/device-add`) → tickets **#961** plane render + V1 (frontier) · **#962** front-door `mesh.<apex>` (← 961) · **#963** MeshMinter at Approve (← 961, 962; closes this rung) · **#964** gateway self-peer + ADR 0159 ordering (← 961) · **#965** failed-landing report (frontier). All `ready-for-agent` + `priority`. This ticket and #854 are now blocked by #963 so the phase-5 executor parks honestly instead of red-driving.
ben closed this issue 2026-08-29 05:18:15 +00:00
Owner

Closing: the rung is built — #961 (plane render, dc4ff8cf), #962 (front door, 7d1b5cad), #963 (MeshMinter at Approve, 353ec1c6; MeshAdmissionFor deleted), #965 (failed-landing report, f24a38a7). Live proof rides the standing phase-5 drive #854 once the seed-leg PAT provisioning residue and #964 land.

Closing: the rung is built — #961 (plane render, `dc4ff8cf`), #962 (front door, `7d1b5cad`), #963 (MeshMinter at Approve, `353ec1c6`; `MeshAdmissionFor` deleted), #965 (failed-landing report, `f24a38a7`). Live proof rides the standing phase-5 drive #854 once the seed-leg PAT provisioning residue and #964 land.
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#956
No description provided.