heartbeat: Tick never verifies the live DNS record, so external mis-point never self-heals (heartbeat-repoint, signature 8ff2bd61a4d7) #642
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
2 participants
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#642
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?
Failure: the
heartbeat-repointrehearsal leg mis-pointsrehearsal-b.idss.nzto203.0.113.250via the broker (claim secret, ADR 0135) while leaving the droplet's real address (209.38.95.103) unchanged, then pollsdigfor up to 900s waiting for the live address heartbeat (ADR 0136) to correct it. It never does —digstill answers203.0.113.250at the deadline. Seeapp/tests/e2e/journey.selfhosted.spec.ts:517-556(leg body) and the leg-13 comment at 417-421 ("the exact state an ISP rotation leaves"). Run evidence:test-results/drive-selfhosted/20260821T231633Z/artifacts/legs.json—heartbeat-repointred after 917554ms withdig last answered: \"203.0.113.250\".Root cause:
Heartbeat.Tick(internal/heartbeat/heartbeat.go:180-205) only compares the gateway's self-observed public IP (read viainternal/dnsreflection, behind NAT) againsth.lastIP, the last address the heartbeat itself successfully wrote:It never reads back what the DNS record currently answers. In this scenario the gateway's own address hasn't changed (
ip == lastIP), so every tick — at the wired 5-minute interval (control-plane/cmd/control-plane/main.go:84,addressHeartbeatInterval) — takes the silent no-op branch, and the broker is never called again. The mis-pointed record stands indefinitely.internal/heartbeat/heartbeat_test.goconfirms this is the implemented design, not a regression: its cases (TestTick_UnchangedAddressIsSilentNoOp,TestTick_ChangedAddressRepoints,TestTick_RepointFailureRaisesStandingFaultThatHolds,TestTick_DiscoveryFailureIsNotSilentlyHealthy,TestTick_DiscoveryGapDoesNotMaskAKnownStaleRecord) never exercise "the live record drifted while the gateway's own observed address stayed the same." ADR 0136 (docs/adr/0136-*.md) matches the code: it explicitly scopes the heartbeat to react to a self-observed address change ("observes the gateway's public address and, when it changes, re-points"), not to verify or reconcile the live record.The rehearsal drive's
heartbeat-repointleg is holding the heartbeat to a stronger bar (self-healing externally-drifted DNS, e.g. a mis-point from another actor or a broker-side mistake) than ADR 0136 currently scopes it to.Suspected layer:
internal/heartbeat(Tick's change-detection branch), and its production wiring incontrol-plane/cmd/control-plane/main.go:475-522(productionAddressHeartbeat) if closing the gap needs a DNS-read dependency.What plugging it needs: a design ruling on the correction strategy, since either option changes the loop's broker-call cost profile and the accepted ADR 0136 scope:
<slug>record each pass and repoints whenever it diverges fromlastIP, even when the self-observed gateway IP is unchanged, orThis likely needs an ADR 0136 amendment (or a new ADR) before implementation, not just a patch — flagging
confident: false.drive
20260821T231633Zred atheartbeat-repoint:rehearsal-b.idss.nz never re-pointed to the droplet (209.38.95.103) within 900s — the gateway heartbeat did not correct the mis-point to 203.0.113.250; dig last answered: "203.0.113.250"evidence:
test-results/…/20260821T231633Z/on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)Design ruling — Ben, 2026-08-21: option (a), the heartbeat RECONCILES the live record
The self-hosted drive now runs 12/13 legs green (
20260821T231633Z); this is the only remaining blocker, and it is a design gap in ADR 0136's scope, not a regression. Ben ruled: the heartbeat's job is to keep the live<slug>record answering the gateway's true address — not merely to react when the gateway's own address changes. External drift (the record mis-pointed by a broker error, another actor, or a registrar/cache glitch, while the gateway's own IP is unchanged) must self-heal.This is
needs-designno longer — it is implementable against the amendment below. A swarm session may take it.Land this ADR 0136 amendment VERBATIM (same commit as the code)
Append to
docs/adr/0136-the-address-heartbeat-is-idss-only-and-rewrites-glue.md:Acceptance criteria
Heartbeat.Tick(internal/heartbeat/heartbeat.go:180-205) reads the live<slug>answer each pass through a new injected resolver (wired likedisc/repointso the seam tests script it), and re-points whenliveRecord != observedIPeven ifobservedIP == lastIP. The currentif ip == lastIP && !owed { confirmCurrent(); return }short-circuit must no longer skip a divergent live record.internal/heartbeat/heartbeat_test.gonever had: live record drifted while the gateway's own observed address stayed the same → Tick re-points. (The reporter named this exact missing case.)TestTick_UnchangedAddressIsSilentNoOp(now: unchanged AND live record already correct → silent no-op, zero Repoint calls — assert it),TestTick_ChangedAddressRepoints,TestTick_RepointFailureRaisesStandingFaultThatHolds,TestTick_DiscoveryFailureIsNotSilentlyHealthy,TestTick_DiscoveryGapDoesNotMaskAKnownStaleRecord.<slug>answer, matchingjourney.selfhosted.spec.ts:517-556'sdig). Mind DNS TTL: read authoritatively enough that a stale cache neither masks a real divergence nor triggers a phantom re-point. Ifbrokerclientalready exposes a records read-back, prefer it (authoritative, cache-free) over a recursive DNS lookup; if not, an authoritative-NS query. Do NOT add a new inbound door.productionAddressHeartbeat(control-plane/cmd/control-plane/main.go:475-522) gains the resolver dependency.STATUS.mdin the same commit (ADR 0136 amended, heartbeat-repoint leg now covered); add adocs/GOTCHAS.mdentry only if a real hazard surfaces during implementation.Confidence
The mechanism is fully understood (drive
20260821T231633Z:diganswered the mis-pointed203.0.113.250at the 900s deadline; Tick's no-op branch never called the broker becauseobservedIP == lastIP). No live droplet needed to implement — the seam tests driveTickdirectly. Once green, close #640 (value-vs-timing) as moot — activation is proven clear by 12/13.Ruled by agent under ADR 0174 — veto anytime
Ben's design ruling (comment above, 2026-08-21) already settled the one-way-door part of this ticket — the ADR 0136 amendment and the correction-strategy choice (option a, reconciliation). What remained (wiring the injected resolver, updating Tick, TDD) is a two-way door: revertible by commit, provable by the seam tests below. No further human ruling needed; this comment is the audit trail for the implementation session.
Close-report
Landed (
a883e249bc312d5e642149424a34a9747bfb434e, pushed toorigin/main):docs/adr/0136-the-address-heartbeat-is-idss-only-and-rewrites-glue.md.internal/dns.AuthoritativeReader(new, TDD red-first —internal/dns/authoritative_test.gowritten and confirmed failing to compile beforeauthoritative.goexisted): looks up the zone's authoritative nameserver via the system resolver, then dials it directly for the live A record — bypassing any caching recursive resolver. InjectablelookupNS/dialAndLookupseams, scripted contract tests (5 cases), no fake in the real constructor (NewAuthoritativeReader).internal/heartbeat: newLiveRecordReaderport, third required constructor arg onNew.Ticknow reads the live record every pass; the silent no-op branch requires observed-IP-unchanged and no owed write and live-record-already-correct — a live-record divergence now re-points even with the gateway's own address unchanged (acceptance criterion 1). A live-record read failure raises the sameStateDiscoveryFailedwarning a self-IP read failure does and never masks aStateRepointFailedknown-stale record (criteria 4). All 5 pre-existing seam tests updated (confirmed still passing with intent unchanged) + 3 new:TestTick_LiveRecordDriftedWhileAddressUnchangedRepoints(the exact missing case, criterion 2),TestTick_LiveRecordReadFailureRaisesDiscoveryGapAndDoesNotRepoint,TestTick_LiveRecordReadFailureDoesNotMaskAKnownStaleRecord(criterion 4).control-plane/cmd/control-plane/main.go:productionAddressHeartbeatwiresdns.NewAuthoritativeReader(brokerclient.IssuanceApex)reading the community apex, satisfying criterion 6. brokerclient has no records read-back today, so per criterion 5's fallback this is the authoritative-NS query, not a recursive lookup.docs/GOTCHAS.mdentry — no hazard surfaced, just the scoped design gap the amendment already documents.Proof:
go build ./...,go vet ./...,gofmt -l(clean),go test ./...— all green, including the fullinternal/heartbeatandinternal/dnssuites.Not done in this session (structural, not a gap in the fix): this session cannot itself fire the standing self-hosted rehearsal (
host_capacity_acquire_exclusive, #577/ADR 0184 holds the same lock this session holds), so theheartbeat-repointleg's live re-run is the next cron-triggered rehearsal, not this session — closing on the strength of the seam tests directly exercising the exact gap the leg found, per the #635/#636/#641 precedent (see STATUS.md).Note for whoever next looks at #640 (
ready-for-human, value-vs-timing): Ben's ruling comment above said to close it as moot once this lands, since 12/13 legs green already proves activation clear. Left untouched per this session's single-ticket scope (ADR 0174 rule 1) — routing, not doing._acme-challengedelegation is written once at control-plane boot and never retried — a lost race against acme-dns-register leaves a permanently dead TLS door (#915's fix is a no-op on this path) #921_acme-challengedelegation never written — TLS door dead #922