A failed standing re-supply destroys the community AND wedges its slug for 24h — the teardown loses the claim secret, then wipes the home #1755

Closed
opened 2026-09-23 05:45:07 +00:00 by ben · 3 comments
Owner

One failed re-supply cost the community, its name for 24 h, and the next drive

Seen on ADR 0264's fire 7 (bens-mac-04, slug rehearsal-m). The drive intended to
ADOPT — the staleness verdict was binary-only drift, ADR 0208 ruling 3a:

standing: BINARY-ONLY DRIFT — re-supplying the standing gateway in place, then adopting it
standing resupply: landing the payload's current binaries on rehearsal-m.idss.nz (168.144.170.146) in place — no re-found
standing resupply: re-render the gateway's own closure from the persisted facts FAILED against rehearsal-m.idss.nz (168.144.170.146) — falling back to the re-found
==> standing re-supply FAILED — falling back to the re-found
    note: no host/secret on record — standing release + offboard skipped (the community never reached S5) (#849)
    standing teardown: wiped the standing home

Then, on the re-found:

pre-rent reservation sweep: spending 2 remembered claim secret(s) on any stale 'rehearsal-m' reservation
    note: 2 remembered secret(s) tried, none authorised the offboard — the reservation is still held by a secret this host never saw. Rotate REHEARSAL_SLUG
Error: the Address check refused rehearsal-m.idss.nz — the broker holds the name

Net effect of one failed re-render: the standing community's gateway destroyed (the
pre-rent sweep reaps the same-slug droplet), the standing home wiped, the claim
secret gone, and the slug wedged at the broker for its 24 h TTL — so the next
drive cannot use that name either. The lane is down until someone rotates the slug
by hand.

The specific contradiction

oc_standing_teardown reports "no host/secret on record … the community never
reached S5"
four log lines after oc_standing_resupply read that same
facts.json and printed the host and IP it was re-supplying. The teardown's own
fallback chain (facts.json → founding-state.json draft.details.slug /
draft.address.host, then oc_standing_secret over state/) also came back
empty. So between the re-supply's read and the teardown's read, the facts the
teardown needs to OFFBOARD the name stopped being visible — and the teardown then
rm -rf'd the home, binning the one key to the reservation.

Finding where facts.json (or the state dir) goes between those two calls is the
first step; the failure-path ordering is the likely suspect.

