enroll-activate: acme-dns-register never reaches acme-dns's loopback API, drive times out #431

Closed
opened 2026-08-11 06:53:23 +00:00 by ben · 1 comment
Owner

Failure

The enroll-activate leg of the own-vps stand-up (droplet 170.64.234.72) went red. logs/founding-state.log records the fault at the enroll-activate stage:

"clan: masked_exit on gateway: clan reported success but the log shows a real failure: ... [gateway] Aug 11 06:29:19 gateway acme-dns-register-start[1444]: curl: (7) Failed to connect to 127.0.0.1 port 8081 after 0 ms: Could not connect to server" — repeated at 06:29:20, :21, :22

This is the acme-dns-register systemd unit (machines/gateway/acme-dns.nix) polling acme-dns's own loopback API (http://127.0.0.1:8081/register) to get the account Caddy needs for its DNS-01 challenge. The unit already retries up to 30x/1s specifically because, per the module's own comment, "The local API can lag acme-dns's own startup by a moment" — but on this fresh nixos-anywhere install + first reboot, that budget wasn't enough (or acme-dns.service never came up at all), and the register script's failure got surfaced by clan as a masked_exit ("reported success but the log shows a real failure").

Two things blocked deeper diagnosis

  1. artifacts/legs.json and artifacts/journey.json are empty ([] and {"rows": null, "fault": null}) — no per-leg telemetry was captured for this run; only founding-state.log's stage events fill that gap here.

  2. Post-mortem droplet evidence gathering failed. logs/droplet-journal.txt contains only:

    "Host key for 170.64.234.72 has changed and you have requested strict checking." ... "note: droplet evidence gather failed (droplet unreachable?) — the run dir keeps the app-side story"

    nixos-anywhere regenerates the droplet's SSH host key on every reinstall (founding-state.log confirms the live connection "learned its SSH host key" fresh at connect time), but the harness's post-mortem SSH step still has the previous rehearsal's key cached in known_hosts and refuses to connect under strict checking. So gateway's own journal (was acme-dns.service actually up? crashed? slow to bind port 8081?) is unavailable — all we have is the 4 truncated curl-failure lines that made it into the UI's live log tail.

The harness never saw a "failed" journey state either

The Playwright error is a timeout, not a detected failure:

JourneyFailure: journey leg "enroll-activate" went red: budget of 1200s elapsed at "absent"

readJourney() returns {state: 'absent'} when document.querySelector('[data-status="standup-progress"]') finds nothing. The full 1200s budget elapsed with that selector never matching — even though the founding wizard was on screen showing the real fault the whole time (error-context.md's page snapshot: "Activate the gateway system", the masked_exit/acme-dns detail text, a "Retry the connection" button). The fault was correctly surfaced to a human, but waitForLeg's polling contract (data-status="standup-progress", data-state="failed", fault frame data-status="journey-fault" per DDR 0131) never matched the founding-fault screen's markup, so the drive burned the full 20-minute budget instead of failing fast on the real reason.

Not the known frontier

This isn't the known own-VPS pairing-never-flips frontier: legs.json carries no skip entries at all (it's empty), and the run demonstrably got past connect/point/seed/enroll-configure — kexec, disko, install, and reboot all completed per founding-state.log — before redlining at enroll-activate. This is a new, real failure, not the known carrier gap.

Suspected layer(s) and what plugging needs

  • Product (primary): machines/gateway/acme-dns.nix — acme-dns-register.service's after/requires on acme-dns.service guarantees systemd-active, not "listening on 127.0.0.1:8081". On this box the register script's 30x1s poll wasn't enough (or acme-dns never came up at all). Needs a real readiness gate (longer/backoff wait-for-port, or socket-activate acme-dns) and, to distinguish crash vs. slow-start, the gateway's own journal — currently unreachable, see below.
  • Harness (secondary, blocks future diagnosis): the post-mortem evidence-gather step uses strict host-key checking against a known_hosts that isn't refreshed after nixos-anywhere regenerates the droplet's host key. It should learn/accept-new the key the same way the live founding SSH connection does, or evict the stale entry before gathering.
  • Harness/product contract (secondary): the founding-fault screen for enroll-activate doesn't satisfy the waitForLeg contract (data-status="standup-progress" / data-state="failed"), so a correctly-surfaced fault times out generically instead of failing fast. Worth checking whether founding-stage faults are meant to flow through the journey-bar contract at all, or need their own wait helper.

