rented drive: keep-on-red (#716) never closes — the next same-slug wizard-rent 409s for a full 24h TTL #748

Closed
opened 2026-08-24 15:12:13 +00:00 by matou-build-agent · 3 comments

Failure: wizard-rent reds every drive at rehearsal-c.idss.nz right now (drive 20260824T145729Z, sig 3b0b824f61b8), timing out at app/tests/e2e/journey.rented.spec.ts:173 (expect([data-status="address"]).toBeVisible({timeout: 8*60_000})). The captured card shows the real cause: brokerclient: /v1/gateways/rent: 409 Conflict: broker: this host already has an active rental (legs.json, error-context.md).

Root cause — confirmed live, not a stale-ledger false positive: Rentals.Rent (broker/internal/broker/rentals.go:189-222) only returns ErrAlreadyRented (line 147) after calling r.prov.Exists on the existing lease's server — the #652/GOTCHAS-#58 self-heal. I checked with doctl directly: droplet 594800072 (idss-gateway-rehearsal-c-8e11, tags idss-gateway,idss-rental, region syd1, size s-2vcpu-4gb, created_at: 2026-08-24T14:45:48Z) is genuinely active on DigitalOcean. The broker is telling the truth; this is not #58's scenario.

That droplet belongs to the immediately prior drive, 20260824T144440Z. Its wizard-rent leg went green (legs.json: 36684ms), then it reds at enroll-configure (separately healed, commit f086c9ca). Its afterAll teardown hit the REHEARSAL_KEEP_RED_DROPLET-on-RED path added for #716/#703/#704 (app/tests/e2e/fixtures/rented.ts:156-172 releaseOnTeardown; scripts/lib/rehearsal-droplet.sh:868-909 oc_rented_teardown) and intentionally left the rental open for post-mortem inspection — confirmed in rehearsal-executor.log:199362: "REHEARSAL_KEEP_RED_DROPLET + RED drive: NOT releasing rehearsal-c.idss.nz — the box stays up for evidence (broker TTL reaps it)". This is working exactly as #716 designed it.

The gap: REHEARSAL_SLUG is a fixed standing value (rehearsal-c, scripts/lib/swarm-identity.sh:41, .sandcastle/.env on the executor) — unlike the rehearsal-rentfail honesty leg, which stamps a per-drive token onto its slug specifically so a prior claim can never wedge the next drive (rentfailSlug, app/tests/e2e/fixtures/rented.ts:32-39). Nothing releases a kept-for-evidence box before the next same-slug drive fires, so every subsequent rented drive inherits the live conflict and reds at wizard-rent for the full 8-minute ceiling — until a human manually releases the box or the broker's own TTL reaper closes the lease. The rent-card's own copy says the TTL is 24h0m0s (Rentals.Offer, rentals.go:174); note scripts/lib/rehearsal-droplet.sh:555's comment ("TTL reaps in ≤6h") looks stale/wrong for the rented target specifically.

Secondary finding, possibly compounding: the live droplet's tags are ONLY idss-gateway/idss-rental — missing the idss-rental-expires-<epoch> tag that rentalExpiresTag (rentals.go:57-60, feature #741) is supposed to stamp on every create. Without it, scripts/rental-reap.sh's doctl-only failsafe sweep (the one meant to work even if the broker process itself is down) cannot see this box at all — only the broker's own in-process Reap (keyed off the ledger, not the tag) can close it. Worth checking against GOTCHAS #59 whether the broker running on the mail droplet is behind main (i.e. predates #741).

What plugging it needs (design decision, not mechanical): something has to close the keep-on-red hatch before the next same-slug drive starts — options include (a) releasing the previous kept box at the START of the next rented drive once its evidence has already been harvested, (b) rotating REHEARSAL_SLUG per-drive for the rented target the way rehearsal-rentfail already does, or (c) a bounded evidence-inspection window after which an automated sweep (not just the 24h broker TTL) reaps it. Also confirm/backfill the idss-rental-expires-* tag is actually present on freshly-created rented boxes (may just need broker-deploy, GOTCHAS #59).

Immediate unblock (infra action, not a code change): once idss-gateway-rehearsal-c-8e11 (server id 594800072) has been inspected for whatever evidence #716 wanted, release it — POST /v1/gateways/release {"host":"rehearsal-c.idss.nz"} with the drive's claim secret, or doctl compute droplet delete 594800072 as the documented fallback — or every rented drive stays red until the 24h lease lapses on its own.

drive 20260824T145729Z 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/…/20260824T145729Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

**Failure:** `wizard-rent` reds every drive at `rehearsal-c.idss.nz` right now (drive `20260824T145729Z`, sig `3b0b824f61b8`), timing out at `app/tests/e2e/journey.rented.spec.ts:173` (`expect([data-status="address"]).toBeVisible({timeout: 8*60_000})`). The captured card shows the real cause: `brokerclient: /v1/gateways/rent: 409 Conflict: broker: this host already has an active rental` (legs.json, error-context.md). **Root cause — confirmed live, not a stale-ledger false positive:** `Rentals.Rent` (`broker/internal/broker/rentals.go:189-222`) only returns `ErrAlreadyRented` (line 147) after calling `r.prov.Exists` on the existing lease's server — the #652/GOTCHAS-#58 self-heal. I checked with `doctl` directly: droplet `594800072` (`idss-gateway-rehearsal-c-8e11`, tags `idss-gateway`,`idss-rental`, region `syd1`, size `s-2vcpu-4gb`, `created_at: 2026-08-24T14:45:48Z`) is genuinely `active` on DigitalOcean. The broker is telling the truth; this is not #58's scenario. That droplet belongs to the immediately prior drive, `20260824T144440Z`. Its `wizard-rent` leg went green (legs.json: 36684ms), then it reds at `enroll-configure` (separately healed, commit `f086c9ca`). Its `afterAll` teardown hit the `REHEARSAL_KEEP_RED_DROPLET`-on-RED path added for #716/#703/#704 (`app/tests/e2e/fixtures/rented.ts:156-172` `releaseOnTeardown`; `scripts/lib/rehearsal-droplet.sh:868-909` `oc_rented_teardown`) and **intentionally left the rental open** for post-mortem inspection — confirmed in `rehearsal-executor.log:199362`: `"REHEARSAL_KEEP_RED_DROPLET + RED drive: NOT releasing rehearsal-c.idss.nz — the box stays up for evidence (broker TTL reaps it)"`. This is working exactly as #716 designed it. **The gap:** `REHEARSAL_SLUG` is a fixed standing value (`rehearsal-c`, `scripts/lib/swarm-identity.sh:41`, `.sandcastle/.env` on the executor) — unlike the `rehearsal-rentfail` honesty leg, which stamps a per-drive token onto its slug specifically so a prior claim can never wedge the next drive (`rentfailSlug`, `app/tests/e2e/fixtures/rented.ts:32-39`). Nothing releases a kept-for-evidence box before the *next* same-slug drive fires, so every subsequent `rented` drive inherits the live conflict and reds at `wizard-rent` for the full 8-minute ceiling — until a human manually releases the box or the broker's own TTL reaper closes the lease. The rent-card's own copy says the TTL is `24h0m0s` (`Rentals.Offer`, `rentals.go:174`); note `scripts/lib/rehearsal-droplet.sh:555`'s comment ("TTL reaps in ≤6h") looks stale/wrong for the rented target specifically. **Secondary finding, possibly compounding:** the live droplet's tags are ONLY `idss-gateway`/`idss-rental` — missing the `idss-rental-expires-<epoch>` tag that `rentalExpiresTag` (`rentals.go:57-60`, feature #741) is supposed to stamp on every create. Without it, `scripts/rental-reap.sh`'s doctl-only failsafe sweep (the one meant to work even if the broker process itself is down) cannot see this box at all — only the broker's own in-process `Reap` (keyed off the ledger, not the tag) can close it. Worth checking against GOTCHAS #59 whether the broker running on the mail droplet is behind `main` (i.e. predates #741). **What plugging it needs (design decision, not mechanical):** something has to close the keep-on-red hatch before the next same-slug drive starts — options include (a) releasing the previous kept box at the START of the next rented drive once its evidence has already been harvested, (b) rotating `REHEARSAL_SLUG` per-drive for the rented target the way `rehearsal-rentfail` already does, or (c) a bounded evidence-inspection window after which an automated sweep (not just the 24h broker TTL) reaps it. Also confirm/backfill the `idss-rental-expires-*` tag is actually present on freshly-created rented boxes (may just need `broker-deploy`, GOTCHAS #59). **Immediate unblock (infra action, not a code change):** once `idss-gateway-rehearsal-c-8e11` (server id `594800072`) has been inspected for whatever evidence #716 wanted, release it — `POST /v1/gateways/release {"host":"rehearsal-c.idss.nz"}` with the drive's claim secret, or `doctl compute droplet delete 594800072` as the documented fallback — or every `rented` drive stays red until the 24h lease lapses on its own. drive `20260824T145729Z` 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/…/20260824T145729Z/` 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

swarm-claim host=elitebook-distributed-server-03 run=9720
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=9720 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

Ruled by agent under ADR 0174 — veto anytime.

The decision: the issue offered three ways to close the keep-on-red hatch before the next same-slug rented drive rents — (a) release the prior kept box at the START of the next drive, (b) rotate REHEARSAL_SLUG per-drive, (c) a bounded evidence window + automated sweep.

Ruling: option (a). Option (b) is out — the rented target's cert-seeding continuity (#724/GOTCHAS #32) is keyed on a STABLE $REHEARSAL_SLUG (the LE cert identifier is $REHEARSAL_SLUG.idss.nz), so rotating the slug per-drive would re-order fresh certs every drive and walk into LE rate limits. (a) keeps the fixed slug and simply reaps the prior box before renting.

Shipped: oc_rented_release_stale_slug, called from oc_rented_preflight (before the wizard rents). It reaps any prior idss-gateway-<slug>-* droplet. Safe because: the prior drive's automated evidence gather (oc_rented_cleanup: journal, trace, report, cert harvest) already ran on that box in its own teardown; per-repo concurrency (#705) serialises the standing drive and this runs before we rent, so any same-slug box here is necessarily a PRIOR drive's, never a live peer; and deleting it lets the broker's own #58 Exists self-heal free the ledger on this drive's rent (the same behind-the-broker's-back path the fallback reap already relies on). OC_RENTED_SWEEP_STALE=0 opts out for a human doing live DO-console inspection across drives.

Note this also auto-unblocks the currently-stuck box: the next rented drive's preflight will find idss-gateway-rehearsal-c-8e11 (594800072) and reap it, then rent cleanly — no manual POST /v1/gateways/release or doctl droplet delete needed.

Why a two-way door: revertible by a later commit; provable offline (scripts/tests/rehearsal-rented-target-test.sh, 12 checks) and by the next live rented drive; not on the one-way-door list — it destroys only an ephemeral, already-evidence-harvested rehearsal droplet (not user data), widens no security posture, touches no credential/trust surface, and reduces (not increases) spend.

What proves it: scripts/tests/rehearsal-rented-target-test.sh (fake-doctl: same-slug box reaped, rehearsal-c2/rehearsal-rentfail boxes left alone, clean-start no-op, OC_RENTED_SWEEP_STALE=0 skip). Final proof is the next live rented drive renting rehearsal-c GREEN after a prior keep-on-red drive.

Secondary finding (infra, not this code slice): the live box's tags lack idss-rental-expires-* (#741) because the broker on the mail droplet predates #741 — a broker-deploy away (GOTCHAS #59). Left for an infra pass; my code fix does not depend on it.

**Ruled by agent under ADR 0174 — veto anytime.** **The decision:** the issue offered three ways to close the keep-on-red hatch before the next same-slug rented drive rents — (a) release the prior kept box at the START of the next drive, (b) rotate `REHEARSAL_SLUG` per-drive, (c) a bounded evidence window + automated sweep. **Ruling: option (a).** Option (b) is out — the rented target's cert-seeding continuity (#724/GOTCHAS #32) is keyed on a STABLE `$REHEARSAL_SLUG` (the LE cert identifier is `$REHEARSAL_SLUG.idss.nz`), so rotating the slug per-drive would re-order fresh certs every drive and walk into LE rate limits. (a) keeps the fixed slug and simply reaps the prior box before renting. **Shipped:** `oc_rented_release_stale_slug`, called from `oc_rented_preflight` (before the wizard rents). It reaps any prior `idss-gateway-<slug>-*` droplet. Safe because: the prior drive's automated evidence gather (`oc_rented_cleanup`: journal, trace, report, cert harvest) already ran on that box in its own teardown; per-repo concurrency (#705) serialises the standing drive and this runs before we rent, so any same-slug box here is necessarily a PRIOR drive's, never a live peer; and deleting it lets the broker's own #58 `Exists` self-heal free the ledger on this drive's rent (the same behind-the-broker's-back path the fallback reap already relies on). `OC_RENTED_SWEEP_STALE=0` opts out for a human doing live DO-console inspection across drives. **Note this also auto-unblocks the currently-stuck box:** the next rented drive's preflight will find `idss-gateway-rehearsal-c-8e11` (`594800072`) and reap it, then rent cleanly — no manual `POST /v1/gateways/release` or `doctl droplet delete` needed. **Why a two-way door:** revertible by a later commit; provable offline (`scripts/tests/rehearsal-rented-target-test.sh`, 12 checks) and by the next live rented drive; not on the one-way-door list — it destroys only an ephemeral, already-evidence-harvested rehearsal droplet (not user data), widens no security posture, touches no credential/trust surface, and reduces (not increases) spend. **What proves it:** `scripts/tests/rehearsal-rented-target-test.sh` (fake-doctl: same-slug box reaped, `rehearsal-c2`/`rehearsal-rentfail` boxes left alone, clean-start no-op, `OC_RENTED_SWEEP_STALE=0` skip). Final proof is the next live rented drive renting `rehearsal-c` GREEN after a prior keep-on-red drive. **Secondary finding (infra, not this code slice):** the live box's tags lack `idss-rental-expires-*` (#741) because the broker on the mail droplet predates #741 — a `broker-deploy` away (GOTCHAS #59). Left for an infra pass; my code fix does not depend on it.
Author
Member

close-report for #748 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 748,
  "status": "success",
  "commits": [
    "827635d1ea7ddbe47e390ff862a682faa4902a4c"
  ],
  "changed_files": [
    "scripts/lib/rehearsal-droplet.sh",
    "scripts/tests/rehearsal-rented-target-test.sh",
    "docs/GOTCHAS.md",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/rehearsal-rented-target-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/rehearsal-rented-certs-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/swarm-identity-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash -n scripts/lib/rehearsal-droplet.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The keep-on-red hatch closes before the next same-slug rented drive rents": "oc_rented_release_stale_slug in scripts/lib/rehearsal-droplet.sh, called from oc_rented_preflight before the wizard rents; reaps any prior idss-gateway-<slug>-* box",
    "The prior kept box is reaped so wizard-rent no longer 409s for the 24h TTL": "delete lets broker #58 Exists self-heal free the ledger on rent (rentals.go:189-222); proven by rehearsal-rented-target-test.sh check 10",
    "Only the same slug is swept (rehearsal-c2/rehearsal-rentfail untouched)": "oc_rented_stale_slug_ids trailing-hyphen prefix match; rehearsal-rented-target-test.sh checks 9 and 10",
    "An operator can keep a box up for inspection across drives": "OC_RENTED_SWEEP_STALE=0 escape hatch; rehearsal-rented-target-test.sh check 12",
    "Two-way-door ruling recorded (ADR 0174)": "issue comment #14204 (Ruled by agent under ADR 0174)"
  },
  "summary": "A kept-on-red rented box is reaped in oc_rented_preflight before the next same-slug drive rents, so wizard-rent no longer 409s for the broker's 24h TTL (#748).",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #748 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 748, "status": "success", "commits": [ "827635d1ea7ddbe47e390ff862a682faa4902a4c" ], "changed_files": [ "scripts/lib/rehearsal-droplet.sh", "scripts/tests/rehearsal-rented-target-test.sh", "docs/GOTCHAS.md", "STATUS.md" ], "tests": [ { "command": "bash scripts/tests/rehearsal-rented-target-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/rehearsal-rented-certs-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/swarm-identity-test.sh", "exit_code": 0 }, { "command": "bash -n scripts/lib/rehearsal-droplet.sh", "exit_code": 0 } ], "criteria": { "The keep-on-red hatch closes before the next same-slug rented drive rents": "oc_rented_release_stale_slug in scripts/lib/rehearsal-droplet.sh, called from oc_rented_preflight before the wizard rents; reaps any prior idss-gateway-<slug>-* box", "The prior kept box is reaped so wizard-rent no longer 409s for the 24h TTL": "delete lets broker #58 Exists self-heal free the ledger on rent (rentals.go:189-222); proven by rehearsal-rented-target-test.sh check 10", "Only the same slug is swept (rehearsal-c2/rehearsal-rentfail untouched)": "oc_rented_stale_slug_ids trailing-hyphen prefix match; rehearsal-rented-target-test.sh checks 9 and 10", "An operator can keep a box up for inspection across drives": "OC_RENTED_SWEEP_STALE=0 escape hatch; rehearsal-rented-target-test.sh check 12", "Two-way-door ruling recorded (ADR 0174)": "issue comment #14204 (Ruled by agent under ADR 0174)" }, "summary": "A kept-on-red rented box is reaped in oc_rented_preflight before the next same-slug drive rents, so wizard-rent no longer 409s for the broker's 24h TTL (#748).", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
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#748
No description provided.