Shape

  1. Offboard before wiping. The teardown should free the reservation using the
    facts the re-supply just proved readable, and only then remove anything. A wipe
    that precedes the offboard is unrecoverable by design.
  2. A failed re-supply should not be destructive by default. Ruling 3a's
    fallback is "re-found", but a re-found that cannot reclaim its own name leaves
    the lane worse off than parking. Consider parking the drive (the #1189 page)
    when the re-supply fails and the slug's secret is not in hand.
  3. Worth checking why the re-render failed at all — the gateway was reachable
    moments earlier (the re-supply had already scp'd to it).

Impact

Any lane on ADR 0208's standing community, not just the bring-your-own one: this
is the shared re-supply path. It is a slow, quiet trap — the drive that pays for
it is the NEXT one, with a 5-second Address refusal and no obvious cause.

## One failed re-supply cost the community, its name for 24 h, and the next drive Seen on ADR 0264's fire 7 (bens-mac-04, slug `rehearsal-m`). The drive intended to ADOPT — the staleness verdict was binary-only drift, ADR 0208 ruling 3a: ``` standing: BINARY-ONLY DRIFT — re-supplying the standing gateway in place, then adopting it standing resupply: landing the payload's current binaries on rehearsal-m.idss.nz (168.144.170.146) in place — no re-found standing resupply: re-render the gateway's own closure from the persisted facts FAILED against rehearsal-m.idss.nz (168.144.170.146) — falling back to the re-found ==> standing re-supply FAILED — falling back to the re-found note: no host/secret on record — standing release + offboard skipped (the community never reached S5) (#849) standing teardown: wiped the standing home ``` Then, on the re-found: ``` pre-rent reservation sweep: spending 2 remembered claim secret(s) on any stale 'rehearsal-m' reservation note: 2 remembered secret(s) tried, none authorised the offboard — the reservation is still held by a secret this host never saw. Rotate REHEARSAL_SLUG Error: the Address check refused rehearsal-m.idss.nz — the broker holds the name ``` Net effect of one failed re-render: the standing community's gateway destroyed (the pre-rent sweep reaps the same-slug droplet), the standing home wiped, the claim secret gone, and **the slug wedged at the broker for its 24 h TTL** — so the next drive cannot use that name either. The lane is down until someone rotates the slug by hand. ## The specific contradiction `oc_standing_teardown` reports **"no host/secret on record … the community never reached S5"** four log lines after `oc_standing_resupply` read that same `facts.json` and printed the host and IP it was re-supplying. The teardown's own fallback chain (facts.json → `founding-state.json` `draft.details.slug` / `draft.address.host`, then `oc_standing_secret` over `state/`) also came back empty. So between the re-supply's read and the teardown's read, the facts the teardown needs to OFFBOARD the name stopped being visible — and the teardown then `rm -rf`'d the home, binning the one key to the reservation. Finding where `facts.json` (or the state dir) goes between those two calls is the first step; the failure-path ordering is the likely suspect. ## Shape 1. **Offboard before wiping.** The teardown should free the reservation using the facts the re-supply just proved readable, and only then remove anything. A wipe that precedes the offboard is unrecoverable by design. 2. **A failed re-supply should not be destructive by default.** Ruling 3a's fallback is "re-found", but a re-found that cannot reclaim its own name leaves the lane worse off than parking. Consider parking the drive (the #1189 page) when the re-supply fails and the slug's secret is not in hand. 3. Worth checking why the re-render failed at all — the gateway was reachable moments earlier (the re-supply had already scp'd to it). ## Impact Any lane on ADR 0208's standing community, not just the bring-your-own one: this is the shared re-supply path. It is a slow, quiet trap — the drive that pays for it is the NEXT one, with a 5-second Address refusal and no obvious cause.
Author
Owner

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime

Ruling: bug + ready-for-agent (with priority). I also rule the fallback-policy question the report's Shape §2 raises: a standing teardown must not rm -rf the home when it could not prove the name was freed — it must PARK the home (preserve state/ and its key material) and page, never wipe the only recoverable key. This adopts the report's "a failed re-supply should not be destructive by default" as the concrete teardown contract below.

Why this is a two-way door: the whole fix lives in scripts/lib/rehearsal-standing-lib.sh + its offline test scripts/tests/rehearsal-standing-test.sh (ordinary repo paths — not .sandcastle/**, no host credentials, no live-infra op required to prove it). It is revertible by a single commit/label change and provable by the existing offline harness (fake curl/ssh, no broker/network). It is on none of the one-way-door lists (no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction — it prevents one — no non-routine spend). Ben's veto is asynchronous.

What proves it: bash scripts/tests/rehearsal-standing-test.sh (extended with the cases in the acceptance criteria) goes green offline.

Verification — the reported fix is already in; the real trap is elsewhere

I read the code against the report before writing the brief. Two corrections to the report's diagnosis:

  • Shape §1 ("offboard before wiping") is already implemented. oc_standing_teardown already remembers the secret (#757), then releases, then offboards, and only then wipes — the rm -rf is the last statement, and #897 already hardened the "teardown can no longer bin the only claim key" case for a red-mid-found (facts.json absent) drive.
  • The real trap is a source asymmetry the report half-spotted. oc_standing_resupply reads only facts.json (slug/host/ip) and happily prints the host/IP. But oc_standing_teardown's S5 guard is gated on both host and secret, where secret is mined from a different source — oc_standing_secret greps state/ for claimSecret. When the secret is not present in state/ (e.g. an adopted community whose state/ never carried it), that guard fails, release+offboard are skipped ("no host/secret on record … never reached S5"), yet the wipe still runs unconditionally — binning state/ (the one place the key could still be) and leaving the broker holding the name for its 24 h TTL. That is exactly the fire-7 log: facts readable (host printed), secret empty, name never freed, slug wedged.

The offline test asserts remember-before-release ordering but has no assertion that the wipe is conditional on the name being freed, and no case for host-present/secret-empty — which is why this passed CI and only bit a live drive.

Agent Brief

Category: bug
Summary: A failed standing re-supply can wipe the community home even when the teardown could not free the name, wedging the slug at the broker for 24 h — because oc_standing_teardown skips release+offboard when it cannot mine the claim secret, yet still rm -rfs the home unconditionally.

Current behavior:
On binary-only drift the drive re-supplies in place; if the re-supply fails (fire 7 failed at the #1275 gateway re-render step) it falls back to a re-found, whose first act is oc_standing_teardown. When the teardown cannot mine the claim secret from state/ — even though facts.json still names the host that the re-supply just read and printed — it takes the "no host/secret on record" branch, skips the broker release + subdomain offboard, and then still wipes the standing home. Net: the gateway is reaped by the next drive's pre-rent slug sweep, the home and its key are gone, and the broker holds the name until its 24 h TTL lapses — the next drive dies on a 5-second Address refusal with no obvious cause.

Desired behavior:
The teardown must never destroy the home when it has not provably freed the name. Concretely:

  • The wipe is conditional. The home may be wiped only when the name is provably released or the claim secret was durably remembered to the per-slug claims store (so a later drive/human can still free the name).
  • When the teardown cannot free the name and has no remembered secret to fall back on (release/offboard skipped for want of a secret, or the offboard call was refused), it must PARK: leave state//facts.json in place, emit a loud, greppable PARK line that names the wedged slug and this issue, and page through the same drive-park path the rest of the drive uses (the #1189 page) when that mechanism is available to the sourcing script. A parked home is recoverable; a wiped one is not.
  • The host/secret guard asymmetry should be closed so a host-known/secret-absent teardown is not misreported as "never reached S5": when facts.json (or state/founding-state.json) names a host but no secret can be mined, that is a cannot-free-the-name condition (→ PARK), distinct from a genuinely never-founded community (nothing to free → safe to wipe).

Key interfaces / behavioral contracts:

  • oc_standing_teardown — the terminal wipe must be guarded on a "name is safe to abandon" predicate (name released, or secret remembered to the claims store), not run unconditionally. Preserve the existing remember-before-spend and the #897 facts.json→founding-state.json fallback.
  • oc_standing_secret / the S5 guard — distinguish "host known, secret unminable" (cannot free → park) from "nothing on record" (never founded → safe to wipe).
  • The park path — reuse the drive's existing #1189 page/park mechanism from the sourcing script (smoke-private-path.sh); do not invent a second park channel.

Acceptance criteria:

  • bash scripts/tests/rehearsal-standing-test.sh passes.
  • New offline case: teardown with facts.json host present but no claim secret in state/ does not remove the home, and emits a PARK line naming the slug — the state dir survives the call.
  • New offline case: teardown where the offboard is refused (non-2xx / FAKE_OFFBOARD_RC=1) and no secret was remembered does not remove the home.
  • Existing happy path unchanged: a teardown that releases + offboards with a 2xx (or that durably remembered the secret) still wipes the home.
  • An explicit assertion that the wipe is conditional on the name being freed/rememberable (the ordering-only assertions in section E/F are not enough).
  • docs/GOTCHAS.md gains a Symptom→Cause→Rule entry for the "next drive dies on a 5-second Address refusal because a prior teardown wiped the home without freeing the name" trap, in the same commit.

Diagnosis lead (pursue, but land the safety fix regardless):
Why did the adopted standing home carry no mineable claim secret while facts.json was intact? The likely cause is that the adopt/re-supply lineage does not persist claimSecret into state/founding-state.json the way a fresh S5 founding does, so oc_standing_secret finds nothing on a community it never freshly founded. If confirmed, ensure the adopt path persists (or can re-mine) the secret. This is diagnosable from the code; a live standing drive would confirm it but is not required to land the safety fix above.

Out of scope:

  • Fixing why the #1275 gateway re-render failed on fire 7 (Shape §3). A re-render can fail for many reasons; the point of this ticket is that a re-render/re-supply failure must not be catastrophic. File a separate issue for the re-render failure if it recurs.
  • Changing ADR 0208 ruling 3a's binary-only-drift → re-supply, or config-drift → re-found classification.
  • Any change under .sandcastle/** or to the broker's release/offboard/TTL behavior.
> *This was generated by AI during triage.* ## Ruled by agent under ADR 0174 — veto anytime **Ruling:** `bug` + **`ready-for-agent`** (with `priority`). I also rule the fallback-policy question the report's Shape §2 raises: **a standing teardown must not `rm -rf` the home when it could not prove the name was freed** — it must PARK the home (preserve `state/` and its key material) and page, never wipe the only recoverable key. This adopts the report's "a failed re-supply should not be destructive by default" as the concrete teardown contract below. **Why this is a two-way door:** the whole fix lives in `scripts/lib/rehearsal-standing-lib.sh` + its offline test `scripts/tests/rehearsal-standing-test.sh` (ordinary repo paths — *not* `.sandcastle/**`, no host credentials, no live-infra op required to prove it). It is revertible by a single commit/label change and provable by the existing offline harness (fake `curl`/`ssh`, no broker/network). It is on none of the one-way-door lists (no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction — it *prevents* one — no non-routine spend). Ben's veto is asynchronous. **What proves it:** `bash scripts/tests/rehearsal-standing-test.sh` (extended with the cases in the acceptance criteria) goes green offline. ## Verification — the reported fix is already in; the real trap is elsewhere I read the code against the report before writing the brief. Two corrections to the report's diagnosis: - **Shape §1 ("offboard before wiping") is already implemented.** `oc_standing_teardown` already remembers the secret (`#757`), then releases, then offboards, and only then wipes — the `rm -rf` is the last statement, and `#897` already hardened the "teardown can no longer bin the only claim key" case for a red-mid-found (facts.json absent) drive. - **The real trap is a source asymmetry the report half-spotted.** `oc_standing_resupply` reads only `facts.json` (slug/host/ip) and happily prints the host/IP. But `oc_standing_teardown`'s S5 guard is gated on **both** `host` **and** `secret`, where `secret` is mined from a *different* source — `oc_standing_secret` greps `state/` for `claimSecret`. When the secret is not present in `state/` (e.g. an adopted community whose `state/` never carried it), that guard fails, release+offboard are **skipped** ("no host/secret on record … never reached S5"), **yet the wipe still runs unconditionally** — binning `state/` (the one place the key could still be) and leaving the broker holding the name for its 24 h TTL. That is exactly the fire-7 log: facts readable (host printed), secret empty, name never freed, slug wedged. The offline test asserts remember-before-release ordering but has **no** assertion that the wipe is conditional on the name being freed, and **no** case for host-present/secret-empty — which is why this passed CI and only bit a live drive. ## Agent Brief **Category:** bug **Summary:** A failed standing re-supply can wipe the community home even when the teardown could not free the name, wedging the slug at the broker for 24 h — because `oc_standing_teardown` skips release+offboard when it cannot mine the claim secret, yet still `rm -rf`s the home unconditionally. **Current behavior:** On binary-only drift the drive re-supplies in place; if the re-supply fails (fire 7 failed at the `#1275` gateway re-render step) it falls back to a re-found, whose first act is `oc_standing_teardown`. When the teardown cannot mine the claim secret from `state/` — even though `facts.json` still names the host that the re-supply just read and printed — it takes the "no host/secret on record" branch, **skips** the broker release + subdomain offboard, and then **still wipes** the standing home. Net: the gateway is reaped by the next drive's pre-rent slug sweep, the home and its key are gone, and the broker holds the name until its 24 h TTL lapses — the *next* drive dies on a 5-second Address refusal with no obvious cause. **Desired behavior:** The teardown must never destroy the home when it has not provably freed the name. Concretely: - The wipe is **conditional**. The home may be wiped only when the name is provably released **or** the claim secret was durably remembered to the per-slug claims store (so a later drive/human can still free the name). - When the teardown cannot free the name and has no remembered secret to fall back on (release/offboard skipped for want of a secret, **or** the offboard call was refused), it must **PARK**: leave `state/`/`facts.json` in place, emit a loud, greppable PARK line that names the wedged slug and this issue, and page through the same drive-park path the rest of the drive uses (the `#1189` page) when that mechanism is available to the sourcing script. A parked home is recoverable; a wiped one is not. - The host/secret guard asymmetry should be closed so a host-known/secret-absent teardown is not misreported as "never reached S5": when `facts.json` (or `state/founding-state.json`) names a host but no secret can be mined, that is a *cannot-free-the-name* condition (→ PARK), distinct from a genuinely never-founded community (nothing to free → safe to wipe). **Key interfaces / behavioral contracts:** - `oc_standing_teardown` — the terminal wipe must be guarded on a "name is safe to abandon" predicate (name released, or secret remembered to the claims store), not run unconditionally. Preserve the existing remember-before-spend and the `#897` facts.json→`founding-state.json` fallback. - `oc_standing_secret` / the S5 guard — distinguish "host known, secret unminable" (cannot free → park) from "nothing on record" (never founded → safe to wipe). - The park path — reuse the drive's existing `#1189` page/park mechanism from the sourcing script (`smoke-private-path.sh`); do not invent a second park channel. **Acceptance criteria:** - [ ] `bash scripts/tests/rehearsal-standing-test.sh` passes. - [ ] New offline case: teardown with `facts.json` host present but **no** claim secret in `state/` does **not** remove the home, and emits a PARK line naming the slug — the state dir survives the call. - [ ] New offline case: teardown where the offboard is **refused** (non-2xx / `FAKE_OFFBOARD_RC=1`) and no secret was remembered does **not** remove the home. - [ ] Existing happy path unchanged: a teardown that releases + offboards with a 2xx (or that durably remembered the secret) still wipes the home. - [ ] An explicit assertion that the wipe is conditional on the name being freed/rememberable (the ordering-only assertions in section E/F are not enough). - [ ] `docs/GOTCHAS.md` gains a Symptom→Cause→Rule entry for the "next drive dies on a 5-second Address refusal because a prior teardown wiped the home without freeing the name" trap, in the same commit. **Diagnosis lead (pursue, but land the safety fix regardless):** Why did the adopted standing home carry no mineable claim secret while `facts.json` was intact? The likely cause is that the adopt/re-supply lineage does not persist `claimSecret` into `state/founding-state.json` the way a fresh S5 founding does, so `oc_standing_secret` finds nothing on a community it never freshly founded. If confirmed, ensure the adopt path persists (or can re-mine) the secret. This is diagnosable from the code; a live standing drive would confirm it but is **not** required to land the safety fix above. **Out of scope:** - Fixing *why* the `#1275` gateway re-render failed on fire 7 (Shape §3). A re-render can fail for many reasons; the point of this ticket is that a re-render/re-supply failure must not be catastrophic. File a separate issue for the re-render failure if it recurs. - Changing ADR 0208 ruling 3a's binary-only-drift → re-supply, or config-drift → re-found classification. - Any change under `.sandcastle/**` or to the broker's release/offboard/TTL behavior.

swarm-claim host=matou-dev-server-01 run=30761
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=30761 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1755 — status success

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

envelope
{
  "issue": 1755,
  "status": "success",
  "commits": [
    "28fac3a7297e2a32dbc376c5c920fff165da79bc"
  ],
  "changed_files": [
    "scripts/lib/rehearsal-standing-lib.sh",
    "scripts/tests/rehearsal-standing-test.sh",
    "docs/GOTCHAS.md",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/rehearsal-standing-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "bash scripts/tests/rehearsal-standing-test.sh passes": "test run green — 31 checks passed (commit 28fac3a7297e2a32dbc376c5c920fff165da79bc)",
    "New case: host present but no claim secret in state does not remove the home and emits a PARK line naming the slug": "test case G2 in rehearsal-standing-test.sh — facts.json names host, state/ carries no secret; asserts facts.json + state/ survive and PARK line names 'rehearsal-wedge' + #1755",
    "New case: offboard refused and no secret remembered does not remove the home": "test case G3 — FAKE_OFFBOARD_RC=1 with oc_slug_secret_remember unset; asserts home survives after the offboard is reached",
    "Existing happy path unchanged: a teardown that releases+offboards 2xx (or remembered the secret) still wipes the home": "test cases E, F, G, G4 (offboard 2xx wipes) and G5 (refused-but-remembered wipes)",
    "Explicit assertion that the wipe is conditional on the name being freed/rememberable": "G2/G3 assert the home SURVIVES when neither freed nor remembered; G4 (freed) and G5 (remembered) assert it WIPES — the conditional is exercised on both sides",
    "docs/GOTCHAS.md gains a Symptom->Cause->Rule entry for the trap, same commit": "GOTCHAS #318 added in 28fac3a7297e2a32dbc376c5c920fff165da79bc"
  },
  "summary": "oc_standing_teardown's wipe is now conditional on the name being provably freed or its secret durably remembered (else PARK), and oc_standing_secret re-mines the post-#1404 sealed claim secret so a re-found can free its own name.",
  "blockers": []
}
**close-report** for #1755 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1755, "status": "success", "commits": [ "28fac3a7297e2a32dbc376c5c920fff165da79bc" ], "changed_files": [ "scripts/lib/rehearsal-standing-lib.sh", "scripts/tests/rehearsal-standing-test.sh", "docs/GOTCHAS.md", "STATUS.md" ], "tests": [ { "command": "bash scripts/tests/rehearsal-standing-test.sh", "exit_code": 0 } ], "criteria": { "bash scripts/tests/rehearsal-standing-test.sh passes": "test run green — 31 checks passed (commit 28fac3a7297e2a32dbc376c5c920fff165da79bc)", "New case: host present but no claim secret in state does not remove the home and emits a PARK line naming the slug": "test case G2 in rehearsal-standing-test.sh — facts.json names host, state/ carries no secret; asserts facts.json + state/ survive and PARK line names 'rehearsal-wedge' + #1755", "New case: offboard refused and no secret remembered does not remove the home": "test case G3 — FAKE_OFFBOARD_RC=1 with oc_slug_secret_remember unset; asserts home survives after the offboard is reached", "Existing happy path unchanged: a teardown that releases+offboards 2xx (or remembered the secret) still wipes the home": "test cases E, F, G, G4 (offboard 2xx wipes) and G5 (refused-but-remembered wipes)", "Explicit assertion that the wipe is conditional on the name being freed/rememberable": "G2/G3 assert the home SURVIVES when neither freed nor remembered; G4 (freed) and G5 (remembered) assert it WIPES — the conditional is exercised on both sides", "docs/GOTCHAS.md gains a Symptom->Cause->Rule entry for the trap, same commit": "GOTCHAS #318 added in 28fac3a7297e2a32dbc376c5c920fff165da79bc" }, "summary": "oc_standing_teardown's wipe is now conditional on the name being provably freed or its secret durably remembered (else PARK), and oc_standing_secret re-mines the post-#1404 sealed claim secret so a re-found can free its own name.", "blockers": [] } ``` </details>
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.

Dependencies

No dependencies set.

Reference
Matou/idss#1755
No description provided.