acme-dns-gate wastes ~4 min polling DNS on the seeded-cert path — short-circuit the gate when Caddy already holds a valid cert (the drive-provable half of #1500 part 1) #1502
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1502
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Every rented founding spends ~4 min inside the first control-plane switch waiting behind
acme-dns-gate(#554/ADR 0014) for_acme-challenge.<slug>.idss.nzto go live on the pinned resolvers — even when the drive has seeded a valid Caddy cert store pre-deploy (#724/ADR 0176), so Caddy will place zero ACME orders this boot. The gate's whole purpose is to keep Caddy's first ACME order from poisoning a resolver's negative cache (#547). When Caddy already holds a valid cert for the identifier set, there is no first order to protect, so the gate's poll is pure wall-clock waste — the ~4 min the phase-9 drives burn on every fire (#1500 runs20260915T155605Z,20260915T164205Z).This is the residue #1500 left open: #1500 proved the delegation cannot be published at claim (its target is the acme-dns
fulldomain, a random per-registration value the box only generates at first boot; the broker learns it only via the post-boot heartbeat — ADR 0136 delegation-reconcile), so for a genuine first founding the ~4 min is a real floor. But the seeded-cert path (rehearsal re-drives AND production ADR-0176 re-foundings) needn't pay it.Proposed fix
acme-dns-gate(internal/clan/acmedns.goacmednsGateScript) short-circuitsexit 0at the top when Caddy's storage already holds a currently-valid certificate covering the challenge apex (e.g. a non-expired*.crtunder/var/lib/caddy/.local/share/caddy/certificates/**matching<apex>/*.<apex>, checked withopenssl x509 -checkend). No valid cert → poll exactly as today (the first-founding path is untouched). The gate is already fail-open (every exit is 0), so a mis-detection is bounded to the existing fail-open behaviour — but the short-circuit must be conservative (a false "cert present" would let Caddy order early against a not-yet-live delegation and reopen the #547 poisoning window), which is why this wants its own red→green seam test and a rented drive to prove the wall-time drop, not a blind land.Acceptance
acme-dns-gateexits 0 without polling; theclan-switch-gateway-*.service: Consumed … wall clock timeline drops the DNS-propagation wait on the seeded path.TestRenderAcmeDNS_GatesCaddyOnDelegationLiveplus a new "skips the poll when a valid cert is already staged" render/seam test.rented-servicesdrive'slogs/droplet-journal.txt.Found while working
#1500 (the switch stall + self-admit status 4). Filed as the drive-provable half of #1500's part 1; #1500 shipped the status-4 fix and documented this floor.
Triage —
enhancement+ready-for-agentClaim verified against the code.
acmednsGateScript(internal/clan/acmedns.go:328) reads the publishedfulldomainfact and, whenever it is non-empty, polls the pinned resolversseq 1 60×sleep 5(~5 min budget) before releasing Caddy — with no check for an already-valid cert. So the seeded-cert path (#724/ADR 0176; the store staged into/var/lib/caddy/.local/share/caddy—internal/certpersistStorageRoot) pays the full propagation wait even though Caddy will place zero ACME orders that boot. The~4 minand the#547poisoning window the gate exists to protect are both real and correctly described. Redundancy check: no existing short-circuit — the gate has only the three exit-0 paths (fact-absent, converged, budget-spent). No.out-of-scope/match.Ruled by agent under ADR 0174 — veto anytime
The call: the acceptance criterion "a rented drive to prove the wall-time drop … Measured before/after on a
rented-servicesdrive'slogs/droplet-journal.txt" is the only thing that could push this offready-for-agent(live infra / droplet creds → normallyready-for-session). Ruling:ready-for-agent. The agent-doable deliverable is the code short-circuit + a new red→green render/seam test; the rented-drive wall-time proof rides the rehearsal-executor rail (matou-workstation, which holds the droplet creds and polls the drive issue), not the swarm worker — exactly the split that let the parent #1500 shipready-for-agentand prove 28/28 on a rented gateway. Therehearsal-report.shrail auto-appliesrehearsal-183/prioritywhen the drive fires; no need to pre-apply here.Why it's a two-way door: revertible by a single commit; the gate is already fail-open (every exit is 0), so a mis-detection is bounded to existing behaviour; and it is provable by the existing
TestRenderAcmeDNS_GatesCaddyOnDelegationLive+ the new "skips the poll when a valid cert is staged" test + the drive journal's wall-clock line. Not on the one-way-door list: no personal credentials, no security-posture widening (the fail-open contract is unchanged and the short-circuit is conservative + test-gated), no member-facing trust accept, no data destruction, no non-routine spend (rehearsal drives are routine).Agent brief
Goal.
acme-dns-gatemustexit 0at the top ofacmednsGateScript— before the poll loop — when Caddy's storage already holds a currently-valid certificate covering the challenge apex, so the seeded-cert path (rehearsal re-drives and production ADR-0176 re-foundings) skips the ~4 min DNS-propagation wait. No valid cert → poll exactly as today (the genuine-first-founding path is untouched).The change (
internal/clan/acmedns.go,acmednsGateScript):want=/ fulldomain logic (or immediately afterset -uo pipefail): scan Caddy's cert store under/var/lib/caddy/.local/share/caddy/certificates/**for a non-expired*.crtwhose subject/SAN covers$apexor*.$apex, usingopenssl x509 -checkend <seconds> -noout -in <crt>. If one is found, log a loud journal line ("valid cert already staged for $apex — no first ACME order to protect, skipping delegation poll") andexit 0.#547poisoning window. Match the apex explicitly (don't release on any random cert in the store); pick a-checkendmargin that is safely non-zero. Keep the$var-only shell style (no${...}) the file documents atinternal/clan/acmedns.go:324-327so the Nix here-string needs no antiquotation escaping.internal/certpersistStorageRoot/StateRootfor the paths rather than re-hardcoding where practical.Tests (
internal/clan/acmedns_test.go, model onTestRenderAcmeDNS_GatesCaddyOnDelegationLive/TestRenderAcmeDNS_GateIsFailOpen):openssl x509 -checkendcheck against the apex cert path and anexit 0on the cert-present branch, ordered before theseq 1 60poll.TestRenderAcmeDNS_GatesCaddyOnDelegationLive(poll present) andTestRenderAcmeDNS_GateIsFailOpen(noexit 1, bounded budget, loud budget-spent line) must still pass — the short-circuit must not weaken them.Acceptance (from the issue):
clan-switch-gateway-*.service: Consumed … wall clock timedrops the DNS-propagation wait on the seeded path.TestRenderAcmeDNS_GatesCaddyOnDelegationLive+ the new render test).rented-servicesdrive'slogs/droplet-journal.txt— supplied by the rehearsal-executor rail, not this worker.Files:
internal/clan/acmedns.go(acmednsGateScript),internal/clan/acmedns_test.go. Parent: #1500 (shipped the status-4 fix; documented this floor). Related:#554/ADR 0014 (the gate),#547(the poisoning window),#724/ADR 0176 + GOTCHAS #32 (the seeded store).swarm-claim host=matou-dev-server-01 run=24733
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #1502 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope