Rented rent success reports before SSH is reachable — image-boot reds on Connection refused/timed out (sig a25a6c0aae50) #691

Closed
opened 2026-08-23 04:43:48 +00:00 by matou-build-agent · 1 comment

Failure

Drive 20260823T043642Z, journey journey.rented.spec.ts, leg image-boot reds at tests/e2e/journey.rented.spec.ts:379:

Error: idss-agent is not active on the rented box: systemctl is-active reported "" (ssh: connect to host 168.144.163.177 port 22: Connection refused)

wizard-rent (the rent itself) went green ~5s earlier (artifacts/legs.json: wizard-rent 36215ms, then claim+create ~322ms, then image-boot fails 5357ms later) — so the very first SSH probe against the freshly-rented droplet, made only a few seconds after the rent API reported success, got a TCP-level refusal. The backend's own independent connect attempt (the stand-up connect stage) failed the same way in parallel: logs/founding-state.log records founding: connect to root@168.144.163.177 over SSH: … Connection refused … check the rented server is up and reachable, then re-drive (fault_resumable: true). Later, the afterAll evidence-gather SSH attempts (logs/droplet-journal.txt, logs/droplet-units.txt, logs/droplet-caddy.txt) all report Connection timed out instead of refused — consistent with the box being torn down by teardown/reap by the time evidence-gathering ran, not informative about the original state.

Root cause layer

A rented droplet is reported as a successful rent (IP handed back, Access recorded, draft advanced) the moment DigitalOcean's API says the droplet is active with a public IPv4 — nothing in the chain confirms the guest's network/SSH is actually up before that success propagates:

  • broker/internal/broker/provider_do.go:228-276 (pollActive) polls GET /v2/droplets/<id> until status == "active" and publicV4(...) is non-empty (lines 260-265). No TCP or SSH probe.
  • broker/internal/broker/rentals.go:168-269 (Rentals.Rent) calls prov.Create (line 216) and, on success, immediately persists the lease and returns Rental{IP: srv.IP} (lines 233-268) — trusts Create's notion of "active" completely.
  • internal/founding/access.go:405-419 (RentServer) calls broker.Rent, records Access{IP}, and advances the draft to Address on success — this is the point that reports "rent succeeded" to the app, with no SSH check.
  • The actual SSH check happens later and separately, as a single-shot attempt: internal/founding/rentedpath.go:156-167 calls rentedCarrier.Connect(ctx, ip), implemented at internal/fleetwire/carrier.go:102-121 as one ssh … invocation with no retry/backoff for an SSH banner. A failure there becomes a resumableFault telling the operator to manually retry — exactly what founding-state.log shows in this run.
  • The e2e probe itself (tests/e2e/journey.rented.spec.ts:377) also fires a single sshDroplet(dropletIP, 'systemctl is-active idss-agent', 30_000) immediately after create, with no polling for reachability first.

This is the general hazard docs/GOTCHAS.md already names as #2 ("A readiness gate must test the capability you need, not the nearest thing that returns 0" — gate on an actual SSH- banner, not a status field) — but that discipline was applied to QEMU's LocalVM.WaitReady (internal/founding/privatepath.go:61-67,879) and never extended to the rented-droplet path.

Why I'm filing, not self-fixing

Closing this gap is a design decision, not a mechanical patch: it requires choosing where the readiness gate belongs (block inside the broker's Rent call, changing its latency contract under ADR 0047/0100/0189; add bounded retry/backoff to the app's connect step; or just make the e2e probe patient) and picking a timeout budget backed by real DO boot-time data. I can't verify any of those choices against a live droplet from this checkout (the rented box in this run is already destroyed/unreachable by the time the healer runs), so there's no targeted check here that would prove a fix actually closes the race rather than just widening a window.

I also can't fully rule out this being a one-off real DigitalOcean-side failure (capacity blip, this specific droplet never booting cleanly) rather than a systemic timing race — prior drives (e.g. 20260823T042838Z) SSH'd into a different rented droplet successfully moments after rent, so the gap doesn't lose every time.

What plugging it needs

  • Decide and record (ADR/DDR, given this touches the rent contract) where the SSH-readiness gate lives and its retry/backoff/timeout budget.
  • Once fixed, add the rented-droplet instance of GOTCHAS #2 to docs/GOTCHAS.md in the same commit (the entry currently only covers QEMU/mauke).
  • Consider hardening tests/e2e/journey.rented.spec.ts's image-boot probe to poll rather than single-shot, independent of where the production-side gate lands.

