reporter/healer should refuse an already-repaired red — reuse bootstrap-staleness-lib on the report/heal side (#918 defense-in-depth) #919

Closed
opened 2026-08-28 03:49:41 +00:00 by matou-build-agent · 1 comment

Context

Follow-up to #918 (fixed in 4e292243). #918 removed the phantom leg-red at its source: scripts/rehearsal-cycle.sh no longer hands the reporter a run directory this cycle did not produce, and an exit-3 bootstrap-stale park files ONE idempotent staleness ticket instead of a leg red. That closes the deadlock.

This ticket is the defense-in-depth half #918 flagged as "worth fixing in the same pass" but could not land, because it lives in protected .sandcastle/ paths (per CLAUDE.md Rule 9 / #445, a Sandcastle worker may not edit them — a session rules on the machinery change itself).

The proposed hardening

Neither .sandcastle/rehearsal-report.sh nor .sandcastle/heal.sh (the healer) checks whether the red it is about to file or fix still reproduces in the bits a new drive would run before acting. The check already exists and is cheap — scripts/lib/bootstrap-staleness-lib.sh does exactly this for the drive-side preflight (HEAD get.idss.nz, read x-idss-release, git merge-base --is-ancestor <fix> <served>).

Reuse it on the report/heal side:

  • Reporter: before filing a leg-red ticket, if the failing leg's fix is already an ancestor of the served pin (or the served pin is stale), suppress or downgrade — the red is a ghost.
  • Healer: before attempting a fix, refuse an already-repaired red (the 2026-08-27/28 storm gave the healer three wasted attempts on a fixed red — two rebase conflicts, one diff-cap breach — plus the executor ticks lost to the slot).

Why a session, not a worker

The change is entirely within protected .sandcastle/ paths. It is a two-way door (revertible, provable offline against bootstrap-staleness-lib.sh's existing test shape), so a session should be able to rule it under ADR 0174, escalating to ready-for-human only on a genuine one-way door.

Note

This is optional hardening, not a live bug — #918 already suppresses the phantom at the source (scripts/rehearsal-cycle.sh). This adds a second, run-dir-independent guard.

Filed by the Sandcastle worker that fixed #918, per Rule 9.

## Context Follow-up to #918 (fixed in `4e292243`). #918 removed the phantom leg-red at its **source**: `scripts/rehearsal-cycle.sh` no longer hands the reporter a run directory this cycle did not produce, and an exit-3 `bootstrap-stale` park files ONE idempotent staleness ticket instead of a leg red. That closes the deadlock. This ticket is the **defense-in-depth** half #918 flagged as "worth fixing in the same pass" but could not land, because it lives in **protected `.sandcastle/` paths** (per CLAUDE.md Rule 9 / #445, a Sandcastle worker may not edit them — a session rules on the machinery change itself). ## The proposed hardening Neither `.sandcastle/rehearsal-report.sh` nor `.sandcastle/heal.sh` (the healer) checks whether the red it is about to file or fix **still reproduces in the bits a new drive would run** before acting. The check already exists and is cheap — `scripts/lib/bootstrap-staleness-lib.sh` does exactly this for the drive-side preflight (`HEAD get.idss.nz`, read `x-idss-release`, `git merge-base --is-ancestor <fix> <served>`). Reuse it on the report/heal side: - **Reporter:** before filing a leg-red ticket, if the failing leg's fix is already an ancestor of the served pin (or the served pin is stale), suppress or downgrade — the red is a ghost. - **Healer:** before attempting a fix, refuse an already-repaired red (the 2026-08-27/28 storm gave the healer three wasted attempts on a fixed red — two rebase conflicts, one diff-cap breach — plus the executor ticks lost to the slot). ## Why a session, not a worker The change is entirely within protected `.sandcastle/` paths. It is a two-way door (revertible, provable offline against `bootstrap-staleness-lib.sh`'s existing test shape), so a session should be able to rule it under ADR 0174, escalating to `ready-for-human` only on a genuine one-way door. ## Note This is **optional hardening**, not a live bug — #918 already suppresses the phantom at the source (`scripts/rehearsal-cycle.sh`). This adds a second, run-dir-independent guard. *Filed by the Sandcastle worker that fixed #918, per Rule 9.*
Author
Member

Close-report — landed & proven (Ruled by agent under ADR 0174 — veto anytime)

What landed (commit d0a74a65, on origin/main): the report/heal side now re-runs the #600 bootstrap-staleness gate, closing the defense-in-depth gap #918 flagged but could not land (protected .sandcastle/ paths, #445).

Why it matters. The #600 gate runs only in the drive's preflight. A commit that lands on main during a drive (~20-30 min) leaves the served get.idss.nz pin stale by report/heal time, so the leg red is a probable ghost of a fix already on main — and a fresh drive would PARK at the #600 preflight rather than re-run those bits, so a leg-red filed here can never be disproven by a re-drive: the exact #918 deadlock, in the window preflight cannot see. The 2026-08-27/28 storm burned the embedded healer three attempts (two rebase conflicts, one diff-cap breach) re-fixing an already-on-main red.

The change

  • scripts/lib/bootstrap-staleness-lib.sh (editable): oc_bootstrap_served_release (the x-idss-release read, with an OC_BOOTSTRAP_SERVED_RELEASE offline seam) + oc_bootstrap_report_guard (pure git over oc_bootstrap_staleness; emits ghost|proceed).
  • .sandcastle/rehearsal-report.sh (protected — the session's ruling): before the per-leg file/heal loop, scoped to the selfhosted/idip targets that fetch the pinned agent, re-evaluate the gate run-dir-independently. On a stale pin → route to the ONE idempotent staleness ticket (#918's rehearsal_staleness_park) instead of a blocking leg-red, and exit 0 before the healer's per-leg call — so the healer is never offered the ghost (one live check delivers both the reporter-suppress and the healer-refuse behaviours). The drive issue stays unblocked so the next tick re-parks at preflight until the reseed timer republishes get.idss.nz (mirrors rehearsal-cycle.sh's park-staleness branch).
  • scripts/tests/bootstrap-staleness-test.sh (editable): 6 new offline checks (14 total, all green) — guard tokens (ghost on a stale pin, proceed on fresh/unusable/empty), the served-release override seam, and a grep-assert that the reporter wires the guard.

Fail-OPEN by design. Fresh, unusable, or an unreachable bootstrap proceeds exactly as before — an unprovable staleness never suppresses a real red (the asymmetry #918 teaches: a dropped real red is worse than a re-filed ghost the next drive converges away).

Why this was a two-way door, not ready-for-human. Entirely within the report/heal path; revertible by a single commit; provable offline against bootstrap-staleness-lib.sh's existing test shape (bash scripts/tests/bootstrap-staleness-test.sh → 14 checks; also picked up by scripts/seam-smoke.sh's scripts/tests/*.sh sweep). No one-way door (no credentials, no security widening, no member-facing trust, no data loss, no spend).

Scope note. The substantive reporter and healer both live in .sandcastle/rehearsal-report.sh (the reporter's main flow files leg-reds; its embedded try_heal is the healer). .sandcastle/heal.sh is the swarm healer for CI/swarm/triage/smoke-drive incidents — none of which fetch the agent binary from get.idss.nz, so the served-pin ghost check does not map there; it was intentionally left untouched.

Verified: bash -n on the reporter, the full offline scripts/tests/*.sh sweep green, rebased on origin/main and pushed (f618a6ce..d0a74a65). STATUS.md updated in the same commit. Closing.

## Close-report — landed & proven (Ruled by agent under ADR 0174 — veto anytime) **What landed** (commit `d0a74a65`, on `origin/main`): the report/heal side now re-runs the #600 bootstrap-staleness gate, closing the defense-in-depth gap #918 flagged but could not land (protected `.sandcastle/` paths, #445). **Why it matters.** The #600 gate runs only in the drive's *preflight*. A commit that lands on `main` *during* a drive (~20-30 min) leaves the served `get.idss.nz` pin stale by report/heal time, so the leg red is a probable ghost of a fix already on `main` — and a fresh drive would **PARK** at the #600 preflight rather than re-run those bits, so a leg-red filed here can *never* be disproven by a re-drive: the exact #918 deadlock, in the window preflight cannot see. The 2026-08-27/28 storm burned the embedded healer three attempts (two rebase conflicts, one diff-cap breach) re-fixing an already-on-`main` red. **The change** - `scripts/lib/bootstrap-staleness-lib.sh` (editable): `oc_bootstrap_served_release` (the `x-idss-release` read, with an `OC_BOOTSTRAP_SERVED_RELEASE` offline seam) + `oc_bootstrap_report_guard` (pure git over `oc_bootstrap_staleness`; emits `ghost`|`proceed`). - `.sandcastle/rehearsal-report.sh` (protected — the session's ruling): before the per-leg file/heal loop, **scoped to the selfhosted/idip targets that fetch the pinned agent**, re-evaluate the gate run-dir-independently. On a stale pin → route to the ONE idempotent staleness ticket (#918's `rehearsal_staleness_park`) instead of a blocking leg-red, and `exit 0` **before** the healer's per-leg call — so the healer is never offered the ghost (one live check delivers both the reporter-suppress and the healer-refuse behaviours). The drive issue stays **unblocked** so the next tick re-parks at preflight until the reseed timer republishes `get.idss.nz` (mirrors `rehearsal-cycle.sh`'s `park-staleness` branch). - `scripts/tests/bootstrap-staleness-test.sh` (editable): 6 new offline checks (**14 total, all green**) — guard tokens (`ghost` on a stale pin, `proceed` on fresh/unusable/empty), the served-release override seam, and a grep-assert that the reporter wires the guard. **Fail-OPEN by design.** Fresh, unusable, or an unreachable bootstrap proceeds exactly as before — an unprovable staleness never suppresses a real red (the asymmetry #918 teaches: a dropped real red is worse than a re-filed ghost the next drive converges away). **Why this was a two-way door, not `ready-for-human`.** Entirely within the report/heal path; revertible by a single commit; provable offline against `bootstrap-staleness-lib.sh`'s existing test shape (`bash scripts/tests/bootstrap-staleness-test.sh` → 14 checks; also picked up by `scripts/seam-smoke.sh`'s `scripts/tests/*.sh` sweep). No one-way door (no credentials, no security widening, no member-facing trust, no data loss, no spend). **Scope note.** The substantive reporter *and* healer both live in `.sandcastle/rehearsal-report.sh` (the reporter's main flow files leg-reds; its embedded `try_heal` is the healer). `.sandcastle/heal.sh` is the *swarm* healer for CI/swarm/triage/smoke-drive incidents — none of which fetch the agent binary from `get.idss.nz`, so the served-pin ghost check does not map there; it was intentionally left untouched. Verified: `bash -n` on the reporter, the full offline `scripts/tests/*.sh` sweep green, rebased on `origin/main` and pushed (`f618a6ce..d0a74a65`). `STATUS.md` updated in the same commit. Closing.
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.

Dependencies

No dependencies set.

Reference
Matou/idss#919
No description provided.