wizard-rent reds on a raw DO 404 from Rent's initial create/ssh-key POST — the #672 retry only covers the poll path #677

Closed
opened 2026-08-22 18:26:23 +00:00 by matou-build-agent · 2 comments

Failure. wizard-rent (the S4a rent-success leg) timed out after 480000ms waiting for [data-status="address"] (tests/e2e/journey.rented.spec.ts:173). The DOM snapshot captured at timeout (artifacts/journey.rented-.../error-context.md) shows the app had already settled into the S4a rent-error card, not the address screen:

paragraph: "provision — broker: DigitalOcean refused: Not Found: {\"id\":\"not_found\",\"message\":\"The resource you were accessing could not be found.\"}"
button "Retry"

So the broker returned a provision-stage failure with a raw DigitalOcean 404 refusal, and the test (which only asserts the success path) burned the full 8-minute timeout waiting for a status that was never coming. Run: test-results/drive-rented/20260822T181240Z, signature 3b0b824f61b8.

Evidence this is a real, unretried DO refusal (not the already-fixed poll race).

  • broker/internal/broker/rentals.go:192-199 — Rent() calls r.prov.Create(ctx, req); on error it wraps whatever Create returned as &ProvisionError{Stage: "provision", Err: createErr} with createErr passed through untouched.
  • broker/internal/broker/provider_do.go:109-146 (DigitalOcean.Create) has two call sites that return a DO error immediately, unwrapped, with no retry:
    • ensureSSHKey (line 174-196): only a 422 (duplicate key) is treated as expected; any other status, including a transient 404, returns raw (return "", err at line 193).
    • the droplet-create POST itself (line 126-129): raw, err := d.do(ctx, http.MethodPost, "/v2/droplets", body); if err != nil { return Server{}, err } — no retry at all.
  • Contrast with pollActive (provider_do.go:198-248), which does retry a transient GET 404 within its PollTries/PollInterval budget (fixed for #672, commit b4157077, documented in docs/GOTCHAS.md #54 at line 1513) and, on exhaustion, wraps the cause as "broker: DO droplet %d never became reachable in time: %w" (line 245).
  • The fault-line text captured in this run has no "never became reachable in time" wrapper — it's the bare doRefusal.Error() string ("broker: DigitalOcean refused: %s: %s", provider_do.go:291-292). That rules out the already-hardened poll path and points at the two un-retried POST call sites above.
  • docs/GOTCHAS.md #54 documents the identical raw-refusal text previously surfacing from a transient post-create read-after-write 404 on the poll GET. This run reproduces the same DO error class, but from a different, not-yet-hardened call site.

Suspected layer. broker/internal/broker/provider_do.go — DigitalOcean.Create and/or ensureSSHKey's single-shot POST calls to DigitalOcean's API, which propagate any transient refusal (including a 404) as terminal with zero retry, unlike the poll loop.

What plugging it needs — and why I filed instead of fixing. This isn't mechanical: retrying a POST that creates a resource is only safe if the create is provably idempotent, or if the retry first checks whether a droplet from this attempt already exists (otherwise a retried create-after-a-lost-response could leak a second droplet, violating the ADR 0047 no-half-rented invariant from the other direction). Deciding the right idempotency guard (e.g., name-based lookup before retry, or accepting only DO's own idempotency semantics) is a design call, and I have no way to exercise a real DO 404-on-create against this machine to verify a fix. There's also a real possibility this is a one-off DO-account issue (e.g. a stale/invalid image reference) rather than a systemic race — the run captured no broker-side log to distinguish the two, only the UI-visible fault-line text. Recommend: add broker-side structured logging of the outgoing DO call (method+path+status) around Create/ensureSSHKey so the next occurrence pins the exact call site, then decide the retry/idempotency strategy; extend provider_do_test.go (which already has TestDO_CreateRetriesTransientPollNotFound / TestDO_CreateFailsLoudWhenPollNeverRecovers for the poll path) with the equivalent pair for whichever call site turns out to be the culprit.

drive 20260822T181240Z red at wizard-rent: expect(locator).toBeVisible() failed Locator: locator('[data-status="address"]') Expected: visible Timeout: 480000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 480000ms
evidence: test-results/…/20260822T181240Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