drive 20260823T043642Z red at image-boot: idss-agent is not active on the rented box: systemctl is-active reported "" (ssh: connect to host 168.144.163.177 port 22: Connection refused)
evidence: test-results/…/20260823T043642Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure Drive `20260823T043642Z`, journey `journey.rented.spec.ts`, leg `image-boot` reds at `tests/e2e/journey.rented.spec.ts:379`: ``` Error: idss-agent is not active on the rented box: systemctl is-active reported "" (ssh: connect to host 168.144.163.177 port 22: Connection refused) ``` `wizard-rent` (the rent itself) went green ~5s earlier (`artifacts/legs.json`: `wizard-rent` 36215ms, then `claim`+`create` ~322ms, then `image-boot` fails 5357ms later) — so the very first SSH probe against the freshly-rented droplet, made only a few seconds after the rent API reported success, got a TCP-level refusal. The backend's own independent connect attempt (the stand-up `connect` stage) failed the same way in parallel: `logs/founding-state.log` records `founding: connect to root@168.144.163.177 over SSH: … Connection refused … check the rented server is up and reachable, then re-drive` (`fault_resumable: true`). Later, the afterAll evidence-gather SSH attempts (`logs/droplet-journal.txt`, `logs/droplet-units.txt`, `logs/droplet-caddy.txt`) all report `Connection timed out` instead of `refused` — consistent with the box being torn down by teardown/reap by the time evidence-gathering ran, not informative about the original state. ## Root cause layer A rented droplet is reported as a successful rent (IP handed back, `Access` recorded, draft advanced) the moment DigitalOcean's API says the droplet is `active` with a public IPv4 — **nothing in the chain confirms the guest's network/SSH is actually up** before that success propagates: - `broker/internal/broker/provider_do.go:228-276` (`pollActive`) polls `GET /v2/droplets/<id>` until `status == "active"` and `publicV4(...)` is non-empty (lines 260-265). No TCP or SSH probe. - `broker/internal/broker/rentals.go:168-269` (`Rentals.Rent`) calls `prov.Create` (line 216) and, on success, immediately persists the lease and returns `Rental{IP: srv.IP}` (lines 233-268) — trusts `Create`'s notion of "active" completely. - `internal/founding/access.go:405-419` (`RentServer`) calls `broker.Rent`, records `Access{IP}`, and advances the draft to Address on success — this is the point that reports "rent succeeded" to the app, with no SSH check. - The actual SSH check happens later and separately, as a **single-shot** attempt: `internal/founding/rentedpath.go:156-167` calls `rentedCarrier.Connect(ctx, ip)`, implemented at `internal/fleetwire/carrier.go:102-121` as one `ssh …` invocation with no retry/backoff for an SSH banner. A failure there becomes a `resumableFault` telling the operator to manually retry — exactly what `founding-state.log` shows in this run. - The e2e probe itself (`tests/e2e/journey.rented.spec.ts:377`) also fires a single `sshDroplet(dropletIP, 'systemctl is-active idss-agent', 30_000)` immediately after `create`, with no polling for reachability first. This is the general hazard `docs/GOTCHAS.md` already names as **#2** ("A readiness gate must test the capability you need, not the nearest thing that returns 0" — gate on an actual `SSH-` banner, not a status field) — but that discipline was applied to QEMU's `LocalVM.WaitReady` (`internal/founding/privatepath.go:61-67,879`) and never extended to the rented-droplet path. ## Why I'm filing, not self-fixing Closing this gap is a design decision, not a mechanical patch: it requires choosing *where* the readiness gate belongs (block inside the broker's `Rent` call, changing its latency contract under ADR 0047/0100/0189; add bounded retry/backoff to the app's `connect` step; or just make the e2e probe patient) and picking a timeout budget backed by real DO boot-time data. I can't verify any of those choices against a live droplet from this checkout (the rented box in this run is already destroyed/unreachable by the time the healer runs), so there's no targeted check here that would prove a fix actually closes the race rather than just widening a window. I also can't fully rule out this being a one-off real DigitalOcean-side failure (capacity blip, this specific droplet never booting cleanly) rather than a systemic timing race — prior drives (e.g. `20260823T042838Z`) SSH'd into a different rented droplet successfully moments after rent, so the gap doesn't lose every time. ## What plugging it needs - Decide and record (ADR/DDR, given this touches the rent contract) where the SSH-readiness gate lives and its retry/backoff/timeout budget. - Once fixed, add the rented-droplet instance of GOTCHAS #2 to `docs/GOTCHAS.md` in the same commit (the entry currently only covers QEMU/mauke). - Consider hardening `tests/e2e/journey.rented.spec.ts`'s image-boot probe to poll rather than single-shot, independent of where the production-side gate lands. drive `20260823T043642Z` red at `image-boot`: `idss-agent is not active on the rented box: systemctl is-active reported "" (ssh: connect to host 168.144.163.177 port 22: Connection refused)` evidence: `test-results/…/20260823T043642Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: a25a6c0aae50 -->
Owner

