Live rented gateway's lease heartbeat gets 409 "this host has no active rental" from the broker — the box is off the ledger (orphan risk) #1335
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.
Dependencies
No dependencies set.
Reference
Matou/idss#1335
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?
Seen: manual trial 2026-09-08 (Whakatohea, rented path, build db1d1b23). The gateway at 209.38.86.8 (
idss-gateway-whakatohea-research-centre-cb94) was rented through the app at 00:08 UTC 2026-09-09 (box booted 00:09) and came live at 00:52. From its first heartbeat onward, every 5-minute renew fails:409 comes from
Rentals.Renew→ErrNotRented(no record, orReleased:true) — the request passed the claim-secret check, so this is the ledger, not auth. The app's own state still holds the rental (draft.access.kind=rented, noabandoned_rentals), and the app never called release for this box. The broker has been up since 2026-09-03 with no restarts, so it is not a lost ledger.What is known about the window: the previous Whakatohea box (170.64.136.124) was released + the name offboarded at ~20:11 UTC 2026-09-08, four hours BEFORE this rent, and the name was re-claimed by the app (new claim secret).
Rentwrites the ledger record under the normalised apex and only three paths ever setReleased(Rent-on-gone-server, Release, Reap) — none should have fired. Needs the broker journal forwhakatoheabetween 00:08 and 00:52 UTC 2026-09-09 (root on the mail droplet:journalctl -u ourcloud-broker --since "2026-09-09 00:00").Why it matters: the backstop the log names does not exist for this box — a host the ledger does not carry is never reaped, so it bills until someone finds it by hand (ADR 0047/0100 orphan class). The heartbeat's wording ("the reaper is the backstop") is wrong for
ErrNotRentedspecifically and should say so loudly.Ask: (1) find why the record went missing/released; (2) make the control plane distinguish 409-not-rented from a transient and surface it on the dashboard (an orphan nobody can see); (3) decide whether the app should re-rent/re-register on not-rented.
Category: bug · State: ready-for-session
Ruled by agent under ADR 0174 — veto anytime
The routing call: this is not
ready-for-human. Root-causing it (Ask 1) needs the live broker journal on the mail droplet (journalctl -u ourcloud-broker, root) — that is an interactive agent session's standing (a live droplet door), which the reporter named, not Ben's hands or eyes. Pulling a journal is not data destruction, not a posture widening, not a Ben-only credential, and the follow-on fixes (Asks 2 and 3) are revertible-by-commit and provable by the broker's rentals tests. So the whole ticket is a two-way door an agent session can close; a swarm worker can't, because it has no route to the droplet journal — henceready-for-session, notready-for-agent. Ask 3's re-rent/re-register policy is itself a two-way door the implementing session should rule (proposed default below) and post here, not escalate.Verified against the codebase
Real paths, all present:
broker/internal/broker/rentals.go:167—ErrNotRented= "broker: this host has no active rental";Renew(L355-361) returns it when the host key is absent orReleased:true.rentals map[string]Rentalkeyed by host (the normalised apex), L126. Only three paths setReleased: Rent-on-gone-server (L248-257),Release,Reap.internal/heartbeat/heartbeat.go:381-384(and the doc-comment L370-374): it asserts "the broker's TTL reaper is the backstop" unconditionally, which is false forErrNotRented— a host the ledger doesn't carry is never reaped (the ADR 0047/0100 orphan class the report names).A suspected lead for the session (confirm against the journal, don't assume): the previous Whakatohea box shared the same normalised apex host key and was released ~20:11 UTC, four hours before this rent under the same key. Trace whether the new
Rentrecord was later flippedReleased— Rent-on-gone-server (L248-257) is the one path that marks a live-keyed record released, and it keys onhost. GOTCHAS #58 is the adjacent "deleted-behind-the-broker's-back" case.Not redundant: no existing code distinguishes 409-not-rented from a transient renew failure, and nothing surfaces an off-ledger orphan on the dashboard.
Session brief
Evidence gate (do first): on the mail droplet as root,
journalctl -u ourcloud-broker --since "2026-09-09 00:00"and grep forwhakatoheabetween 00:08 and 00:52 UTC — find which of Rent / Release / Reap flippedReleased(or whether the record was never written under the apex the renew uses). Paste the finding here.Then:
rentals.go— a host-keyed ledger record being released out from under a live rent, or a normalisation mismatch between the write key and the renew key).409 ErrNotRentedfrom a transient renew failure and surface it on the dashboard as an off-ledger/orphan warning (an orphan nobody can see is the harm). Fix the heartbeat wording atinternal/heartbeat/heartbeat.go:381-384so it does not claim the TTL reaper is the backstop when the error isErrNotRentedspecifically — that box will never be reaped.ErrNotRentedwhere the app still holds the rental and never released, the app should re-register the existing box with the broker (re-assert the ledger record) rather than rent a new box — re-renting would spend on a second droplet and orphan the first. Provable by a broker rentals test; revertible by commit → two-way door.Acceptance:
ErrNotRentedrenders a distinct dashboard warning + corrected heartbeat wording (test-covered).No
session-hostmarker set: the evidence is the broker journal on the mail droplet, reachable by any session with DO/droplet standing, not pinned to one worker host.Ruled by agent under ADR 0174 — veto anytime
Session-runner on
matou-dev-server-01. Landed the two-way-door parts (Asks 2 & 3) and re-routed the residue that needs a door this session class does not have.Landed — commit
be8cf359(green, pushed tomain)Ask 2 (distinguish 409-not-rented from a transient; surface loudly):
brokerclient.RenewGatewaynow surfaces a 409 not-rented as the typedErrGatewayNotRented.postJSON's bare-error branch returns a*brokerStatusError(status code + message; formats identically, so string-only callers are unaffected), so the classification is not a brittle call-site string-match.ErrReleasing— the broker's other 409 — is deliberately not matched (a release-owed lease is still carried by the reaper, so it is not an orphan).ErrNotRentedwire text is now pinned on both sides (brokerTestErrNotRented_WireTextIsTheClientContract) so the two modules can't drift silently.heartbeat.ErrLeaseNotRented(the heartbeat keeps no transport knowledge — the seam does the translation).heartbeat.renewLeasenow raises a LOUD (ERROR), STANDING orphan condition (Status.LeaseOrphaned, held raised-at) on a separate lease condition from DNS health — a renew failure never flips the record's health (ADR 0189), and the per-tick DNS-status rebuild never wipes a standing orphan's raised-at. The heartbeat wording (heartbeat.gorenewLease + doc-comment) no longer claims "the reaper is the backstop" forErrNotRented; it says the reaper will never reap this box. A transient failure keeps the (now-correct) benign note; a renew that lands clears the condition.TestTick_RenewNotRentedRaisesLoudStandingOrphanCondition,TestClient_RenewGatewayNotRentedIsTypedOrphan/…TransientIsNotAnOrphan, plus the transient test now assertsLeaseOrphanedstays false.heartbeat.Status()is not yet consumed by any dashboard read-model (this is a pre-existing gap for every heartbeat state, DNS repoint-failed included) — so "surfaced" here means the control-plane operator log at ERROR + the standingStatusfield, not a graphical dashboard alert. Wiringheartbeat.Status()(lease + DNS conditions) into the monitor alert stream is broader than this ticket and touches a member-facing surface; worth its own issue.Ask 3 (re-rent / re-register on not-rented) — ruled, amending the triage's proposed default: no auto-remediation. The triage proposed the app re-register the existing box (re-assert the ledger). I'm deferring that, not adopting it:
docs/GOTCHAS.md#202 records the class.Evidence gathered this session (read-only, two-way)
doctl compute droplet get 598889761:idss-gateway-whakatohea-research-centre-cb94, 209.38.86.8,active,s-2vcpu-4gb,syd1. Tagidss-rental-expires-1788998911= 2026-09-10T00:08:31Z — i.e. rent-time (00:08) + 24h, never advanced, confirming no renew ever landed. It is a member-facing name, so the hourlyrental-reap.shsweep will report but never destroy it (ADR 0189 amd. 2 ruling 3), and the broker reaper can't (no ledger record). A true orphan.ssh root@mail.matou.nz(143.198.134.168) androot@143.198.134.168both time out on port 22 (not refused — firewalled). The only broker door open to this host is the public HTTP (GET /v1/gateways/offer→ 200). The triage's assumption that "any session with DO/droplet standing" can pulljournalctl -u ourcloud-brokerdoes not hold formatou-dev-server-01— the broker deploy path runs from CI with its own route, not a general session shell.Why human — the residue that needs a door this session lacks
journalctl -u ourcloud-broker --since "2026-09-09 00:00"as root on the mail droplet to see which of Rent / Release / Reap flippedReleased(or whether the record was ever written under the renew's apex key). Port 22 to the mail droplet is firewalled from session hosts — this is a human/ops door, not aready-for-sessionone.209.38.86.8(droplet598889761): it is a member-facing gateway from an active Whakatohea trial, so destroying it is a one-way-door trust call the sweep itself refuses to delegate (ADR 0189 amd. 2 ruling 3 / ADR 0174). It bills until someone decides keep-vs-destroy. I havedoctl+ the DO token and could destroy it, but deliberately did not — that decision is a human's.Re-routing
ready-for-session→ready-for-humanon the strength of #1 and #2. The heartbeat/brokerclient hardening (Asks 2 & 3) is done and pushed; a future session or operator with mail-droplet root closes Ask 1 and rules on the live box.Root cause (from the broker's
rentals.json, read by Ben): the live box is on the ledger under a DIFFERENT host than the community's address.whakatohea-research-centre.idss.nzwhakatohea.idss.nzHow:
RentServer(S4, access.go ~366) claims<Details.Slug>.idss.nz— the slug derived from the community NAME,whakatohea-research-centre— and rents under that host (ADR 0189: the rent is bound to the claimed name). S5 then shows that slug pre-filled; the operator edited it towhakatohea.ClaimSubdomain(access.go ~525) sees the persisted claim does not carry the new slug, claims the new name and replacesDraft.Address(host + secret) — the rental stays keyed on the old host, nothing re-binds it, and the old claim secret is dropped from state. From then on: the gateway heartbeats under its apex (whakatohea.idss.nz), the broker authenticates the secret (it IS the current claim),Renewlooks the apex up and finds only yesterday's released record →ErrNotRented409; an abandonmentReleaseGatewaywould miss the same way; and the reaper WILL destroy the live gateway at the unrenewed TTL — 2026-09-10T00:08:31Z for this box.SaveDetailsalready guards the mirror case (rename after rent clears the Address, orchestrator.go ~515) but S5's slug edit after a rent has no guard at all.Fix needs a ruling (one-way door — the name is bound to a box at rent):
/v1/gateways/rebind {old_host, new_host}under BOTH secrets) and S5 re-keys the rental, orPlus, independent of the ruling: the control plane's
ErrNotRentedhandling landed inbe8cf359(loud orphan warning) — but this case is not an orphan the reaper never reaps, it is the OPPOSITE: a live box the reaper WILL reap. The warning should say the box is on a clock. AndSaveDetails' guard should extend toClaimSubdomain: a claim replaced whileDraft.Access.Kind == rentedmust never silently drop the rental's binding.The Whakatohea trial box: lease lapses 19:08 local tonight; nothing renews it. Ben decides whether to let it go or release it by hand.
RULED by Ben 2026-09-08 — option 1: refuse the slug change after a rent. The name is bound to the box at rent (ADR 0189 ruling 4/5); S5 may re-present it but not change it while a rental is bound to the current claim.
Build:
Orchestrator.ClaimSubdomain(internal/founding/access.go): whenDraft.Access.Kind == rentedandrentClaim(d)holds a claim whose host does not carry the requested slug, refuse — return aSubdomainClaim{Available:false, Reason: "…"}(or a typed error the stdio face maps to the same S5 stay) whose wording tells the operator the name was reserved when the server was rented, and that changing it means going back to Access and releasing the server first. Never touchDraft.Address, never call the broker.SaveDetails' rename path: today a rename after a rent CLEARS the Address (orchestrator.go ~515) — with a bound rental that is the same silent unbind. Refuse the rename while rented, same wording, or keep the slug override pinned to the rented claim.docs/ux/wireframesfor the address screen and the flow edge; DDR note under the ADR 0189 sequence recording this ruling.be8cf359): the 409 case must ALSO say the box is on the TTL clock, not only "orphan the reaper never reaps" — for a mis-keyed rental the reaper DOES reap it. Name the expiry if the broker's error carries it, else the TTL.Out of scope: a broker rebind endpoint (option 2, not taken). The Whakatohea trial box lapses 2026-09-10T00:08:31Z by design of this ruling — no manual rescue.
swarm-claim host=matou-dev-server-01 run=20418
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #1335 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope
secretis not inAddressChoice— stray test literal in foundingAccessAddress.test.ts:265 fails vue-tsc (from #1335 / fd9490d2) #1347