standing gateway: a render-affecting internal/clan change never lands durably on an already-standing community (re-supply does not re-render the gateway closure; rented scope is un-baselined) #1275

Closed
opened 2026-09-06 10:59:43 +00:00 by matou-build-agent · 3 comments

Split off from #1222 (which fixed the specific rehearsal-e residue).

The gap: a render-affecting change under internal/clan/ that changes the gateway's own NixOS closure (e.g. #1214's netbird management/relay env) never lands durably on an already-standing community, because:

  1. The standing-staleness gate can't see it. oc_standing_staleness (scripts/lib/rehearsal-standing-lib.sh) counts "rendered-config drift" only over OC_STANDING_CONFIG_PATHS = drvpath-baseline.txt nix/ flake.nix flake.lock. A netbird.go edit is an agent path, so it scores as binary-only → verdict re-supply. And the rented gateway scope can't be drvpath-baselined at all (it mints fresh random secrets every eval), so the baseline can never catch it either.
  2. Re-supply never re-renders the gateway closure. oc_standing_resupply lands binaries (agent, control-plane, dashboard) + restarts units — it does not re-run the netbird/gateway render. Only founding's "bake takeover-ready config" writes gateway-guest.nix, and no routine op re-bakes it.
  3. The gateway image bakes a stale render. The takeover-ready gateway-guest.nix comes from the gateway image (last built ~2026-08-31, pre-#1214), so every fresh founding also starts with the old netbird render (repaired live by the /run drop-in) until the image is rebuilt.

Consequence: GOTCHAS #92 (derivable != deployed) recurs for the next gateway-closure change. On rehearsal-e it was masked because the box hadn't rebooted; the live repair rides tmpfs /run.

Candidate fixes (a ruling, needs triage):

  • (A) Teach the staleness gate that a gateway-closure render change forces a re-found even for the rented scope — hard, since netbird.go can't be told apart from non-render internal/clan edits by path alone; would need the render code under its own path or an explicit render-fingerprint that the rented scope can commit.
  • (B) Give re-supply a "re-render + switch the gateway's own closure in place" step (the manual switch #1222 did by hand, productised) so binary-only drift that happens to include a closure render still lands.
  • (C) Rebuild the gateway image on the current render so fresh foundings bake the fix, and lean on "the next re-found" for standing communities.

Found as a #1222 follow-up; not blocking (the live repair holds until a reboot, and #1222 baked rehearsal-e durably).

Split off from #1222 (which fixed the specific rehearsal-e residue). **The gap:** a render-affecting change under `internal/clan/` that changes the gateway's *own* NixOS closure (e.g. #1214's netbird management/relay env) never lands durably on an **already-standing** community, because: 1. **The standing-staleness gate can't see it.** `oc_standing_staleness` (`scripts/lib/rehearsal-standing-lib.sh`) counts "rendered-config drift" only over `OC_STANDING_CONFIG_PATHS` = `drvpath-baseline.txt nix/ flake.nix flake.lock`. A netbird.go edit is an *agent* path, so it scores as binary-only → verdict **re-supply**. And the rented gateway scope can't be drvpath-baselined at all (it mints fresh random secrets every eval), so the baseline can never catch it either. 2. **Re-supply never re-renders the gateway closure.** `oc_standing_resupply` lands binaries (agent, control-plane, dashboard) + restarts units — it does not re-run the netbird/gateway render. Only founding's "bake takeover-ready config" writes `gateway-guest.nix`, and no routine op re-bakes it. 3. **The gateway image bakes a stale render.** The takeover-ready `gateway-guest.nix` comes from the gateway image (last built ~2026-08-31, pre-#1214), so every *fresh* founding also starts with the old netbird render (repaired live by the /run drop-in) until the image is rebuilt. **Consequence:** GOTCHAS #92 (derivable != deployed) recurs for the next gateway-closure change. On rehearsal-e it was masked because the box hadn't rebooted; the live repair rides tmpfs `/run`. **Candidate fixes (a ruling, needs triage):** - (A) Teach the staleness gate that a gateway-closure render change forces a re-found even for the rented scope — hard, since netbird.go can't be told apart from non-render `internal/clan` edits by path alone; would need the render code under its own path or an explicit render-fingerprint that the rented scope *can* commit. - (B) Give re-supply a "re-render + switch the gateway's own closure in place" step (the manual switch #1222 did by hand, productised) so binary-only drift that happens to include a closure render still lands. - (C) Rebuild the gateway image on the current render so fresh foundings bake the fix, and lean on "the next re-found" for standing communities. Found as a #1222 follow-up; not blocking (the live repair holds until a reboot, and #1222 baked rehearsal-e durably).
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime

Category: bug (a durability hole in the standing-community mechanism: a render-affecting gateway-closure change silently regresses on the next reboot — GOTCHAS #92 recurs). State: ready-for-agent.

The ruling: take (B), reject (A), and leave (C) to its own rail

The issue asks for a ruling among three candidate fixes. The choice is a two-way door: it's a revertible commit, provable by an existing standing-drive reboot probe (the exact probe #1222 used — systemctl cat netbird-management must show the geolocation env in the unit file, not a /run drop-in), and it is not on the one-way-door list (no personal credentials, no security-posture widening — landing an already-merged render durably is not a new posture decision — no member-facing trust accept, no data destruction, no non-routine spend). So it's ruled here rather than parked on the human.

(B) — give oc_standing_resupply a re-render + in-place switch step. This is the durable fix and it fits the machinery already in place:

  • A render-affecting internal/clan/ change (e.g. netbird.go) is an agent path, so oc_standing_staleness already scores it agent-only → verdict resupply (scripts/lib/rehearsal-standing-lib.sh:150-154). The routing is already correct; the hole is purely in the remediation.
  • oc_standing_resupply today lands only binaries over SSH (:266-290) and never touches the gateway's own NixOS closure. Adding a "re-render the gateway's own closure + switch it in place" step productises exactly what #1222 did by hand and lands the change durably.
  • It keeps the community (re-supply's whole point — no 17–27 min re-found, no fresh rental) and it works for the un-baselineable rented scope: re-supply just always re-renders, so the fact that the rented gateway mints fresh secrets every eval (and can never be drvpath-baselined) stops mattering.

(A) — teach the gate to force a re-found — rejected. The issue itself flags it as infeasible: netbird.go can't be told apart from non-render internal/clan edits by path alone, and the rented scope can't be drvpath-baselined at all. It also forces the heavy hammer (tear-down + fresh rental) for drift re-supply was built to absorb. B makes it unnecessary.

(C) — rebuild the gateway image — complementary, not this ticket. C only helps fresh foundings (bake the current render), which is not the case this issue is about (an already-standing community). Fresh-founding staleness of the baked render is the #661 auto-rebuild / snapshot rail's job and rides snapshot-pending, not this fix. Worth a one-line follow-up if the current image is confirmed pre-#1214, but it does not block or belong to B.

Why it's provably reversible: if B misbehaves, git revert the lib change; the standing drive re-founds on a red re-supply exactly as it does today (the existing return 1 → fall back to the re-found guards, :299-301, are untouched in spirit). Ben's veto is async.


Agent brief — productise re-render + in-place gateway-closure switch into re-supply

Goal. After oc_standing_resupply lands the current binaries, re-render the standing gateway's own NixOS closure and switch it in place, so a render-affecting internal/clan/ change (the netbird.go class) lands durably on an already-standing community instead of riding a reboot-fragile /run drop-in.

Where it lives.

  • scripts/lib/rehearsal-standing-lib.sh — oc_standing_resupply (:228-308) is the insertion point. The new step goes after the binary landings and before the control-plane health-gate (:292-301), so a failed switch falls back to the re-found exactly like a failed binary landing (reuse the step/return 1 pattern at :258-264).
  • The render entry point is the founding configure stage's "bake takeover-ready config" mutate — internal/clan/enrollment.go:503-568 (enrollment.go:522), which writes the gateway closure (netbird module included). The task is to invoke that render for the standing host's captured facts and apply it (nixos-rebuild switch, or the switch mechanism the founding path already uses) on the live gateway over the existing rent-operator SSH identity (:250-251).
  • Model the manual recipe from #1222 ("any operation that re-runs the netbird module render lands both settings durably").

Acceptance (the existing probe). On a standing-community drive whose base carries a gateway-closure render change ahead of the founding SHA: after the drive's re-supply, systemctl cat netbird-management on the gateway shows NB_DISABLE_GEOLOCATION in the unit file (not a /run drop-in) and the relay carries its metrics port natively; the setting survives a gateway reboot. Remove any stale /run drop-ins as part of the switch.

Guardrails.

  • Keep the "a re-supply that leaves the gateway down is a FAILED re-supply" contract (:298-301): if the switch fails or the control plane doesn't come back active within OC_STANDING_RESUPPLY_WAIT, return 1 and let the caller re-found — never advance founding_sha on a half-applied switch.
  • The lib is self-testing offline; add/extend an offline unit for the new step's decision logic where practical.
  • Update the oc_standing_resupply header comment and the relevant ADR 0208 note: re-supply now also re-renders the gateway's own closure, so ruling 3a's "binary swap in place" is no longer the whole story.
  • This fix is in scripts/lib/** — not a deploy-pending/snapshot-pending tree. (The complementary C image rebuild would be snapshot-pending; that's out of scope here.)
  • Per CLAUDE.md, update STATUS.md and, if the render-durability hazard is newly closed, docs/GOTCHAS.md (the #92 "derivable != deployed" entry) in the same commit.

Not blocking (the #1222 live repair holds rehearsal-e until its next reboot), but this closes the recurrence for the next gateway-closure change.

> *This was generated by AI during triage.* ## Ruled by agent under ADR 0174 — veto anytime **Category:** `bug` (a durability hole in the standing-community mechanism: a render-affecting gateway-closure change silently regresses on the next reboot — GOTCHAS #92 recurs). **State:** `ready-for-agent`. ### The ruling: take **(B)**, reject **(A)**, and leave **(C)** to its own rail The issue asks for a ruling among three candidate fixes. The choice is a **two-way door**: it's a revertible commit, provable by an existing standing-drive reboot probe (the exact probe #1222 used — `systemctl cat netbird-management` must show the geolocation env in the **unit file**, not a `/run` drop-in), and it is not on the one-way-door list (no personal credentials, no security-posture *widening* — landing an already-merged render durably is not a new posture decision — no member-facing trust accept, no data destruction, no non-routine spend). So it's ruled here rather than parked on the human. **(B) — give `oc_standing_resupply` a re-render + in-place switch step.** This is the durable fix and it fits the machinery already in place: - A render-affecting `internal/clan/` change (e.g. `netbird.go`) is an *agent* path, so `oc_standing_staleness` already scores it agent-only → verdict **resupply** (`scripts/lib/rehearsal-standing-lib.sh:150-154`). The routing is already correct; the hole is purely in the *remediation*. - `oc_standing_resupply` today lands only binaries over SSH (`:266-290`) and never touches the gateway's own NixOS closure. Adding a "re-render the gateway's own closure + switch it in place" step **productises exactly what #1222 did by hand** and lands the change durably. - It keeps the community (re-supply's whole point — no 17–27 min re-found, no fresh rental) and it **works for the un-baselineable rented scope**: re-supply just always re-renders, so the fact that the rented gateway mints fresh secrets every eval (and can never be drvpath-baselined) stops mattering. **(A) — teach the gate to force a re-found — rejected.** The issue itself flags it as infeasible: `netbird.go` can't be told apart from non-render `internal/clan` edits by path alone, and the rented scope can't be drvpath-baselined at all. It also forces the heavy hammer (tear-down + fresh rental) for drift re-supply was built to absorb. B makes it unnecessary. **(C) — rebuild the gateway image — complementary, not this ticket.** C only helps *fresh* foundings (bake the current render), which is **not** the case this issue is about (an *already-standing* community). Fresh-founding staleness of the baked render is the **#661 auto-rebuild / snapshot rail's** job and rides `snapshot-pending`, not this fix. Worth a one-line follow-up if the current image is confirmed pre-#1214, but it does not block or belong to B. **Why it's provably reversible:** if B misbehaves, `git revert` the lib change; the standing drive re-founds on a red re-supply exactly as it does today (the existing `return 1 → fall back to the re-found` guards, `:299-301`, are untouched in spirit). Ben's veto is async. --- ## Agent brief — productise re-render + in-place gateway-closure switch into re-supply **Goal.** After `oc_standing_resupply` lands the current binaries, re-render the standing gateway's **own** NixOS closure and switch it in place, so a render-affecting `internal/clan/` change (the `netbird.go` class) lands durably on an already-standing community instead of riding a reboot-fragile `/run` drop-in. **Where it lives.** - `scripts/lib/rehearsal-standing-lib.sh` — `oc_standing_resupply` (`:228-308`) is the insertion point. The new step goes **after** the binary landings and **before** the control-plane health-gate (`:292-301`), so a failed switch falls back to the re-found exactly like a failed binary landing (reuse the `step`/`return 1` pattern at `:258-264`). - The render entry point is the founding configure stage's "bake takeover-ready config" mutate — `internal/clan/enrollment.go:503-568` (`enrollment.go:522`), which writes the gateway closure (netbird module included). The task is to invoke that render for the standing host's captured facts and apply it (`nixos-rebuild switch`, or the switch mechanism the founding path already uses) on the live gateway over the existing rent-operator SSH identity (`:250-251`). - Model the manual recipe from **#1222** ("any operation that re-runs the netbird module render lands both settings durably"). **Acceptance (the existing probe).** On a standing-community drive whose base carries a gateway-closure render change ahead of the founding SHA: after the drive's re-supply, `systemctl cat netbird-management` on the gateway shows `NB_DISABLE_GEOLOCATION` in the **unit file** (not a `/run` drop-in) and the relay carries its metrics port natively; the setting **survives a gateway reboot**. Remove any stale `/run` drop-ins as part of the switch. **Guardrails.** - Keep the "a re-supply that leaves the gateway down is a FAILED re-supply" contract (`:298-301`): if the switch fails or the control plane doesn't come back active within `OC_STANDING_RESUPPLY_WAIT`, `return 1` and let the caller re-found — never advance `founding_sha` on a half-applied switch. - The lib is self-testing offline; add/extend an offline unit for the new step's decision logic where practical. - Update the `oc_standing_resupply` header comment and the relevant ADR 0208 note: re-supply now also re-renders the gateway's own closure, so ruling 3a's "binary swap in place" is no longer the whole story. - **This fix is in `scripts/lib/**` — not a `deploy-pending`/`snapshot-pending` tree.** (The complementary C image rebuild would be `snapshot-pending`; that's out of scope here.) - Per CLAUDE.md, update `STATUS.md` and, if the render-durability hazard is newly closed, `docs/GOTCHAS.md` (the #92 "derivable != deployed" entry) in the same commit. Not blocking (the #1222 live repair holds rehearsal-e until its next reboot), but this closes the recurrence for the next gateway-closure change.
Author
Member

swarm-claim host=matou-dev-server-01 run=18924
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=18924 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1275 — status success

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

envelope
{
  "issue": 1275,
  "status": "success",
  "commits": [
    "27f5ac80"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/main.go",
    "control-plane/cmd/control-plane/rerender_gateway.go",
    "docs/GOTCHAS.md",
    "docs/adr/0208-standing-rehearsal-community-staleness-gated-refound.md",
    "internal/clan/gateway_attach.go",
    "internal/clan/gateway_attach_test.go",
    "scripts/lib/rehearsal-standing-lib.sh",
    "scripts/tests/rehearsal-standing-test.sh"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go build ./...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go vet ./control-plane/... ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go test ./control-plane/cmd/control-plane/ ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command golangci-lint run ./control-plane/cmd/control-plane/ ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/rehearsal-standing-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Fix B ruled: re-supply gains a re-render + in-place switch of the gateway's own closure": "scripts/lib/rehearsal-standing-lib.sh — oc_standing_resupply now, after the binary landings and before the health gate, invokes the staged control-plane binary as `rerender-gateway <slug>`, runs `clan machines update <slug> --build-host localhost --target-host localhost`, and strips the stale /run drop-ins (commit 27f5ac80)",
    "The re-render regenerates the gateway surface from captured facts with the current render code": "internal/clan/gateway_attach.go Adapter.RerenderGatewaySurface re-renders control-plane.nix/gateway-guest.nix WHOLE from the persisted gateway-render.json sidecar; control-plane/cmd/control-plane/rerender_gateway.go exposes it as the on-box one-shot; proven by TestRerenderGatewaySurface_LandsCurrentRenderCode (a stale pre-#1214 render is refreshed to text carrying NB_DISABLE_GEOLOCATION, byte-identical to the current renderGatewayGuest of the sidecar facts)",
    "Guardrail: a failed switch is a FAILED re-supply that falls back to the re-found, founding SHA untouched": "scripts/tests/rehearsal-standing-test.sh — the re-render-fails and switch-fails cases assert oc_standing_resupply returns non-zero, the switch never runs on a failed re-render, and the founding SHA stays at c_docs (never advanced)",
    "Acceptance probe (offline half): the re-render/switch/strip run in the right order and the drop-ins are stripped": "scripts/tests/rehearsal-standing-test.sh — asserts the rerender-gateway one-shot (pointed at IDSS_CONFIG_REPO=/srv/idss/config), the clan machines update switch, and the netbird *.service.d drop-in strip appear in order after the last binary landing and before the health probe. The live reboot probe (systemctl cat shows the env in the unit file, survives reboot) is the deferred standing-drive's",
    "Docs updated in the same commit": "docs/GOTCHAS.md #179 (render-durability hazard + rule), docs/adr/0208 ruling 3a amended 2026-09-06, STATUS.md header — all in commit 27f5ac80"
  },
  "summary": "Re-supply now re-renders + switches the gateway's own NixOS closure in place (via a control-plane rerender-gateway one-shot + clan machines update), so a render-affecting internal/clan change lands durably on an already-standing community instead of riding a reboot-fragile /run drop-in.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1275 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1275, "status": "success", "commits": [ "27f5ac80" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/main.go", "control-plane/cmd/control-plane/rerender_gateway.go", "docs/GOTCHAS.md", "docs/adr/0208-standing-rehearsal-community-staleness-gated-refound.md", "internal/clan/gateway_attach.go", "internal/clan/gateway_attach_test.go", "scripts/lib/rehearsal-standing-lib.sh", "scripts/tests/rehearsal-standing-test.sh" ], "tests": [ { "command": "nix develop .#go-ci --command go build ./...", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go vet ./control-plane/... ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go test ./control-plane/cmd/control-plane/ ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci --command golangci-lint run ./control-plane/cmd/control-plane/ ./internal/clan/", "exit_code": 0 }, { "command": "bash scripts/tests/rehearsal-standing-test.sh", "exit_code": 0 } ], "criteria": { "Fix B ruled: re-supply gains a re-render + in-place switch of the gateway's own closure": "scripts/lib/rehearsal-standing-lib.sh — oc_standing_resupply now, after the binary landings and before the health gate, invokes the staged control-plane binary as `rerender-gateway <slug>`, runs `clan machines update <slug> --build-host localhost --target-host localhost`, and strips the stale /run drop-ins (commit 27f5ac80)", "The re-render regenerates the gateway surface from captured facts with the current render code": "internal/clan/gateway_attach.go Adapter.RerenderGatewaySurface re-renders control-plane.nix/gateway-guest.nix WHOLE from the persisted gateway-render.json sidecar; control-plane/cmd/control-plane/rerender_gateway.go exposes it as the on-box one-shot; proven by TestRerenderGatewaySurface_LandsCurrentRenderCode (a stale pre-#1214 render is refreshed to text carrying NB_DISABLE_GEOLOCATION, byte-identical to the current renderGatewayGuest of the sidecar facts)", "Guardrail: a failed switch is a FAILED re-supply that falls back to the re-found, founding SHA untouched": "scripts/tests/rehearsal-standing-test.sh — the re-render-fails and switch-fails cases assert oc_standing_resupply returns non-zero, the switch never runs on a failed re-render, and the founding SHA stays at c_docs (never advanced)", "Acceptance probe (offline half): the re-render/switch/strip run in the right order and the drop-ins are stripped": "scripts/tests/rehearsal-standing-test.sh — asserts the rerender-gateway one-shot (pointed at IDSS_CONFIG_REPO=/srv/idss/config), the clan machines update switch, and the netbird *.service.d drop-in strip appear in order after the last binary landing and before the health probe. The live reboot probe (systemctl cat shows the env in the unit file, survives reboot) is the deferred standing-drive's", "Docs updated in the same commit": "docs/GOTCHAS.md #179 (render-durability hazard + rule), docs/adr/0208 ruling 3a amended 2026-09-06, STATUS.md header — all in commit 27f5ac80" }, "summary": "Re-supply now re-renders + switches the gateway's own NixOS closure in place (via a control-plane rerender-gateway one-shot + clan machines update), so a render-affecting internal/clan change lands durably on an already-standing community instead of riding a reboot-fragile /run drop-in.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1275
No description provided.