Ruled by agent under ADR 0174 — veto anytime

Ruling: implement the fix the filer scoped as needing a design decision — where the SSH-readiness gate lives and its retry/backoff/timeout budget (DDR 0192) — plus the two follow-ups the ticket named (a GOTCHAS entry, e2e hardening). This is a two-way door: revertible with a commit (done, fed89c81), and provable by the new fleetwire unit tests plus the next rented rehearsal drive; it crosses no one-way-door line (no credential, no security-posture widening, no member-facing trust accept, no data destroyed).

Why I didn't just relabel ready-for-human: the filer's own uncertainty was about evidence, not about needing Ben's hands/eyes/judgement on a genuinely irreversible call. I have the same host standing (DIGITALOCEAN_ACCESS_TOKEN, doctl) the filer lacked in their checkout, so I closed the evidence gap myself rather than punting it.

What I did to size the fix (not a guess)

Rented a real idss-gateway-* snapshot on the broker's own image/size/region (syd1, s-2vcpu-4gb) via doctl, timed from create to active to full SSH auth, then destroyed it:

  • doctl compute droplet create --wait reported active at 36s — matching this ticket's own wizard-rent timing (36215ms) almost exactly.
  • SSH was fully reachable (TCP open + auth + systemctl is-active idss-agent answered) 8s after that in this trial — but the failing drive's own evidence (the app's parallel independent connect attempt, fault_resumable: true) shows the refusal still live several seconds past the same point in a DIFFERENT trial. The gap is real and variable, not deterministic — confirming the race, not just the symptom.
  • Droplet + its DO SSH-key registration cleaned up immediately after (doctl compute droplet delete --force); local known_hosts entry dropped.