drive 20260811T062137Z red at wizard: drive red at wizard — the wizard died before any leg ran
evidence: test-results/…/20260811T062137Z/ on matou-workstation (legs.json, droplet-journal.txt, trace)

## Failure The `enroll-activate` leg of the own-vps stand-up (droplet 170.64.234.72) went red. `logs/founding-state.log` records the fault at the `enroll-activate` stage: > "clan: masked_exit on gateway: clan reported success but the log shows a real failure: ... [gateway] Aug 11 06:29:19 gateway acme-dns-register-start[1444]: curl: (7) Failed to connect to 127.0.0.1 port 8081 after 0 ms: Could not connect to server" — repeated at 06:29:20, :21, :22 This is the `acme-dns-register` systemd unit (`machines/gateway/acme-dns.nix`) polling acme-dns's own loopback API (`http://127.0.0.1:8081/register`) to get the account Caddy needs for its DNS-01 challenge. The unit already retries up to 30x/1s specifically because, per the module's own comment, "The local API can lag acme-dns's own startup by a moment" — but on this fresh nixos-anywhere install + first reboot, that budget wasn't enough (or acme-dns.service never came up at all), and the register script's failure got surfaced by clan as a masked_exit ("reported success but the log shows a real failure"). ## Two things blocked deeper diagnosis 1. **`artifacts/legs.json` and `artifacts/journey.json` are empty** (`[]` and `{"rows": null, "fault": null}`) — no per-leg telemetry was captured for this run; only `founding-state.log`'s stage events fill that gap here. 2. **Post-mortem droplet evidence gathering failed.** `logs/droplet-journal.txt` contains only: > "Host key for 170.64.234.72 has changed and you have requested strict checking." ... "note: droplet evidence gather failed (droplet unreachable?) — the run dir keeps the app-side story" nixos-anywhere regenerates the droplet's SSH host key on every reinstall (founding-state.log confirms the live connection "learned its SSH host key" fresh at connect time), but the harness's post-mortem SSH step still has the *previous* rehearsal's key cached in `known_hosts` and refuses to connect under strict checking. So gateway's own journal (was `acme-dns.service` actually up? crashed? slow to bind port 8081?) is unavailable — all we have is the 4 truncated curl-failure lines that made it into the UI's live log tail. ## The harness never saw a "failed" journey state either The Playwright error is a **timeout**, not a detected failure: > `JourneyFailure: journey leg "enroll-activate" went red: budget of 1200s elapsed at "absent"` `readJourney()` returns `{state: 'absent'}` when `document.querySelector('[data-status="standup-progress"]')` finds nothing. The full 1200s budget elapsed with that selector never matching — even though the founding wizard **was** on screen showing the real fault the whole time (`error-context.md`'s page snapshot: "Activate the gateway system", the masked_exit/acme-dns detail text, a "Retry the connection" button). The fault was correctly surfaced to a human, but `waitForLeg`'s polling contract (`data-status="standup-progress"`, `data-state="failed"`, fault frame `data-status="journey-fault"` per DDR 0131) never matched the founding-fault screen's markup, so the drive burned the full 20-minute budget instead of failing fast on the real reason. ## Not the known frontier This isn't the known own-VPS pairing-never-flips frontier: `legs.json` carries no skip entries at all (it's empty), and the run demonstrably got past connect/point/seed/enroll-configure — kexec, disko, install, and reboot all completed per `founding-state.log` — before redlining at `enroll-activate`. This is a new, real failure, not the known carrier gap. ## Suspected layer(s) and what plugging needs - **Product (primary):** `machines/gateway/acme-dns.nix` — `acme-dns-register.service`'s `after`/`requires` on `acme-dns.service` guarantees systemd-active, not "listening on 127.0.0.1:8081". On this box the register script's 30x1s poll wasn't enough (or acme-dns never came up at all). Needs a real readiness gate (longer/backoff wait-for-port, or socket-activate acme-dns) and, to distinguish crash vs. slow-start, the gateway's own journal — currently unreachable, see below. - **Harness (secondary, blocks future diagnosis):** the post-mortem evidence-gather step uses strict host-key checking against a `known_hosts` that isn't refreshed after nixos-anywhere regenerates the droplet's host key. It should learn/accept-new the key the same way the live founding SSH connection does, or evict the stale entry before gathering. - **Harness/product contract (secondary):** the founding-fault screen for `enroll-activate` doesn't satisfy the `waitForLeg` contract (`data-status="standup-progress"` / `data-state="failed"`), so a correctly-surfaced fault times out generically instead of failing fast. Worth checking whether founding-stage faults are meant to flow through the journey-bar contract at all, or need their own wait helper. drive `20260811T062137Z` red at `wizard`: `drive red at wizard — the wizard died before any leg ran` evidence: `test-results/…/20260811T062137Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) <!-- rehearsal-sig: dcf630511b50 -->
Author
Owner

