own-VPS gateway deploy: control-plane preflight-skips the gateway node, and the real reason never reaches the operator #461

Closed
opened 2026-08-12 01:17:50 +00:00 by ben · 3 comments
Owner

Failure

Drive 20260812T010139Z (own-VPS rehearsal, real droplet) reds at the supply leg's waitForLeg poll — the journey bar jumps to data-state="failed" / data-failed="control-plane" mid-poll (app/tests/e2e/fixtures/journey.ts:116; test-results/drive-droplet/20260812T010139Z/artifacts/journey.droplet-.../error-context.md). Signature 404124947736 — this signature already self-healed once before (drive 20260811T183121Z, commit 99393f9d9, an OWN_VPS_ORDER test-fixture fix). This occurrence has a different, deeper root cause — the same generic error text is masking a real deploy-classification gap.

Evidence

Standup.Deploy (logs/founding-state.log:111-113, this run):

"kind": "unknown",
"headline": "The gateway deploy failed.",
"detail": "systemctl is-active did not report the control plane active — the composed config declared no control-plane unit, or the unit failed to start; the finish-leg restart would fault \"Unit ourcloud-control-plane.service not found\""

That detail comes from the UnitActive probe at internal/founding/deploy.go:332-350 (added per #443 specifically to catch a no-op deploy reporting green).

But the deploy's own log, ONE stage earlier, already recorded the real reason and it got discarded (logs/founding-state.log:106):

"stage": "preflight", "message": "excluded: node does not evaluate"

That's internal/clan/adapter.go:241-244 — the gateway's eval-preflight failed, so dep.Run skipped the node (continue) instead of running machines update on it. applyControlPlane (internal/founding/deploy.go:401-406) builds its clan.DeployRequest without setting Strict — it defaults to false, which per its own doc (internal/clan/clan.go:208-210) means "exclude-and-report" rather than fail. That policy makes sense for a multi-node fleet deploy, but applyControlPlane always scopes to exactly one node (Nodes: []clan.NodeID{node}), so "exclude-and-report" on the only requested node is indistinguishable from doing nothing while returning success (dep.Run → (res{Skipped:[gateway]}, nil) → applyControlPlane → (nil, nil)). The classified skip reason that WAS available (clan.NodeSkip.Kind/.Detail, internal/clan/clan.go:232-236, populated from readinessAt) is silently dropped; only the downstream UnitActive probe's generic FailUnknown message reaches the operator.

Separately, the real droplet's own systemd journal (logs/droplet-journal.txt) shows a genuine activation problem in the same window: clan-switch-gateway-bbdfcf38.service and clan-switch-gateway-a0a0b47e.service (both driving switch-to-configuration switch for nixos-system-gateway-26.11.20260612.173d0ad) each fail with status=4/NOPERMISSION (lines 1268-1305), and ourcloud-control-plane.service crash-loops on /srv/ourcloud/bin/control-plane: No such file or directory for ~35s (lines 1140-1219) before finally starting cleanly at line 1411+. It's unclear from static logs alone whether this switch activity is from THIS deploy step (in which case clan machines update apparently exited 0 despite the remote failure — a masked-exit gap in internal/clan/errors.go:233-279's logSaysFailed, whose marker list doesn't recognize "failed (status" / "NOPERMISSION" / "Failed with result 'exit-code'") or from the earlier nixos-anywhere install/activate step (unrelated to this deploy's preflight-skip).

Suspected layer(s)

  • internal/founding/deploy.go (applyControlPlane) — doesn't set Strict: true for its single-node deploy, and discards dep.Run's *DeployResult.Skipped classification entirely (_, runErr = dep.Run(...)).
  • internal/clan/adapter.go / internal/clan/errors.go — the masked-exit detector (logSaysFailed) may not recognize this NixOS switch-to-configuration failure shape; it has a documented history of delicate false-positive/false-negative tuning (#451, #456), so any new marker needs care not to catch the benign ourcloud-control-plane.service boot-time crash-loop visible in the same journal.
  • The droplet's own switch-to-configuration switch / clan-switch-gateway-*.service NOPERMISSION failure may be a genuine, separate activation-permission defect worth investigating directly on a droplet.

What plugging it needs

  1. Get the raw clan machines update invocation output for this deploy step (not just the harvested journalctl) to determine whether the gateway node failed preflight (skip path) or passed preflight and its machines update exited 0 despite the remote switch failing (masked-exit path) — these are mutually exclusive and point at different fixes.
  2. If skip-path: decide whether applyControlPlane should set Strict: true (it only ever targets one node, so "exclude-and-report" degrades to "silently do nothing") and surface NodeSkip.Kind/.Detail through to DeployFailure instead of the generic FailUnknown from the UnitActive probe.
  3. If masked-exit path: extend logSaysFailed to recognize a real switch-to-configuration/clan-switch-* unit failure, scoped narrowly enough not to re-trigger the false positives #451/#456 already fixed, and not to catch the benign ourcloud-control-plane.service restart-loop noise in the same log.
  4. Independently confirm (and likely file separately) why the gateway's config either doesn't evaluate at deploy time, or why switch-to-configuration exits NOPERMISSION on this droplet — that's the actual substantive activation defect underneath whichever classification gap is confirmed.

Not self-fixed: multiple plausible root causes I can't disambiguate from static logs, touches a failure-classifier with a documented regression history, and the underlying activation failure is real droplet infra state outside this checkout.

drive 20260812T010139Z red at supply: journey leg "control-plane" went red: (no fault line rendered)
evidence: test-results/…/20260812T010139Z/ on matou-workstation (legs.json, droplet-journal.txt, trace)

## Failure Drive `20260812T010139Z` (own-VPS rehearsal, real droplet) reds at the `supply` leg's `waitForLeg` poll — the journey bar jumps to `data-state="failed"` / `data-failed="control-plane"` mid-poll (`app/tests/e2e/fixtures/journey.ts:116`; `test-results/drive-droplet/20260812T010139Z/artifacts/journey.droplet-.../error-context.md`). Signature `404124947736` — this signature already self-healed once before (drive `20260811T183121Z`, commit `99393f9d9`, an `OWN_VPS_ORDER` test-fixture fix). This occurrence has a different, deeper root cause — the same generic error text is masking a real deploy-classification gap. ## Evidence `Standup.Deploy` (`logs/founding-state.log:111-113`, this run): ``` "kind": "unknown", "headline": "The gateway deploy failed.", "detail": "systemctl is-active did not report the control plane active — the composed config declared no control-plane unit, or the unit failed to start; the finish-leg restart would fault \"Unit ourcloud-control-plane.service not found\"" ``` That detail comes from the `UnitActive` probe at `internal/founding/deploy.go:332-350` (added per #443 specifically to catch a no-op deploy reporting green). But the deploy's own log, ONE stage earlier, already recorded the real reason and it got discarded (`logs/founding-state.log:106`): ``` "stage": "preflight", "message": "excluded: node does not evaluate" ``` That's `internal/clan/adapter.go:241-244` — the gateway's eval-preflight failed, so `dep.Run` skipped the node (`continue`) instead of running `machines update` on it. `applyControlPlane` (`internal/founding/deploy.go:401-406`) builds its `clan.DeployRequest` without setting `Strict` — it defaults to `false`, which per its own doc (`internal/clan/clan.go:208-210`) means "exclude-and-report" rather than fail. That policy makes sense for a multi-node fleet deploy, but `applyControlPlane` always scopes to exactly one node (`Nodes: []clan.NodeID{node}`), so "exclude-and-report" on the only requested node is indistinguishable from doing nothing while returning success (`dep.Run` → `(res{Skipped:[gateway]}, nil)` → `applyControlPlane` → `(nil, nil)`). The classified skip reason that WAS available (`clan.NodeSkip.Kind`/`.Detail`, `internal/clan/clan.go:232-236`, populated from `readinessAt`) is silently dropped; only the downstream `UnitActive` probe's generic `FailUnknown` message reaches the operator. Separately, the real droplet's own systemd journal (`logs/droplet-journal.txt`) shows a genuine activation problem in the same window: `clan-switch-gateway-bbdfcf38.service` and `clan-switch-gateway-a0a0b47e.service` (both driving `switch-to-configuration switch` for `nixos-system-gateway-26.11.20260612.173d0ad`) each fail with `status=4/NOPERMISSION` (lines 1268-1305), and `ourcloud-control-plane.service` crash-loops on `/srv/ourcloud/bin/control-plane: No such file or directory` for ~35s (lines 1140-1219) before finally starting cleanly at line 1411+. It's unclear from static logs alone whether this switch activity is from THIS deploy step (in which case `clan machines update` apparently exited 0 despite the remote failure — a masked-exit gap in `internal/clan/errors.go:233-279`'s `logSaysFailed`, whose marker list doesn't recognize `"failed (status"` / `"NOPERMISSION"` / `"Failed with result 'exit-code'"`) or from the earlier nixos-anywhere install/activate step (unrelated to this deploy's preflight-skip). ## Suspected layer(s) - `internal/founding/deploy.go` (`applyControlPlane`) — doesn't set `Strict: true` for its single-node deploy, and discards `dep.Run`'s `*DeployResult.Skipped` classification entirely (`_, runErr = dep.Run(...)`). - `internal/clan/adapter.go` / `internal/clan/errors.go` — the masked-exit detector (`logSaysFailed`) may not recognize this NixOS `switch-to-configuration` failure shape; it has a documented history of delicate false-positive/false-negative tuning (#451, #456), so any new marker needs care not to catch the *benign* `ourcloud-control-plane.service` boot-time crash-loop visible in the same journal. - The droplet's own `switch-to-configuration switch` / `clan-switch-gateway-*.service` NOPERMISSION failure may be a genuine, separate activation-permission defect worth investigating directly on a droplet. ## What plugging it needs 1. Get the raw `clan machines update` invocation output for this deploy step (not just the harvested `journalctl`) to determine whether the gateway node failed preflight (skip path) or passed preflight and its `machines update` exited 0 despite the remote switch failing (masked-exit path) — these are mutually exclusive and point at different fixes. 2. If skip-path: decide whether `applyControlPlane` should set `Strict: true` (it only ever targets one node, so "exclude-and-report" degrades to "silently do nothing") and surface `NodeSkip.Kind`/`.Detail` through to `DeployFailure` instead of the generic `FailUnknown` from the `UnitActive` probe. 3. If masked-exit path: extend `logSaysFailed` to recognize a real `switch-to-configuration`/`clan-switch-*` unit failure, scoped narrowly enough not to re-trigger the false positives #451/#456 already fixed, and not to catch the benign `ourcloud-control-plane.service` restart-loop noise in the same log. 4. Independently confirm (and likely file separately) why the gateway's config either doesn't evaluate at deploy time, or why `switch-to-configuration` exits NOPERMISSION on this droplet — that's the actual substantive activation defect underneath whichever classification gap is confirmed. Not self-fixed: multiple plausible root causes I can't disambiguate from static logs, touches a failure-classifier with a documented regression history, and the underlying activation failure is real droplet infra state outside this checkout. drive `20260812T010139Z` red at `supply`: `journey leg "control-plane" went red: (no fault line rendered)` evidence: `test-results/…/20260812T010139Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) <!-- rehearsal-sig: 404124947736 -->
Author
Owner

Disambiguated — it's the preflight-skip path (A), and the skip is a FALSE NEGATIVE

Reproduced readinessAt's exact deploy-time eval (internal/clan/adapter.go:348) against this run's captured flake (test-results/drive-droplet/20260812T010139Z/state/clan-config), no droplet needed:

nix eval --raw .#nixosConfigurations.gateway.config.system.build.toplevel.drvPath
→ /nix/store/73xlqvsfk7ywgy4l31cyz4aa34g9r1k4-nixos-system-gateway-26.11.20260612.173d0ad.drv
EVAL-EXIT=0   (only benign warnings: kanidm rename, network-online.target ordering)

So the gateway config evaluates cleanly. That settles the two branches:

  • Path A (preflight skip), confirmed: founding-state emitted "excluded: node does not evaluate" — the if !r.OK { … continue } branch at adapter.go:241-244. clan machines update never ran on the gateway. The clan-switch-gateway-*.service … status=4/NOPERMISSION in droplet-journal.txt and the ourcloud-control-plane 127-crash-loop are both from the earlier nixos-anywhere install, not this deploy step; the control plane that ends up serving was baked by that install.
  • The skip is spurious: the config is valid (exit 0, real drvPath), so readinessAt's deploy-time nix eval did not hit a real eval error — it failed transiently (cold-store / slow first eval / ctx deadline) and returned non-zero, which readinessAt treats as "does not evaluate." The classified reason (Readiness.Detail, populated from excerpt(res.Output)) was then dropped.

The fix (two parts)

  1. applyControlPlane (internal/founding/deploy.go:401-406) must fail loud on a skip. It always scopes to exactly one node (Nodes: []clan.NodeID{node}), so the default Strict:false "exclude-and-report" degrades to "silently do nothing and return success". Set Strict: true, and surface the skip's NodeSkip.Kind/.Detail (internal/clan/clan.go:232-236) through to the DeployFailure instead of the generic FailUnknown the downstream UnitActive probe produces. A single-node skip must reach the operator as "the gateway was skipped because ", never as a green deploy or the misleading "declared no control-plane unit" text.

  2. Harden readinessAt (internal/clan/adapter.go:348) against a transient eval. A cold/slow/timed-out nix eval on the only node must not be silently classed as "does not evaluate" and skip the entire deploy. Add a bounded retry (or distinguish a transient/timeout/interrupted exit from a genuine FailConfigEval) so a real eval failure still reports, but a transient one is retried rather than swallowed.

Tests

  • applyControlPlane: single-node deploy where dep.Run returns Skipped:[gateway] must yield a loud DeployFailure carrying the skip detail, not (nil,nil).
  • readinessAt: a transient/non-eval exit (timeout/interrupt) is retried / not misclassified as FailConfigEval; a genuine eval error still surfaces with its detail.
  • Note the reporter's point: UnitActive (adapter.go:119-151) has no test seam (raw exec.CommandContext) — either add a command-runner seam or an integration assertion so this class is coverable.

Config validity proven against the captured flake, so this is confidently the fix; the next real drive is the confirmation (and with part 1, if the eval trips again the drive will now self-explain instead of printing the generic message). Ben ruled: fix as-diagnosed, ready-for-agent.

Evidence: test-results/drive-droplet/20260812T010139Z/ on matou-workstation. Advances #378.

## Disambiguated — it's the preflight-skip path (A), and the skip is a FALSE NEGATIVE Reproduced `readinessAt`'s exact deploy-time eval (`internal/clan/adapter.go:348`) against **this run's captured flake** (`test-results/drive-droplet/20260812T010139Z/state/clan-config`), no droplet needed: ``` nix eval --raw .#nixosConfigurations.gateway.config.system.build.toplevel.drvPath → /nix/store/73xlqvsfk7ywgy4l31cyz4aa34g9r1k4-nixos-system-gateway-26.11.20260612.173d0ad.drv EVAL-EXIT=0 (only benign warnings: kanidm rename, network-online.target ordering) ``` So the gateway config **evaluates cleanly**. That settles the two branches: - **Path A (preflight skip), confirmed:** founding-state emitted `"excluded: node does not evaluate"` — the `if !r.OK { … continue }` branch at `adapter.go:241-244`. `clan machines update` never ran on the gateway. The `clan-switch-gateway-*.service … status=4/NOPERMISSION` in `droplet-journal.txt` and the `ourcloud-control-plane` 127-crash-loop are both from the **earlier nixos-anywhere install**, not this deploy step; the control plane that ends up serving was baked by that install. - **The skip is spurious:** the config is valid (exit 0, real drvPath), so `readinessAt`'s deploy-time `nix eval` did not hit a real eval error — it failed **transiently** (cold-store / slow first eval / ctx deadline) and returned non-zero, which `readinessAt` treats as "does not evaluate." The classified reason (`Readiness.Detail`, populated from `excerpt(res.Output)`) was then dropped. ## The fix (two parts) 1. **`applyControlPlane` (`internal/founding/deploy.go:401-406`) must fail loud on a skip.** It always scopes to exactly one node (`Nodes: []clan.NodeID{node}`), so the default `Strict:false` "exclude-and-report" degrades to "silently do nothing and return success". Set **`Strict: true`**, and surface the skip's `NodeSkip.Kind`/`.Detail` (`internal/clan/clan.go:232-236`) through to the `DeployFailure` **instead of** the generic `FailUnknown` the downstream `UnitActive` probe produces. A single-node skip must reach the operator as "the gateway was skipped because <detail>", never as a green deploy or the misleading "declared no control-plane unit" text. 2. **Harden `readinessAt` (`internal/clan/adapter.go:348`) against a transient eval.** A cold/slow/timed-out `nix eval` on the only node must not be silently classed as "does not evaluate" and skip the entire deploy. Add a bounded retry (or distinguish a transient/timeout/interrupted exit from a genuine `FailConfigEval`) so a real eval failure still reports, but a transient one is retried rather than swallowed. ## Tests - `applyControlPlane`: single-node deploy where `dep.Run` returns `Skipped:[gateway]` must yield a **loud** `DeployFailure` carrying the skip detail, not `(nil,nil)`. - `readinessAt`: a transient/non-eval exit (timeout/interrupt) is retried / not misclassified as `FailConfigEval`; a genuine eval error still surfaces with its detail. - Note the reporter's point: `UnitActive` (`adapter.go:119-151`) has no test seam (raw `exec.CommandContext`) — either add a command-runner seam or an integration assertion so this class is coverable. Config validity proven against the captured flake, so this is confidently the fix; the next real drive is the confirmation (and with part 1, if the eval trips again the drive will now self-explain instead of printing the generic message). Ben ruled: fix as-diagnosed, `ready-for-agent`. Evidence: `test-results/drive-droplet/20260812T010139Z/` on matou-workstation. Advances #378. <!-- rehearsal-sig: 404124947736 -->
Author
Owner

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

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

close-report for #461 — status success

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

envelope
{
  "issue": 461,
  "status": "success",
  "commits": [
    "72f8fb8"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/clan/adapter.go",
    "internal/clan/readiness_retry_test.go",
    "internal/founding/deploy.go",
    "internal/founding/deploy_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/... ./internal/founding/... -count=1",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/clan/ ./internal/founding/",
      "exit_code": 0
    },
    {
      "command": "go build ./...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Single-node preflight skip must red loudly with the classified reason, not report green": "applyControlPlane sets Strict:true (internal/founding/deploy.go); TestDeploy_SingleNodePreflightSkipRedsLoudWithReason (deploy_test.go) — DeployFailed carrying 'does not evaluate', green without the fix",
    "Generic UnitActive masking text must not overwrite the real skip reason": "same test asserts ds.Failure.Detail does NOT contain 'declared no control-plane unit'; nodeFailure surfaces NodeSkip.Kind/.Detail via the Strict *DeployError",
    "A transient non-zero eval is retried, not misclassified as a skip": "evalReadiness bounded retry (internal/clan/adapter.go); TestReadiness_RetriesTransientEval — 3 attempts to a passing verdict",
    "A genuine eval error still surfaces classified with its detail, bounded": "TestReadiness_RealEvalFailureStillSurfacesBounded — config_eval + non-empty detail, exactly evalReadinessAttempts calls",
    "A cancelled/expired context stops the retries at once": "TestReadiness_CancelledContextStopsRetry — one attempt, not a retry spin"
  },
  "summary": "Single-node gateway deploy now runs Strict so a preflight skip reds loudly with its classified reason, and readinessAt retries a transient nix eval instead of silently skipping the only node.",
  "blockers": []
}
**close-report** for #461 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 461, "status": "success", "commits": [ "72f8fb8" ], "changed_files": [ "STATUS.md", "internal/clan/adapter.go", "internal/clan/readiness_retry_test.go", "internal/founding/deploy.go", "internal/founding/deploy_test.go" ], "tests": [ { "command": "go test ./internal/clan/... ./internal/founding/... -count=1", "exit_code": 0 }, { "command": "go vet ./internal/clan/ ./internal/founding/", "exit_code": 0 }, { "command": "go build ./...", "exit_code": 0 } ], "criteria": { "Single-node preflight skip must red loudly with the classified reason, not report green": "applyControlPlane sets Strict:true (internal/founding/deploy.go); TestDeploy_SingleNodePreflightSkipRedsLoudWithReason (deploy_test.go) — DeployFailed carrying 'does not evaluate', green without the fix", "Generic UnitActive masking text must not overwrite the real skip reason": "same test asserts ds.Failure.Detail does NOT contain 'declared no control-plane unit'; nodeFailure surfaces NodeSkip.Kind/.Detail via the Strict *DeployError", "A transient non-zero eval is retried, not misclassified as a skip": "evalReadiness bounded retry (internal/clan/adapter.go); TestReadiness_RetriesTransientEval — 3 attempts to a passing verdict", "A genuine eval error still surfaces classified with its detail, bounded": "TestReadiness_RealEvalFailureStillSurfacesBounded — config_eval + non-empty detail, exactly evalReadinessAttempts calls", "A cancelled/expired context stops the retries at once": "TestReadiness_CancelledContextStopsRetry — one attempt, not a retry spin" }, "summary": "Single-node gateway deploy now runs Strict so a preflight skip reds loudly with its classified reason, and readinessAt retries a transient nix eval instead of silently skipping the only node.", "blockers": [] } ``` </details>
ben closed this issue 2026-08-12 02:38:58 +00:00
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.

Reference
Matou/idss#461
No description provided.