DO droplet-create POST needs a provably-safe retry guard once the next raw-404 pins it as the culprit (follow-up to #677) #678

Open
opened 2026-08-22 18:49:51 +00:00 by matou-build-agent · 2 comments

Follow-up from #677. #677 fixed the half of the un-retried-POST gap that
was safe to fix blind: ensureSSHKey's POST /v2/account/keys now retries a
transient refusal (its fingerprint is computed locally, so a real duplicate
always 422s — retry is idempotent by construction). It deliberately did NOT
touch the other call site, DigitalOcean.Create's POST /v2/droplets
(broker/internal/broker/provider_do.go:126), because blindly retrying a
create is not provably safe: if the first POST actually succeeded but its
response was lost, a naive retry creates a second droplet — an ADR 0047
no-half-rented violation from the other direction.

What this needs. #677 also added structured logging: DigitalOcean.do
now logs method/path/status at Info on every non-2xx DO response
(provider_do.go). The next time a rehearsal drive reds with a raw,
un-retried DO refusal on wizard-rent (or any rent path), that log will name
the exact call site instead of requiring elimination-by-wrapper-text like
#677's own investigation had to do. This ticket is not actionable until
that evidence exists
— hence needs-info, not ready-for-agent /
ready-for-session.

Once the evidence pins /v2/droplets as the culprit, the fix needs a
guard that makes retry provably safe, e.g.:

  • before retrying, list droplets by the idss-gateway/idss-rental tags
    (GET /v2/droplets?tag_name=...) and match on the request's own generated
    Name (idss-gateway-<slug>-<rand4>, unique per rent) — if found, the
    first POST DID land; use that droplet instead of retrying. If not found,
    retry is safe.
  • or confirm whether DigitalOcean's droplet-create endpoint supports an
    idempotency-key header and use that instead of a lookup.

Note for whoever picks this up: the session-runner host env DOES carry
DIGITALOCEAN_ACCESS_TOKEN + doctl — a real (low-cost, reversible) droplet
create/list/destroy cycle can verify the tag+name lookup shape against the
live API before trusting it in the retry guard, without needing to force a
live 404-on-create (which stays unreproducible on demand). Extend
provider_do_test.go with the equivalent pair #677 added for the ssh-key
path (TestDO_Create...RetriesTransient...NotFound /
...FailsLoudWhenPostNeverRecovers) once the guard is designed.

Proposed default ruling (ADR 0174 rule 4): once real evidence names
/v2/droplets as the culprit and the tag+name lookup is verified live, this
is a two-way door (revertible by commit, provable by the httptest suite plus
one live verification of the lookup shape) — an agent session may rule and
implement it without Ben, same as #677.


Ruled: DEFERRED (agent triage, ADR 0174 — 2026-09-03)

The needs-info evidence gate on this ticket has been answered, and the
answer reroutes the work rather than actioning this ticket's original fix:

  • The only blocker, #681 (broker-log capture), is closed — create-path
    DO refusals now reach the run directory.
  • The successor #1178 captured the first real POST /v2/droplets red and it
    was ruled + fixed (commit 0fc29770): a read-after-write on the SSH key,
    fixed by confirm-gating the key write (ensureSSHKey polls
    GET /v2/account/keys/{fp} until it resolves). It added no retry to the
    create POST — the ADR 0047 / #682 fence stays intact, now guarded by
    TestDO_CreatePostIsNeverRetried.
  • Every create-POST refusal observed to date (#680 = 404 not_found,
    #1178 = 422 invalid-key) is a deterministic read-after-write, addressed by
    gating the dependency writes — never the transient / lost-response 5xx this
    ticket's retry-guard is scoped to.

So this ticket's specific hazard — a blind retry of POST /v2/droplets
double-creating a droplet after a lost success response — targets a failure mode
that has never occurred and that the codebase has deliberately fenced off
(ADR 0047 / #682: the create POST must stay un-retried). It is neither rejected
(a genuine transient create failure would revive it) nor actionable now.

Revisit criteria (remove deferred, relabel for the pipeline when any fires)

  1. A rehearsal drive reds with a transient 5xx / connection-reset (not a
    4xx read-after-write) on POST /v2/droplets, captured in the now-harvested
    broker log — i.e. a create refusal a retry would actually recover.
  2. DigitalOcean ships an idempotency-key on POST /v2/droplets, making a
    provably-safe create retry possible without the tag+name lookup.

Two-way door: revertible by relabel/reopen; provable by the closed #681, the
#1178 ruling + 0fc29770, and TestDO_CreatePostIsNeverRetried. Not on the
one-way-door list. Veto anytime. priority dropped: the live rehearsal blocker
is #1178 (owned/fixed); this parked defensive follow-up should not sit at the
swarm-queue head.

**Follow-up from #677.** #677 fixed the half of the un-retried-POST gap that was safe to fix blind: `ensureSSHKey`'s `POST /v2/account/keys` now retries a transient refusal (its fingerprint is computed locally, so a real duplicate always 422s — retry is idempotent by construction). It deliberately did NOT touch the other call site, `DigitalOcean.Create`'s `POST /v2/droplets` (`broker/internal/broker/provider_do.go:126`), because blindly retrying a create is not provably safe: if the first POST actually succeeded but its response was lost, a naive retry creates a **second** droplet — an ADR 0047 no-half-rented violation from the other direction. **What this needs.** #677 also added structured logging: `DigitalOcean.do` now logs `method`/`path`/`status` at Info on every non-2xx DO response (`provider_do.go`). The next time a rehearsal drive reds with a raw, un-retried DO refusal on `wizard-rent` (or any rent path), that log will name the exact call site instead of requiring elimination-by-wrapper-text like #677's own investigation had to do. **This ticket is not actionable until that evidence exists** — hence `needs-info`, not `ready-for-agent` / `ready-for-session`. **Once the evidence pins `/v2/droplets` as the culprit**, the fix needs a guard that makes retry provably safe, e.g.: - before retrying, list droplets by the `idss-gateway`/`idss-rental` tags (`GET /v2/droplets?tag_name=...`) and match on the request's own generated `Name` (`idss-gateway-<slug>-<rand4>`, unique per rent) — if found, the first POST DID land; use that droplet instead of retrying. If not found, retry is safe. - or confirm whether DigitalOcean's droplet-create endpoint supports an idempotency-key header and use that instead of a lookup. **Note for whoever picks this up:** the session-runner host env DOES carry `DIGITALOCEAN_ACCESS_TOKEN` + `doctl` — a real (low-cost, reversible) droplet create/list/destroy cycle can verify the tag+name lookup shape against the live API before trusting it in the retry guard, without needing to force a live 404-on-create (which stays unreproducible on demand). Extend `provider_do_test.go` with the equivalent pair #677 added for the ssh-key path (`TestDO_Create...RetriesTransient...NotFound` / `...FailsLoudWhenPostNeverRecovers`) once the guard is designed. **Proposed default ruling (ADR 0174 rule 4):** once real evidence names `/v2/droplets` as the culprit and the tag+name lookup is verified live, this is a two-way door (revertible by commit, provable by the httptest suite plus one live verification of the lookup shape) — an agent session may rule and implement it without Ben, same as #677. --- ## Ruled: DEFERRED (agent triage, ADR 0174 — 2026-09-03) The `needs-info` evidence gate on this ticket has been **answered**, and the answer reroutes the work rather than actioning this ticket's original fix: - The only blocker, **#681** (broker-log capture), is **closed** — create-path DO refusals now reach the run directory. - The successor **#1178** captured the first real `POST /v2/droplets` red and it was ruled + fixed (commit `0fc29770`): a **read-after-write on the SSH key**, fixed by **confirm-gating the key write** (`ensureSSHKey` polls `GET /v2/account/keys/{fp}` until it resolves). It added **no retry** to the create POST — the ADR 0047 / #682 fence stays intact, now guarded by `TestDO_CreatePostIsNeverRetried`. - Every create-POST refusal observed to date (#680 = 404 `not_found`, #1178 = 422 invalid-key) is a **deterministic read-after-write**, addressed by gating the *dependency writes* — never the transient / lost-response 5xx this ticket's retry-guard is scoped to. So this ticket's specific hazard — a blind retry of `POST /v2/droplets` double-creating a droplet after a lost success response — targets a failure mode that **has never occurred** and that the codebase has **deliberately fenced off** (ADR 0047 / #682: the create POST must stay un-retried). It is neither rejected (a genuine transient create failure would revive it) nor actionable now. ### Revisit criteria (remove `deferred`, relabel for the pipeline when any fires) 1. A rehearsal drive reds with a **transient 5xx / connection-reset** (not a 4xx read-after-write) on `POST /v2/droplets`, captured in the now-harvested broker log — i.e. a create refusal a retry would actually recover. 2. DigitalOcean ships an **idempotency-key** on `POST /v2/droplets`, making a provably-safe create retry possible without the tag+name lookup. Two-way door: revertible by relabel/reopen; provable by the closed #681, the #1178 ruling + `0fc29770`, and `TestDO_CreatePostIsNeverRetried`. Not on the one-way-door list. Veto anytime. `priority` dropped: the live rehearsal blocker is #1178 (owned/fixed); this parked defensive follow-up should not sit at the swarm-queue head.
Author
Member

Recurrence corroboration (#680, drive 20260822T185236Z, same sig
3b0b824f61b8 as this ticket's original).

wizard-rent reddened at the identical fault-line — S4a settled on a raw
broker: DigitalOcean refused: Not Found: {"id":"not_found",...} before
[data-status="address"] ever appeared; rent-fails-clean (fault
injection) stayed green; artifacts/journey.json again shows {"rows": null, "fault": null} (create never got far enough to found a droplet).

Still not actionable. This run's logs/ carries no broker-process
output at all — every logs/guest-*.log is empty or a local-connection
failure, consistent with no droplet ever existing to harvest from, but
there's no d.do method/path/status line anywhere in the run directory
either. So this recurrence still can't say whether it hit the un-retried
/v2/droplets POST or ensureSSHKey exhausting its new 3-retry budget
(#677) on an unusually long blip — the evidence this ticket is gated on
does not exist for this occurrence, for the same reason it didn't exist
before #677 landed the logging: the broker's own log never reaches the
run directory
(it's a remote systemd service, not something the drive
harness spawns/captures). Filed #681 to close that specific gap, with
the exact SSH/journalctl harvest pattern (scripts/lib/rehearsal-droplet.sh :341-345) already used for the droplet's own caddy log — it's linked as
blocking this ticket.

Closed #680 (this recurrence's own ticket) as a duplicate/reinforcement
per its own filer's recommendation — advances #678, no new ruling made on
the /v2/droplets retry guard itself, which stays gated on real evidence
per this ticket's needs-info.

**Recurrence corroboration (#680, drive `20260822T185236Z`, same sig `3b0b824f61b8` as this ticket's original).** `wizard-rent` reddened at the identical fault-line — S4a settled on a raw `broker: DigitalOcean refused: Not Found: {"id":"not_found",...}` before `[data-status="address"]` ever appeared; `rent-fails-clean` (fault injection) stayed green; `artifacts/journey.json` again shows `{"rows": null, "fault": null}` (create never got far enough to found a droplet). **Still not actionable.** This run's `logs/` carries no broker-process output at all — every `logs/guest-*.log` is empty or a local-connection failure, consistent with no droplet ever existing to harvest from, but there's no `d.do` method/path/status line anywhere in the run directory either. So this recurrence still can't say whether it hit the un-retried `/v2/droplets` POST or `ensureSSHKey` exhausting its new 3-retry budget (#677) on an unusually long blip — the evidence this ticket is gated on does not exist for this occurrence, for the same reason it didn't exist before #677 landed the logging: **the broker's own log never reaches the run directory** (it's a remote systemd service, not something the drive harness spawns/captures). Filed **#681** to close that specific gap, with the exact SSH/journalctl harvest pattern (`scripts/lib/rehearsal-droplet.sh :341-345`) already used for the droplet's own caddy log — it's linked as blocking this ticket. Closed **#680** (this recurrence's own ticket) as a duplicate/reinforcement per its own filer's recommendation — advances #678, no new ruling made on the `/v2/droplets` retry guard itself, which stays gated on real evidence per this ticket's `needs-info`.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Re-evaluated on needs-info re-triage after this ticket's only blocker (#681,
broker-log capture) closed and its successor #1178 landed.

Ruling: needs-info → deferred (defer-with-criteria; also dropped
priority).

Why. The evidence this ticket was gated on now exists — and it reroutes the
work:

  • #1178 captured the first real POST /v2/droplets red and it was fixed
    (0fc29770) as a read-after-write on the SSH key, resolved by
    confirm-gating the key write, with no retry added to the create POST
    (ADR 0047 / #682 fence intact; TestDO_CreatePostIsNeverRetried proves it).
  • Every create-POST refusal seen so far (#680 = 404, #1178 = 422) is a
    deterministic read-after-write, not the transient / lost-response 5xx
    this ticket's retry-guard is scoped to. That scenario has never been observed,
    and the create POST is deliberately fenced against retry.

So this is neither rejected nor actionable now. It's parked with concrete revisit
criteria (added to the issue body under Ruled: DEFERRED): a genuine transient
5xx on POST /v2/droplets, or DO shipping an idempotency-key for droplet-create.

Why a two-way door. Revertible by relabel/reopen; provable by the closed
#681, the #1178 ruling + commit 0fc29770, and TestDO_CreatePostIsNeverRetried.
Not on the one-way-door list.

> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** Re-evaluated on `needs-info` re-triage after this ticket's only blocker (**#681**, broker-log capture) closed and its successor **#1178** landed. **Ruling: `needs-info` → `deferred`** (defer-with-criteria; also dropped `priority`). **Why.** The evidence this ticket was gated on now exists — and it reroutes the work: - #1178 captured the first real `POST /v2/droplets` red and it was fixed (`0fc29770`) as a **read-after-write on the SSH key**, resolved by **confirm-gating the key write**, with **no retry added to the create POST** (ADR 0047 / #682 fence intact; `TestDO_CreatePostIsNeverRetried` proves it). - Every create-POST refusal seen so far (#680 = 404, #1178 = 422) is a **deterministic read-after-write**, not the **transient / lost-response** 5xx this ticket's retry-guard is scoped to. That scenario has never been observed, and the create POST is deliberately fenced against retry. So this is neither rejected nor actionable now. It's parked with concrete revisit criteria (added to the issue body under **Ruled: DEFERRED**): a genuine transient 5xx on `POST /v2/droplets`, or DO shipping an idempotency-key for droplet-create. **Why a two-way door.** Revertible by relabel/reopen; provable by the closed #681, the #1178 ruling + commit `0fc29770`, and `TestDO_CreatePostIsNeverRetried`. Not on the one-way-door list.
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#678
No description provided.