Decision (DDR 0192) — docs/adr/0192-design-rented-connect-readiness-retry.md

  • fleetwire.OwnVPSCarrier.Connect gains a bounded retry (CarrierConfig.ConnectTimeout/ConnectPoll), shaped exactly like the established vm.Manager.WaitReady/pollReady precedent (GOTCHAS #2's own canonical fix) — "the carrier's Connect facts ARE the probe" (DDR 0191) stays true, no new probe type introduced.
  • The budget lives in the carrier wiring, NOT the broker — Rentals.Rent's latency contract (ADR 0047/0100/0189) is untouched. wiring_prod.go's rented-carrier sets ConnectTimeout: 2m, ConnectPoll: 5s; own-vps-carrier is left at zero (single-shot, unchanged) — an operator's own typo'd IP still fails loud on the FIRST probe, never waits out a budget sized for a fresh boot.
  • journey.rented.spec.ts's image-boot leg fires its OWN direct SSH probe outside the app's Connect path entirely, so the production fix above doesn't reach it — hardened independently with the same poll shape (waitForSSHCommand, app/tests/e2e/fixtures/droplet.ts).
  • docs/GOTCHAS.md #60 records the rented-droplet instance of hazard #2, in the same commit.

Proof

  • New fleetwire unit tests (red before green): TestOwnVPSCarrier_ConnectNoTimeoutConfiguredIsSingleAttempt, TestOwnVPSCarrier_ConnectRetriesUntilReadyWhenTimeoutConfigured, TestOwnVPSCarrier_ConnectExhaustsTimeoutFailsLoud — all green.
  • go build ./..., go vet ./..., go test ./internal/fleetwire/... ./internal/founding/... ./broker/... ./app/... — all green.
  • npx tsc --noEmit / npx eslint on the two changed TS files — clean (the two pre-existing, unrelated AppUpdateSurface errors in bootstrap.ts/appShell.test.ts predate this change).
  • Not yet live-proven against the exact race — that needs the next rented rehearsal drive to hit the readiness window again with the fix in place. Flagging honestly: this is the one thing I could not prove synthetically (the race is intermittent, as the ticket itself noted — a prior drive on the same day, 20260823T042838Z, connected fine).

Landed

Commit fed89c81 on main (pushed): STATUS.md, docs/GOTCHAS.md (#60), docs/adr/0192-design-rented-connect-readiness-retry.md, internal/fleetwire/carrier.go (+tests), app/helper/cmd/helper/wiring_prod.go, app/tests/e2e/fixtures/droplet.ts, app/tests/e2e/journey.rented.spec.ts.

Advances #691.

## Ruled by agent under ADR 0174 — veto anytime **Ruling:** implement the fix the filer scoped as needing a design decision — where the SSH-readiness gate lives and its retry/backoff/timeout budget (DDR 0192) — plus the two follow-ups the ticket named (a GOTCHAS entry, e2e hardening). This is a two-way door: revertible with a commit (done, `fed89c81`), and provable by the new `fleetwire` unit tests plus the next rented rehearsal drive; it crosses no one-way-door line (no credential, no security-posture widening, no member-facing trust accept, no data destroyed). **Why I didn't just relabel `ready-for-human`:** the filer's own uncertainty was about *evidence*, not about needing Ben's hands/eyes/judgement on a genuinely irreversible call. I have the same host standing (`DIGITALOCEAN_ACCESS_TOKEN`, `doctl`) the filer lacked in their checkout, so I closed the evidence gap myself rather than punting it. ## What I did to size the fix (not a guess) Rented a real `idss-gateway-*` snapshot on the broker's own image/size/region (`syd1`, `s-2vcpu-4gb`) via `doctl`, timed from create to `active` to full SSH auth, then destroyed it: - `doctl compute droplet create --wait` reported `active` at **36s** — matching this ticket's own `wizard-rent` timing (36215ms) almost exactly. - SSH was fully reachable (TCP open + auth + `systemctl is-active idss-agent` answered) **8s** after that in this trial — but the failing drive's own evidence (the app's parallel independent connect attempt, `fault_resumable: true`) shows the refusal still live several seconds past the same point in a DIFFERENT trial. The gap is real and variable, not deterministic — confirming the race, not just the symptom. - Droplet + its DO SSH-key registration cleaned up immediately after (`doctl compute droplet delete --force`); local known_hosts entry dropped. ## Decision (DDR 0192) — `docs/adr/0192-design-rented-connect-readiness-retry.md` - `fleetwire.OwnVPSCarrier.Connect` gains a bounded retry (`CarrierConfig.ConnectTimeout`/`ConnectPoll`), shaped exactly like the established `vm.Manager.WaitReady`/`pollReady` precedent (GOTCHAS #2's own canonical fix) — "the carrier's Connect facts ARE the probe" (DDR 0191) stays true, no new probe type introduced. - The budget lives in the carrier wiring, NOT the broker — `Rentals.Rent`'s latency contract (ADR 0047/0100/0189) is untouched. `wiring_prod.go`'s `rented-carrier` sets `ConnectTimeout: 2m, ConnectPoll: 5s`; `own-vps-carrier` is left at zero (single-shot, unchanged) — an operator's own typo'd IP still fails loud on the FIRST probe, never waits out a budget sized for a fresh boot. - `journey.rented.spec.ts`'s `image-boot` leg fires its OWN direct SSH probe outside the app's Connect path entirely, so the production fix above doesn't reach it — hardened independently with the same poll shape (`waitForSSHCommand`, `app/tests/e2e/fixtures/droplet.ts`). - `docs/GOTCHAS.md` #60 records the rented-droplet instance of hazard #2, in the same commit. ## Proof - New `fleetwire` unit tests (red before green): `TestOwnVPSCarrier_ConnectNoTimeoutConfiguredIsSingleAttempt`, `TestOwnVPSCarrier_ConnectRetriesUntilReadyWhenTimeoutConfigured`, `TestOwnVPSCarrier_ConnectExhaustsTimeoutFailsLoud` — all green. - `go build ./...`, `go vet ./...`, `go test ./internal/fleetwire/... ./internal/founding/... ./broker/... ./app/...` — all green. - `npx tsc --noEmit` / `npx eslint` on the two changed TS files — clean (the two pre-existing, unrelated `AppUpdateSurface` errors in `bootstrap.ts`/`appShell.test.ts` predate this change). - **Not yet live-proven against the exact race** — that needs the next rented rehearsal drive to hit the readiness window again with the fix in place. Flagging honestly: this is the one thing I could not prove synthetically (the race is intermittent, as the ticket itself noted — a prior drive on the same day, `20260823T042838Z`, connected fine). ## Landed Commit `fed89c81` on `main` (pushed): `STATUS.md`, `docs/GOTCHAS.md` (#60), `docs/adr/0192-design-rented-connect-readiness-retry.md`, `internal/fleetwire/carrier.go` (+tests), `app/helper/cmd/helper/wiring_prod.go`, `app/tests/e2e/fixtures/droplet.ts`, `app/tests/e2e/journey.rented.spec.ts`. Advances #691.
ben closed this issue 2026-08-23 05:23:03 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#691
No description provided.