Landed as 12ddea4 on origin/main (product-layer / primary fix).

Root cause plugged: acme-dns-register was after/requires acme-dns.service, which only guarantees the daemon FORKED — not that it bound its loopback register/update API on 127.0.0.1:8081 ("the port lies", GOTCHAS #2). The old 30x1s register poll was budgeted for a warm restart's momentary lag, not a fresh nixos-anywhere install's first reboot where the API binds seconds later, so the very first curl hit connection-refused and the budget ran out — surfaced by clan as a masked_exit.

Fix (internal/clan/acmedns.go, RenderAcmeDNS): before any register, the oneshot now polls acme-dns's non-mutating /health for up to 300x1s (still well inside the enroll-activate leg budget), and on timeout NAMES the unreachable capability (local API … never came up (acme-dns.service listening on loopback?)) so a crashed/never-listening acme-dns is distinguishable from a real registration failure. The mutating register POST runs only once the API answers.

  • Seam test: TestRenderAcmeDNS_WaitsForTheLocalAPIBeforeRegistering (internal/clan/acmedns_test.go); full internal/clan suite green; repo pre-push gate green.
  • Hazard recorded: docs/GOTCHAS.md #15. STATUS.md header + milestone log updated.

Deferred to their own issues — the two harness-side halves called out in this report (out of this product slice's scope):

  1. Post-mortem evidence-gather fails strict host-key checking because known_hosts isn't refreshed after nixos-anywhere regenerates the droplet host key — so the gateway journal (crash vs. slow-start) stays unreachable.
  2. A founding-stage fault does not satisfy waitForLeg's data-status="standup-progress" / data-state="failed" contract (DDR 0131), so a correctly-surfaced fault times out on the full 1200s budget instead of failing fast.

These are separate seams (the e2e harness, not the clan render) and want their own tickets; recommend filing them so the diagnosis + fail-fast gaps get their own slices.

Landed as `12ddea4` on `origin/main` (product-layer / primary fix). **Root cause plugged:** `acme-dns-register` was `after`/`requires acme-dns.service`, which only guarantees the daemon FORKED — not that it bound its loopback register/update API on `127.0.0.1:8081` ("the port lies", GOTCHAS #2). The old 30x1s register poll was budgeted for a warm restart's momentary lag, not a fresh nixos-anywhere install's first reboot where the API binds seconds later, so the very first curl hit connection-refused and the budget ran out — surfaced by clan as a `masked_exit`. **Fix** (`internal/clan/acmedns.go`, `RenderAcmeDNS`): before any register, the oneshot now polls acme-dns's **non-mutating `/health`** for up to **300x1s** (still well inside the enroll-activate leg budget), and on timeout NAMES the unreachable capability (`local API … never came up (acme-dns.service listening on loopback?)`) so a crashed/never-listening acme-dns is distinguishable from a real registration failure. The mutating register POST runs only once the API answers. - Seam test: `TestRenderAcmeDNS_WaitsForTheLocalAPIBeforeRegistering` (`internal/clan/acmedns_test.go`); full `internal/clan` suite green; repo pre-push gate green. - Hazard recorded: `docs/GOTCHAS.md` #15. `STATUS.md` header + milestone log updated. **Deferred to their own issues — the two harness-side halves called out in this report (out of this product slice's scope):** 1. Post-mortem evidence-gather fails strict host-key checking because `known_hosts` isn't refreshed after nixos-anywhere regenerates the droplet host key — so the gateway journal (crash vs. slow-start) stays unreachable. 2. A founding-stage fault does not satisfy `waitForLeg`'s `data-status="standup-progress"` / `data-state="failed"` contract (DDR 0131), so a correctly-surfaced fault times out on the full 1200s budget instead of failing fast. These are separate seams (the e2e harness, not the clan render) and want their own tickets; recommend filing them so the diagnosis + fail-fast gaps get their own slices.
ben closed this issue 2026-08-11 07:09:51 +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#431
No description provided.