own-VPS sign-in ceremony races Caddy's acme-dns-gated cold start — ERR_CONNECTION_REFUSED opening id.<apex> (#498 follow-on) #499

Closed
opened 2026-08-13 02:11:00 +00:00 by ben · 3 comments
Owner

Failure

Drive 20260813T015909Z reds at the sign-in leg, 3 minutes after commit 3448657 (#498) landed and 9 minutes after this exact leg was first exercised live. #498's fix (moving the own-VPS ceremony window to the PUBLIC IdP door https://id.<apex>/ui/reset) is working as designed — but it exposes a pre-existing, un-gated race: nothing waits for the gateway's Caddy (which fronts id.<apex>) to actually be listening before the app opens the ceremony window on it.

Error: expect(locator).toBeVisible() failed
Locator: locator('[data-status="enrol-pending"]')

(artifacts/journey.droplet-.../error-context.md:14-26, tests/e2e/journey.droplet.spec.ts:316, default 30s Playwright timeout, no explicit budget).

The real failure is upstream of that assertion — helper.log:

(node:1853234) electron: Failed to load URL: https://id.rehearsal.idss.nz/ui/reset?token=s481j-d3h96-zb476-scd13 with error: ERR_CONNECTION_REFUSED
Error occurred in handler for 'ourcloud:open-ceremony': Error: ourcloud: the ceremony window failed to load (-102): ERR_CONNECTION_REFUSED

same text surfaces in the app's own error banner (error-context.md:40).

Evidence chain

  1. logs/droplet-journal.txt:1464-1483 — the control-plane deploy row (the first activation of front-door.nix/acme-dns.nix on this box, own-VPS address chosen) completes and the founding orchestrator opens hand-off ~4.4s later (artifacts/legs.json — control-plane 20122ms, finish 4432ms).
  2. logs/droplet-journal.txt:842-852 — acme-dns[991] logs Starting DNS listener at 02:04:53 but never logs starting its HTTP API listener (127.0.0.1:8081) anywhere in the captured journal.
  3. logs/droplet-journal.txt:814 onward — acme-dns-register-start retries curl -fsS $api/health once a second (its own documented 300×1s cold-boot budget, docs/GOTCHAS.md #15 / issue #431, mirrored in the generated state/clan-config/machines/gateway/acme-dns.nix's acme-dns-register script) and is still failing at 02:06:27 (94 consecutive curl: (7) Failed to connect to 127.0.0.1 port 8081 lines), i.e. >90s in, well inside its own budget but nowhere near done.
  4. systemd.services.caddy in the same generated acme-dns.nix is after/requires = [ "acme-dns-register.service" ] — so Caddy (and therefore the public HTTPS door for id.rehearsal.idss.nz) had not started when the app tried to open the ceremony window around 02:05:56-57 (kanidm's own MintToken/idm_admin auth over the SSH tunnel succeeded fine at that timestamp per droplet-journal.txt:1796-1817 — that path bypasses Caddy entirely, so it's unaffected).
  5. Hence ERR_CONNECTION_REFUSED: nothing was listening on 443 for id.<apex> yet.

Suspected layer

Cross-cutting, three candidate owners — this needs a ruling (same shape as #494/#498), not a guess:

  • App/helper (app/helper, OpenCeremony handler / ourcloud:open-ceremony) — could retry ERR_CONNECTION_REFUSED with a bounded backoff before failing loud, the same "the port lies" pattern GOTCHAS #15 already named for acme-dns-register itself, recurring one hop downstream (Caddy-behind-acme-dns, not acme-dns's own API).
  • internal/founding hand-off (internal/founding/handoff.go, OpenEnrolment) — could poll the public front door before opening enrolment / signalling hand-off, so hand-off means "the operator can actually sign in," not just "the control-plane process reported ready."
  • Test-side budget (tests/e2e/journey.droplet.spec.ts:316) — the default 30s Playwright timeout on [data-status="enrol-pending"] is far shorter than acme-dns-register's own worst-case ~300s ceiling (GOTCHAS #15/#431); even a correct product-side fix needs the sign-in leg's budget raised to match.

What plugging it needs

A ruling on which layer owns the wait (and its ceiling) before implementation — this is exactly the kind of own-VPS ceremony-window behavior call Ben has ruled on twice already this week (#494 password-vs-passkey, #498 public-door-vs-forward). Likely shape: app-side retry-on-ERR_CONNECTION_REFUSED when opening the own-VPS ceremony window, budgeted to at least cover acme-dns-register's own 300s cold-start ceiling, plus a matching bump to the sign-in leg's test budget. Not self-fixable here: no live droplet to verify real acme-dns/Caddy bring-up timing against, and the fix shape (which component gates, how long) is a design decision, not a mechanical one-line correction.

drive 20260813T015909Z red at sign-in: `mexpect(mmlocatormm).mtoBeVisiblem(mm)m failed

Locator: locator('[data-status="enrol-pending"]')
Expected: visible
Timeout: Nms
Error: element(s) not found

Call log:
m - Expect "toBeVisible" with timeout Nmsm
m - waiting for locator('[data-status="enrol-pending"]')mevidence:test-results/…/20260813T015909Z/` on matou-workstation (legs.json, droplet-journal.txt, trace)

## Failure Drive `20260813T015909Z` reds at the `sign-in` leg, 3 minutes after commit `3448657` (#498) landed and 9 minutes after this exact leg was first exercised live. #498's fix (moving the own-VPS ceremony window to the PUBLIC IdP door `https://id.<apex>/ui/reset`) is *working as designed* — but it exposes a pre-existing, un-gated race: nothing waits for the gateway's Caddy (which fronts `id.<apex>`) to actually be listening before the app opens the ceremony window on it. ``` Error: expect(locator).toBeVisible() failed Locator: locator('[data-status="enrol-pending"]') ``` (`artifacts/journey.droplet-.../error-context.md:14-26`, `tests/e2e/journey.droplet.spec.ts:316`, default 30s Playwright timeout, no explicit budget). The real failure is upstream of that assertion — `helper.log`: ``` (node:1853234) electron: Failed to load URL: https://id.rehearsal.idss.nz/ui/reset?token=s481j-d3h96-zb476-scd13 with error: ERR_CONNECTION_REFUSED Error occurred in handler for 'ourcloud:open-ceremony': Error: ourcloud: the ceremony window failed to load (-102): ERR_CONNECTION_REFUSED ``` same text surfaces in the app's own error banner (`error-context.md:40`). ## Evidence chain 1. `logs/droplet-journal.txt:1464-1483` — the `control-plane` deploy row (the first activation of `front-door.nix`/`acme-dns.nix` on this box, own-VPS address chosen) completes and the founding orchestrator opens hand-off ~4.4s later (`artifacts/legs.json` — `control-plane` 20122ms, `finish` 4432ms). 2. `logs/droplet-journal.txt:842-852` — `acme-dns[991]` logs `Starting DNS listener` at `02:04:53` but **never logs starting its HTTP API listener** (`127.0.0.1:8081`) anywhere in the captured journal. 3. `logs/droplet-journal.txt:814` onward — `acme-dns-register-start` retries `curl -fsS $api/health` once a second (its own documented 300×1s cold-boot budget, `docs/GOTCHAS.md` #15 / issue #431, mirrored in the generated `state/clan-config/machines/gateway/acme-dns.nix`'s `acme-dns-register` script) and is **still failing at `02:06:27`** (94 consecutive `curl: (7) Failed to connect to 127.0.0.1 port 8081` lines), i.e. >90s in, well inside its own budget but nowhere near done. 4. `systemd.services.caddy` in the same generated `acme-dns.nix` is `after`/`requires = [ "acme-dns-register.service" ]` — so Caddy (and therefore the public HTTPS door for `id.rehearsal.idss.nz`) had **not started** when the app tried to open the ceremony window around `02:05:56-57` (kanidm's own `MintToken`/idm_admin auth over the SSH tunnel succeeded fine at that timestamp per `droplet-journal.txt:1796-1817` — that path bypasses Caddy entirely, so it's unaffected). 5. Hence `ERR_CONNECTION_REFUSED`: nothing was listening on 443 for `id.<apex>` yet. ## Suspected layer Cross-cutting, three candidate owners — this needs a ruling (same shape as #494/#498), not a guess: - **App/helper (`app/helper`, `OpenCeremony` handler / `ourcloud:open-ceremony`)** — could retry `ERR_CONNECTION_REFUSED` with a bounded backoff before failing loud, the same "the port lies" pattern GOTCHAS #15 already named for `acme-dns-register` itself, recurring one hop downstream (Caddy-behind-acme-dns, not acme-dns's own API). - **`internal/founding` hand-off (`internal/founding/handoff.go`, `OpenEnrolment`)** — could poll the public front door before opening enrolment / signalling hand-off, so hand-off means "the operator can actually sign in," not just "the control-plane process reported ready." - **Test-side budget (`tests/e2e/journey.droplet.spec.ts:316`)** — the default 30s Playwright timeout on `[data-status="enrol-pending"]` is far shorter than `acme-dns-register`'s own worst-case ~300s ceiling (GOTCHAS #15/#431); even a correct product-side fix needs the sign-in leg's budget raised to match. ## What plugging it needs A ruling on which layer owns the wait (and its ceiling) before implementation — this is exactly the kind of own-VPS ceremony-window behavior call Ben has ruled on twice already this week (#494 password-vs-passkey, #498 public-door-vs-forward). Likely shape: app-side retry-on-`ERR_CONNECTION_REFUSED` when opening the own-VPS ceremony window, budgeted to at least cover `acme-dns-register`'s own 300s cold-start ceiling, plus a matching bump to the `sign-in` leg's test budget. Not self-fixable here: no live droplet to verify real acme-dns/Caddy bring-up timing against, and the fix shape (which component gates, how long) is a design decision, not a mechanical one-line correction. drive `20260813T015909Z` red at `sign-in`: `mexpect(mmlocatormm).mtoBeVisiblem(mm)m failed Locator: locator('[data-status="enrol-pending"]') Expected: visible Timeout: Nms Error: element(s) not found Call log: m - Expect "toBeVisible" with timeout Nmsm m - waiting for locator('[data-status="enrol-pending"]')m` evidence: `test-results/…/20260813T015909Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) <!-- rehearsal-sig: e689ed304acb -->
Author
Owner

Diagnosis CONFIRMED (journal receipt) — and one correction of my own

The cold-start race framing is right. Drive 20260813T015909Z's own journal (logs/droplet-journal.txt):

02:04:53 gateway systemd: Starting Register the gateway acme-dns account and publish OURCLOUD_ACMEDNS_* for Caddy (ADR 0014)...
02:06:08…02:06:27 acme-dns-register-start: curl: (7) Failed to connect to 127.0.0.1:8081 — repeating

At the ceremony's ERR_CONNECTION_REFUSED (02:05:57), Caddy was still GATED behind acme-dns registration — no :443 listener existed on the (correct) droplet. For the record: I had leaned stale-DNS-cache (drive-4's record steering at the old droplet); the journal kills that — the refused connection is fully explained at the right IP.

The enabling defect: the S11 checklist's public-entry row ("Public entry — secure connections live") is marked DeployStepDone UNCONDITIONALLY (internal/founding/deploy.go:685, deployChecklist — "prerequisites the join node already completed"). Nothing ever probes the public door, so the journey rests "done" and the finish leg completes while Caddy is minutes from serving. This is the #440/#443 false-green shape and GOTCHAS #12's divergence class, one row over.

Fix direction (three parts, ordered by importance)

  1. public-entry becomes an honest probe (own-VPS path): before the row rests done, probe https://<apex> (or the IdP host) until it answers over TLS, bounded by the ADR 0161 re-run family sized for a FIRST-BOOT cold start (acme-dns registration + DNS-01 wildcard issuance — minutes, not seconds; budget generously and tighten from green evidence like every ceiling). A genuinely-dead front door reds the row honestly. With this, S12's ceremony follows a door that is actually live.
  2. The ceremony open retries (defense in depth): open-ceremony / createCeremonyWindow's did-fail-load on ERR_CONNECTION_REFUSED / ERR_NAME_NOT_RESOLVED retries across a bounded window instead of failing the enrolment on one dead loadURL — real founders' fresh DNS lags too. The reset token survives re-loads until spent.
  3. Fail-loud on S12 (law): drive 5's open-ceremony rejection landed ONLY in helper.log (Error occurred in handler for 'ourcloud:open-ceremony': … (-102): ERR_CONNECTION_REFUSED) — journey fault empty, no S12 state, enrol-pending never shown. An operator clicking "Open your dashboard" sees NOTHING. The rejection must land as a visible enrolment fault (and, with 2., only after the bounded retry is exhausted).

Also for whoever picks this up: the droplet evidence harvest's guest-caddy.log collector is private-path-shaped (reads the local qemu unit) and collected nothing on this target — the journal saved us. A droplet-flavored caddy/acme collector would make the next race legible; fine as a follow-up ticket if out of scope here.

## Diagnosis CONFIRMED (journal receipt) — and one correction of my own The cold-start race framing is right. Drive `20260813T015909Z`'s own journal (`logs/droplet-journal.txt`): ``` 02:04:53 gateway systemd: Starting Register the gateway acme-dns account and publish OURCLOUD_ACMEDNS_* for Caddy (ADR 0014)... 02:06:08…02:06:27 acme-dns-register-start: curl: (7) Failed to connect to 127.0.0.1:8081 — repeating ``` At the ceremony's `ERR_CONNECTION_REFUSED` (02:05:57), Caddy was still GATED behind acme-dns registration — no :443 listener existed on the (correct) droplet. For the record: I had leaned stale-DNS-cache (drive-4's record steering at the old droplet); the journal kills that — the refused connection is fully explained at the right IP. **The enabling defect:** the S11 checklist's `public-entry` row ("Public entry — secure connections live") is marked `DeployStepDone` UNCONDITIONALLY (`internal/founding/deploy.go:685`, `deployChecklist` — "prerequisites the join node already completed"). Nothing ever probes the public door, so the journey rests "done" and the finish leg completes while Caddy is minutes from serving. This is the #440/#443 false-green shape and GOTCHAS #12's divergence class, one row over. ## Fix direction (three parts, ordered by importance) 1. **`public-entry` becomes an honest probe** (own-VPS path): before the row rests done, probe `https://<apex>` (or the IdP host) until it answers over TLS, bounded by the ADR 0161 re-run family sized for a FIRST-BOOT cold start (acme-dns registration + DNS-01 wildcard issuance — minutes, not seconds; budget generously and tighten from green evidence like every ceiling). A genuinely-dead front door reds the row honestly. With this, S12's ceremony follows a door that is actually live. 2. **The ceremony open retries** (defense in depth): `open-ceremony` / `createCeremonyWindow`'s `did-fail-load` on ERR_CONNECTION_REFUSED / ERR_NAME_NOT_RESOLVED retries across a bounded window instead of failing the enrolment on one dead `loadURL` — real founders' fresh DNS lags too. The reset token survives re-loads until spent. 3. **Fail-loud on S12** (law): drive 5's open-ceremony rejection landed ONLY in helper.log (`Error occurred in handler for 'ourcloud:open-ceremony': … (-102): ERR_CONNECTION_REFUSED`) — journey fault empty, no S12 state, `enrol-pending` never shown. An operator clicking "Open your dashboard" sees NOTHING. The rejection must land as a visible enrolment fault (and, with 2., only after the bounded retry is exhausted). Also for whoever picks this up: the droplet evidence harvest's `guest-caddy.log` collector is private-path-shaped (reads the local qemu unit) and collected nothing on this target — the journal saved us. A droplet-flavored caddy/acme collector would make the next race legible; fine as a follow-up ticket if out of scope here.
Author
Owner

swarm-claim host=elitebook-distributed-server-03 run=5495
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=5495 (automated multi-host claim — lowest live claim id works this ticket)
Author
Owner

close-report for #499 — status success

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

envelope
{
  "issue": 499,
  "status": "success",
  "commits": [
    "0bfb054"
  ],
  "changed_files": [
    "STATUS.md",
    "app/helper/cmd/helper/wiring_dev.go",
    "app/helper/cmd/helper/wiring_prod.go",
    "app/helper/cmd/helper/wiring_test.go",
    "app/src-electron/electron-main.ts",
    "app/tests/e2e/journey.droplet.spec.ts",
    "app/tests/unit/ceremonyWindow.test.ts",
    "docs/GOTCHAS.md",
    "internal/doorprobe/prober.go",
    "internal/doorprobe/prober_test.go",
    "internal/founding/deploy.go",
    "internal/founding/export_test.go",
    "internal/founding/orchestrator.go",
    "internal/founding/ownvpspath_test.go",
    "internal/founding/testing/fakes.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/founding/ ./internal/doorprobe/ ./app/helper/cmd/helper/",
      "exit_code": 0
    },
    {
      "command": "node_modules/.bin/vitest run tests/unit/ceremonyWindow.test.ts",
      "exit_code": 0
    },
    {
      "command": "node_modules/.bin/vitest run (full app unit suite, boot.test.ts with go on PATH)",
      "exit_code": 0
    },
    {
      "command": "vue-tsc -p tsconfig.json --noEmit",
      "exit_code": 0
    }
  ],
  "criteria": {
    "public-entry is an honest probe on the own-VPS path (Ben's ruling part 1)": "internal/founding/deploy.go runDeploy gates on ownVPSCeremonyHost(s) via probeDoorLive before resting the row done; new founding.DoorProbe seam wired to real internal/doorprobe net/http reach (wiring_prod.go), fake in testing/fakes.go; TestOwnVPS_PublicEntryWaitsForTheColdStartDoor proves it re-probes the public IdP door and rests done only once it answers",
    "a genuinely-dead front door reds the row honestly": "TestOwnVPS_DeadPublicDoorRedsPublicEntry: DownForever door => Deploy.Outcome=DeployFailed, public-entry row Failed, control-plane still Done, no hand-off, ceremony never opened, per-mode recovery offered",
    "probe bounded over the acme-dns first-boot cold start (ADR 0161 re-run family)": "doorProbeDefaultAttempts=120 x doorProbeDefaultDelay=5s (~10 min) over acme-dns's ~5 min floor, SetDoorProbeForTest shrinks it for tests; commented in deploy.go/orchestrator.go",
    "ceremony open retries on ERR_CONNECTION_REFUSED / ERR_NAME_NOT_RESOLVED (part 2)": "app/src-electron/electron-main.ts createCeremonyWindow re-loads the same reset url on transient reach errors across CEREMONY_LOAD_RETRIES x CEREMONY_LOAD_RETRY_MS (~90s), token survives; ceremonyWindow.test.ts retry guard",
    "fail-loud on S12 only after the bounded retry (part 3)": "createCeremonyWindow rejects with 'the ceremony window failed to load' after retries exhausted -> openCeremony invoke rejects -> enrolPasskey throws -> FoundingStandup onOpenDashboard catch sets enrolFault -> FoundingHandOff renders data-status=journey-fault / data-field=fault-line with a re-mint; ceremonyWindow.test.ts asserts the loud-fail path survives",
    "sign-in leg test budget raised to cover the ceiling": "app/tests/e2e/journey.droplet.spec.ts: public-entry deploy budget 4m->12m (now carries the door cold start), enrol-pending assertion default 30s->2m to cover the app-side retry window"
  },
  "summary": "The own-VPS public-entry deploy row is now an honest TLS probe of the public front door (new DoorProbe seam), the app re-loads the ceremony on a transient reach, and the droplet test budgets match the acme-dns cold-start ceiling — closing the #498-exposed race.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #499 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 499, "status": "success", "commits": [ "0bfb054" ], "changed_files": [ "STATUS.md", "app/helper/cmd/helper/wiring_dev.go", "app/helper/cmd/helper/wiring_prod.go", "app/helper/cmd/helper/wiring_test.go", "app/src-electron/electron-main.ts", "app/tests/e2e/journey.droplet.spec.ts", "app/tests/unit/ceremonyWindow.test.ts", "docs/GOTCHAS.md", "internal/doorprobe/prober.go", "internal/doorprobe/prober_test.go", "internal/founding/deploy.go", "internal/founding/export_test.go", "internal/founding/orchestrator.go", "internal/founding/ownvpspath_test.go", "internal/founding/testing/fakes.go" ], "tests": [ { "command": "go test ./internal/founding/ ./internal/doorprobe/ ./app/helper/cmd/helper/", "exit_code": 0 }, { "command": "node_modules/.bin/vitest run tests/unit/ceremonyWindow.test.ts", "exit_code": 0 }, { "command": "node_modules/.bin/vitest run (full app unit suite, boot.test.ts with go on PATH)", "exit_code": 0 }, { "command": "vue-tsc -p tsconfig.json --noEmit", "exit_code": 0 } ], "criteria": { "public-entry is an honest probe on the own-VPS path (Ben's ruling part 1)": "internal/founding/deploy.go runDeploy gates on ownVPSCeremonyHost(s) via probeDoorLive before resting the row done; new founding.DoorProbe seam wired to real internal/doorprobe net/http reach (wiring_prod.go), fake in testing/fakes.go; TestOwnVPS_PublicEntryWaitsForTheColdStartDoor proves it re-probes the public IdP door and rests done only once it answers", "a genuinely-dead front door reds the row honestly": "TestOwnVPS_DeadPublicDoorRedsPublicEntry: DownForever door => Deploy.Outcome=DeployFailed, public-entry row Failed, control-plane still Done, no hand-off, ceremony never opened, per-mode recovery offered", "probe bounded over the acme-dns first-boot cold start (ADR 0161 re-run family)": "doorProbeDefaultAttempts=120 x doorProbeDefaultDelay=5s (~10 min) over acme-dns's ~5 min floor, SetDoorProbeForTest shrinks it for tests; commented in deploy.go/orchestrator.go", "ceremony open retries on ERR_CONNECTION_REFUSED / ERR_NAME_NOT_RESOLVED (part 2)": "app/src-electron/electron-main.ts createCeremonyWindow re-loads the same reset url on transient reach errors across CEREMONY_LOAD_RETRIES x CEREMONY_LOAD_RETRY_MS (~90s), token survives; ceremonyWindow.test.ts retry guard", "fail-loud on S12 only after the bounded retry (part 3)": "createCeremonyWindow rejects with 'the ceremony window failed to load' after retries exhausted -> openCeremony invoke rejects -> enrolPasskey throws -> FoundingStandup onOpenDashboard catch sets enrolFault -> FoundingHandOff renders data-status=journey-fault / data-field=fault-line with a re-mint; ceremonyWindow.test.ts asserts the loud-fail path survives", "sign-in leg test budget raised to cover the ceiling": "app/tests/e2e/journey.droplet.spec.ts: public-entry deploy budget 4m->12m (now carries the door cold start), enrol-pending assertion default 30s->2m to cover the app-side retry window" }, "summary": "The own-VPS public-entry deploy row is now an honest TLS probe of the public front door (new DoorProbe seam), the app re-loads the ceremony on a transient reach, and the droplet test budgets match the acme-dns cold-start ceiling — closing the #498-exposed race.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
ben closed this issue 2026-08-13 02:38:35 +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#499
No description provided.