**Failure.** `wizard-rent` (the S4a rent-success leg) timed out after 480000ms waiting for `[data-status="address"]` (`tests/e2e/journey.rented.spec.ts:173`). The DOM snapshot captured at timeout (`artifacts/journey.rented-.../error-context.md`) shows the app had already settled into the S4a **rent-error** card, not the address screen: ``` paragraph: "provision — broker: DigitalOcean refused: Not Found: {\"id\":\"not_found\",\"message\":\"The resource you were accessing could not be found.\"}" button "Retry" ``` So the broker returned a `provision`-stage failure with a raw DigitalOcean 404 refusal, and the test (which only asserts the success path) burned the full 8-minute timeout waiting for a status that was never coming. Run: `test-results/drive-rented/20260822T181240Z`, signature `3b0b824f61b8`. **Evidence this is a real, unretried DO refusal (not the already-fixed poll race).** - `broker/internal/broker/rentals.go:192-199` — `Rent()` calls `r.prov.Create(ctx, req)`; on error it wraps whatever `Create` returned as `&ProvisionError{Stage: "provision", Err: createErr}` with `createErr` passed through untouched. - `broker/internal/broker/provider_do.go:109-146` (`DigitalOcean.Create`) has two call sites that return a DO error **immediately, unwrapped, with no retry**: - `ensureSSHKey` (line 174-196): only a 422 (duplicate key) is treated as expected; any other status, including a transient 404, returns raw (`return "", err` at line 193). - the droplet-create POST itself (line 126-129): `raw, err := d.do(ctx, http.MethodPost, "/v2/droplets", body); if err != nil { return Server{}, err }` — no retry at all. - Contrast with `pollActive` (provider_do.go:198-248), which **does** retry a transient GET 404 within its `PollTries`/`PollInterval` budget (fixed for #672, commit b4157077, documented in `docs/GOTCHAS.md` #54 at line 1513) and, on exhaustion, wraps the cause as `"broker: DO droplet %d never became reachable in time: %w"` (line 245). - The fault-line text captured in this run has **no** "never became reachable in time" wrapper — it's the bare `doRefusal.Error()` string (`"broker: DigitalOcean refused: %s: %s"`, provider_do.go:291-292). That rules out the already-hardened poll path and points at the two un-retried POST call sites above. - `docs/GOTCHAS.md` #54 documents the *identical* raw-refusal text previously surfacing from a transient post-create read-after-write 404 on the poll GET. This run reproduces the same DO error class, but from a different, not-yet-hardened call site. **Suspected layer.** `broker/internal/broker/provider_do.go` — `DigitalOcean.Create` and/or `ensureSSHKey`'s single-shot POST calls to DigitalOcean's API, which propagate any transient refusal (including a 404) as terminal with zero retry, unlike the poll loop. **What plugging it needs — and why I filed instead of fixing.** This isn't mechanical: retrying a POST that *creates* a resource is only safe if the create is provably idempotent, or if the retry first checks whether a droplet from this attempt already exists (otherwise a retried create-after-a-lost-response could leak a second droplet, violating the ADR 0047 no-half-rented invariant from the other direction). Deciding the right idempotency guard (e.g., name-based lookup before retry, or accepting only DO's own idempotency semantics) is a design call, and I have no way to exercise a real DO 404-on-create against this machine to verify a fix. There's also a real possibility this is a one-off DO-account issue (e.g. a stale/invalid image reference) rather than a systemic race — the run captured no broker-side log to distinguish the two, only the UI-visible fault-line text. Recommend: add broker-side structured logging of the outgoing DO call (method+path+status) around `Create`/`ensureSSHKey` so the next occurrence pins the exact call site, then decide the retry/idempotency strategy; extend `provider_do_test.go` (which already has `TestDO_CreateRetriesTransientPollNotFound` / `TestDO_CreateFailsLoudWhenPollNeverRecovers` for the poll path) with the equivalent pair for whichever call site turns out to be the culprit. drive `20260822T181240Z` red at `wizard-rent`: `expect(locator).toBeVisible() failed Locator: locator('[data-status="address"]') Expected: visible Timeout: 480000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 480000ms ` evidence: `test-results/…/20260822T181240Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 3b0b824f61b8 -->
Author
Member

Ruled by agent under ADR 0174 — veto anytime.

Investigated both un-retried POST call sites #672 left open in
DigitalOcean.Create (broker/internal/broker/provider_do.go):
ensureSSHKey's POST /v2/account/keys and the droplet POST /v2/droplets
itself. They are NOT equally safe to retry:

  • ensureSSHKey's POST is provably idempotent independent of DO's
    response
    — the fingerprint is computed locally from the key blob, and a
    real duplicate always 422s (already handled), retried or not. Retrying it
    on any other error carries zero risk of creating two different identities.
    Fixed: retries up to sshKeyPostRetries (3, fixed) spaced by the
    existing PollInterval, mirroring #672/#54's pattern on the poll GET.
  • The droplet-create POST is NOT provably safe to retry blind — if the
    first POST actually succeeded but the response was lost, a naive retry
    creates a SECOND droplet (ADR 0047 no-half-rented, from the other
    direction). This needs a name/tag-based existence check (or DO's own
    idempotency semantics) before a retry can be trusted, which is a design
    call best made against real evidence, not guessed at. Left unruled,
    filed as #678
    (needs-info — not actionable until the next occurrence's
    new logging pins it as the culprit).

What proves the ruling: revertible by commit; the ssh-key retry is
proved by two new TDD tests (TestDO_EnsureSSHKeyRetriesTransientPostNotFound,
TestDO_EnsureSSHKeyFailsLoudWhenPostNeverRecovers), and the new
method/path/status logging (TestDO_DoLogsRefusalMethodPathStatus) is what
lets #678 actually be actionable next time instead of another round of
wrapper-text elimination. go build/vet/test ./... green in the broker
module. GOTCHAS #55 records both halves — what's fixed and what's
deliberately still open, and why.

Landing this now.

**Ruled by agent under ADR 0174 — veto anytime.** Investigated both un-retried POST call sites #672 left open in `DigitalOcean.Create` (`broker/internal/broker/provider_do.go`): `ensureSSHKey`'s `POST /v2/account/keys` and the droplet `POST /v2/droplets` itself. They are NOT equally safe to retry: - **`ensureSSHKey`'s POST is provably idempotent independent of DO's response** — the fingerprint is computed locally from the key blob, and a real duplicate always 422s (already handled), retried or not. Retrying it on any other error carries zero risk of creating two different identities. **Fixed**: retries up to `sshKeyPostRetries` (3, fixed) spaced by the existing `PollInterval`, mirroring #672/#54's pattern on the poll GET. - **The droplet-create POST is NOT provably safe to retry blind** — if the first POST actually succeeded but the response was lost, a naive retry creates a SECOND droplet (ADR 0047 no-half-rented, from the other direction). This needs a name/tag-based existence check (or DO's own idempotency semantics) before a retry can be trusted, which is a design call best made against real evidence, not guessed at. **Left unruled, filed as #678** (`needs-info` — not actionable until the next occurrence's new logging pins it as the culprit). **What proves the ruling:** revertible by commit; the ssh-key retry is proved by two new TDD tests (`TestDO_EnsureSSHKeyRetriesTransientPostNotFound`, `TestDO_EnsureSSHKeyFailsLoudWhenPostNeverRecovers`), and the new method/path/status logging (`TestDO_DoLogsRefusalMethodPathStatus`) is what lets #678 actually be actionable next time instead of another round of wrapper-text elimination. `go build/vet/test ./...` green in the broker module. GOTCHAS #55 records both halves — what's fixed and what's deliberately still open, and why. Landing this now.
Author
Member

Close-report.

Landed: e9df8863 (advances #677, pushed to main).

  • DigitalOcean.ensureSSHKey's POST /v2/account/keys now retries a
    transient refusal (any status but the already-handled 422 duplicate) up to
    sshKeyPostRetries (3, fixed), spaced by the existing PollInterval. Safe
    by construction: the fingerprint used for the droplet create is computed
    locally from the key blob, never from DO's response, so a retried POST
    either succeeds or hits the same 422-duplicate path already handled — no
    risk of registering two different identities.
  • DigitalOcean.do now logs method/path/status at Info on every
    non-2xx DO response, so a future raw-refusal fault-line can be pinned to
    its exact outgoing call (ssh-key POST vs droplet-create POST vs a poll
    GET) directly from the broker's own log, instead of the wrapper-text
    elimination this investigation needed.
  • The droplet-create POST /v2/droplets itself is deliberately left
    un-retried
    — blindly retrying it risks a second real droplet if the
    first response was merely lost (ADR 0047 no-half-rented, from the other
    direction). That needs a name/tag-based existence-check guard (or DO's
    own idempotency semantics), designed against real evidence rather than
    guessed at now. Filed as #678 (needs-info, gated on the next
    occurrence's new logging naming /v2/droplets as the culprit).

Proof: go build/vet/test ./... green in the broker module (TDD
red-first: TestDO_EnsureSSHKeyRetriesTransientPostNotFound,
TestDO_EnsureSSHKeyFailsLoudWhenPostNeverRecovers,
TestDO_DoLogsRefusalMethodPathStatus). golangci-lint hit a pre-existing
toolchain-version typecheck failure in zone_test.go / a vendored crypto
file (go1.26 vs this sandbox's go1.23) — confirmed via git stash to
predate this change, not introduced by it. Live re-proof of the specific
red drive needs a broker binary redeploy + a fresh rented drive (this
session has no way to force a live DO 404-on-create on demand, same
limitation the filer noted); the next cron-triggered rented-target drive
that hits either POST is the live proof — and now, either it stays green
(ensureSSHKey rode out the transient) or its new log line pins /v2/droplets
unambiguously, making #678 immediately actionable.

Ruling: see the ADR 0174 ruling comment above. docs/GOTCHAS.md #55
records both halves.

Closing #677 — its own filed recommendation (structured logging, then decide
retry strategy per call site) is fully executed for the call site that was
safely decidable now; the other half continues as #678.

**Close-report.** **Landed:** `e9df8863` (advances #677, pushed to `main`). - `DigitalOcean.ensureSSHKey`'s `POST /v2/account/keys` now retries a transient refusal (any status but the already-handled 422 duplicate) up to `sshKeyPostRetries` (3, fixed), spaced by the existing `PollInterval`. Safe by construction: the fingerprint used for the droplet create is computed **locally** from the key blob, never from DO's response, so a retried POST either succeeds or hits the same 422-duplicate path already handled — no risk of registering two different identities. - `DigitalOcean.do` now logs `method`/`path`/`status` at Info on every non-2xx DO response, so a future raw-refusal fault-line can be pinned to its exact outgoing call (ssh-key POST vs droplet-create POST vs a poll GET) directly from the broker's own log, instead of the wrapper-text elimination this investigation needed. - The droplet-create `POST /v2/droplets` itself is **deliberately left un-retried** — blindly retrying it risks a second real droplet if the first response was merely lost (ADR 0047 no-half-rented, from the other direction). That needs a name/tag-based existence-check guard (or DO's own idempotency semantics), designed against real evidence rather than guessed at now. Filed as **#678** (`needs-info`, gated on the next occurrence's new logging naming `/v2/droplets` as the culprit). **Proof:** `go build/vet/test ./...` green in the broker module (TDD red-first: `TestDO_EnsureSSHKeyRetriesTransientPostNotFound`, `TestDO_EnsureSSHKeyFailsLoudWhenPostNeverRecovers`, `TestDO_DoLogsRefusalMethodPathStatus`). `golangci-lint` hit a pre-existing toolchain-version typecheck failure in `zone_test.go` / a vendored crypto file (go1.26 vs this sandbox's go1.23) — confirmed via `git stash` to predate this change, not introduced by it. Live re-proof of the *specific* red drive needs a broker binary redeploy + a fresh `rented` drive (this session has no way to force a live DO 404-on-create on demand, same limitation the filer noted); the next cron-triggered `rented`-target drive that hits either POST is the live proof — and now, either it stays green (ensureSSHKey rode out the transient) or its new log line pins `/v2/droplets` unambiguously, making #678 immediately actionable. **Ruling:** see the ADR 0174 ruling comment above. `docs/GOTCHAS.md` #55 records both halves. Closing #677 — its own filed recommendation (structured logging, then decide retry strategy per call site) is fully executed for the call site that was safely decidable now; the other half continues as #678.
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#677
No description provided.