e2e preflight: bootstrap-staleness gate — park the drive when get.idss.nz's pin predates agent-affecting commits #600

Closed
opened 2026-08-19 22:02:26 +00:00 by ben · 4 comments
Owner

Problem

Drives burn full runs (and file red tickets) against a get.idss.nz pin that predates the very fix they're testing. Proven twice on 2026-08-19:

  • #597's socket-bind fix landed as 95c428f at 21:01Z; drive 20260819T210458Z ran at 21:06Z against pin 75dfba9 (2026-08-15, four days stale) and went red on the already-fixed signature → #598 filed, diagnosed, routed ready-for-human — ~2h of loop latency and a human unblock for a ghost.
  • The pin wasn't only drift: a session had deliberately re-staged 75dfba9 for the ADR 0181 install-script work. Two writers, no shared freshness rule (the pin policy is #601's ADR; this ticket is the cheap guard that works under any policy).

What to build

Extend the drive preflight with a bootstrap-staleness gate, the exact pattern of the existing payload-staleness gate (phase 2 precedent, e2e preflight):

  1. Preflight fetches HEAD https://get.idss.nz/get?arch=x86_64 and reads x-ourcloud-release (already the diagnostic of record — #598's diagnosis used it; reachable from the workstation, no new door needed).
  2. Gate rule: the served release must be an ancestor-or-equal of origin/main and must not predate any commit the drive exists to verify. Minimum viable check: git merge-base --is-ancestor <served> origin/main (sanity — the pin is a real main commit) plus a freshness bound: fail if git rev-list --count <served>..origin/main touching agent/ exceeds 0 (i.e. agent-affecting commits landed after the pin). Scope the path filter to what changes the served binary: agent/, go.mod, go.sum, and shared internal/ packages the agent imports — start broad (agent/ go.mod go.sum internal/), tighten later.
  3. On staleness: park loudly, don't drive — exit the preflight with a distinct verdict (bootstrap-stale: served <sha> is N agent-commits behind origin/main) so the reporter files/updates ONE staleness ticket instead of a misleading leg-red ticket. Include the served sha, the newest agent-affecting sha, and the reseed recipe pointer (below).
  4. Fixture self-test in .sandcastle/tests/ per the house preflight pattern: fake header vs fake git history, both directions (fresh passes, stale parks). Offline — no live probe in tests.

Reseed recipe (for the parked ticket's body)

git archive origin/main | tar -x, CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o agent-x86_64 ./agent/cmd/agent, scp to the mail droplet /tmp, sudo install both agent-x86_64 (0755) and RELEASE (= built sha, 0644) into /opt/ourcloud-bootstrap/artifacts/. No service restart (dirSource reads per request). Verify: x-ourcloud-release header. Note: artifacts dir is root-owned and the host is unreachable from the workstation — reseeds are Ben's laptop until #601 lands.

Acceptance

  • A drive attempted against a pin missing a newer agent-affecting commit parks in preflight with the staleness verdict; no leg-red ticket is filed for it.
  • A drive against a fresh pin proceeds exactly as today.
  • Self-tests green offline; no live network in tests.

Evidence trail: #597, #598 (both closed 2026-08-19), reseed proof on #598's close comment.

## Problem Drives burn full runs (and file red tickets) against a get.idss.nz pin that predates the very fix they're testing. Proven twice on 2026-08-19: - `#597`'s socket-bind fix landed as `95c428f` at 21:01Z; drive `20260819T210458Z` ran at 21:06Z against pin `75dfba9` (2026-08-15, four days stale) and went red on the already-fixed signature → `#598` filed, diagnosed, routed `ready-for-human` — ~2h of loop latency and a human unblock for a ghost. - The pin wasn't only drift: a session had deliberately re-staged `75dfba9` for the ADR 0181 install-script work. Two writers, no shared freshness rule (the pin *policy* is `#601`'s ADR; this ticket is the cheap guard that works under any policy). ## What to build Extend the drive **preflight** with a bootstrap-staleness gate, the exact pattern of the existing payload-staleness gate (phase 2 precedent, e2e preflight): 1. Preflight fetches `HEAD https://get.idss.nz/get?arch=x86_64` and reads `x-ourcloud-release` (already the diagnostic of record — `#598`'s diagnosis used it; reachable from the workstation, no new door needed). 2. Gate rule: the served release must be an ancestor-or-equal of `origin/main` **and** must not predate any commit the drive exists to verify. Minimum viable check: `git merge-base --is-ancestor <served> origin/main` (sanity — the pin is a real main commit) **plus** a freshness bound: fail if `git rev-list --count <served>..origin/main` touching `agent/` exceeds 0 (i.e. agent-affecting commits landed after the pin). Scope the path filter to what changes the served binary: `agent/`, `go.mod`, `go.sum`, and shared `internal/` packages the agent imports — start broad (`agent/ go.mod go.sum internal/`), tighten later. 3. On staleness: **park loudly, don't drive** — exit the preflight with a distinct verdict (`bootstrap-stale: served <sha> is N agent-commits behind origin/main`) so the reporter files/updates ONE staleness ticket instead of a misleading leg-red ticket. Include the served sha, the newest agent-affecting sha, and the reseed recipe pointer (below). 4. Fixture self-test in `.sandcastle/tests/` per the house preflight pattern: fake header vs fake git history, both directions (fresh passes, stale parks). Offline — no live probe in tests. ## Reseed recipe (for the parked ticket's body) `git archive origin/main | tar -x`, `CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o agent-x86_64 ./agent/cmd/agent`, scp to the mail droplet `/tmp`, `sudo install` both `agent-x86_64` (0755) and `RELEASE` (= built sha, 0644) into `/opt/ourcloud-bootstrap/artifacts/`. No service restart (dirSource reads per request). Verify: `x-ourcloud-release` header. Note: artifacts dir is root-owned and the host is unreachable from the workstation — reseeds are Ben's laptop until `#601` lands. ## Acceptance - A drive attempted against a pin missing a newer agent-affecting commit parks in preflight with the staleness verdict; no leg-red ticket is filed for it. - A drive against a fresh pin proceeds exactly as today. - Self-tests green offline; no live network in tests. Evidence trail: #597, #598 (both closed 2026-08-19), reseed proof on #598's close comment.

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

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

From the duplicate #604, one addition worth folding in: when the preflight staleness gate reds, the reporter should treat that signature as an ops action (re-stage needed — runbook pointer), never filing/matching a code ticket for it.

From the duplicate #604, one addition worth folding in: when the preflight staleness gate reds, the reporter should treat that signature as an ops action (re-stage needed — runbook pointer), never filing/matching a code ticket for it.

close-report for #600 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit ebbbd2bf3e is not reachable from origin/main (not landed on main)
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
  • changed_files: 'scripts/lib/bootstrap-staleness-lib.sh' is not in the diff of the claimed commits
  • changed_files: 'scripts/smoke-private-path.sh' is not in the diff of the claimed commits
  • changed_files: 'scripts/tests/bootstrap-staleness-test.sh' is not in the diff of the claimed commits
envelope
{
  "issue": 600,
  "status": "success",
  "commits": [
    "ebbbd2bf3ea515a3baaaea4d274b7a3007d6013d"
  ],
  "changed_files": [
    "STATUS.md",
    "scripts/lib/bootstrap-staleness-lib.sh",
    "scripts/smoke-private-path.sh",
    "scripts/tests/bootstrap-staleness-test.sh"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/bootstrap-staleness-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/swarm-identity-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash -n scripts/smoke-private-path.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A drive attempted against a pin missing a newer agent-affecting commit parks in preflight with the staleness verdict; no leg-red ticket is filed for it": "scripts/smoke-private-path.sh selfhosted preflight calls oc_bootstrap_staleness (scripts/lib/bootstrap-staleness-lib.sh); a stale pin returns rc=1 with a `bootstrap-stale: served <sha> is N agent-commit(s) behind origin/main` verdict which the preflight die_host()s on — an exit-3 refusal that creates NO run dir, so rehearsal-cycle.sh's no-run-dir branch skips the reporter (files no leg-red ticket). Proven offline by bootstrap-staleness-test.sh checks 3+4 (agent/ and internal/ commits behind the pin park with rc=1).",
    "A drive against a fresh pin proceeds exactly as today": "The gate is guarded to `target == selfhosted` and returns rc=0 (no die_host) when the served pin is base tip or behind only agent-irrelevant churn; other targets never parse it. Proven by bootstrap-staleness-test.sh checks 1 (tip pin fresh) and 2 (docs-only-behind pin fresh).",
    "Self-tests green offline; no live network in tests": "scripts/tests/bootstrap-staleness-test.sh builds a throwaway git repo and calls the pure-git oc_bootstrap_staleness with fake served shas — no curl, no network; 8 checks pass (exit 0). The live header HEAD lives only in the preflight caller, not the test."
  },
  "summary": "Added a bootstrap-staleness preflight gate that parks the self-hosted drive (exit-3, no leg-red ticket) when get.idss.nz's served x-ourcloud-release pin predates any agent-affecting commit, closing the #597->#598 stale-pin ghost.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #600 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit ebbbd2bf3ea515a3baaaea4d274b7a3007d6013d is not reachable from origin/main (not landed on main) - changed_files: 'STATUS.md' is not in the diff of the claimed commits - changed_files: 'scripts/lib/bootstrap-staleness-lib.sh' is not in the diff of the claimed commits - changed_files: 'scripts/smoke-private-path.sh' is not in the diff of the claimed commits - changed_files: 'scripts/tests/bootstrap-staleness-test.sh' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 600, "status": "success", "commits": [ "ebbbd2bf3ea515a3baaaea4d274b7a3007d6013d" ], "changed_files": [ "STATUS.md", "scripts/lib/bootstrap-staleness-lib.sh", "scripts/smoke-private-path.sh", "scripts/tests/bootstrap-staleness-test.sh" ], "tests": [ { "command": "bash scripts/tests/bootstrap-staleness-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/swarm-identity-test.sh", "exit_code": 0 }, { "command": "bash -n scripts/smoke-private-path.sh", "exit_code": 0 } ], "criteria": { "A drive attempted against a pin missing a newer agent-affecting commit parks in preflight with the staleness verdict; no leg-red ticket is filed for it": "scripts/smoke-private-path.sh selfhosted preflight calls oc_bootstrap_staleness (scripts/lib/bootstrap-staleness-lib.sh); a stale pin returns rc=1 with a `bootstrap-stale: served <sha> is N agent-commit(s) behind origin/main` verdict which the preflight die_host()s on — an exit-3 refusal that creates NO run dir, so rehearsal-cycle.sh's no-run-dir branch skips the reporter (files no leg-red ticket). Proven offline by bootstrap-staleness-test.sh checks 3+4 (agent/ and internal/ commits behind the pin park with rc=1).", "A drive against a fresh pin proceeds exactly as today": "The gate is guarded to `target == selfhosted` and returns rc=0 (no die_host) when the served pin is base tip or behind only agent-irrelevant churn; other targets never parse it. Proven by bootstrap-staleness-test.sh checks 1 (tip pin fresh) and 2 (docs-only-behind pin fresh).", "Self-tests green offline; no live network in tests": "scripts/tests/bootstrap-staleness-test.sh builds a throwaway git repo and calls the pure-git oc_bootstrap_staleness with fake served shas — no curl, no network; 8 checks pass (exit 0). The live header HEAD lives only in the preflight caller, not the test." }, "summary": "Added a bootstrap-staleness preflight gate that parks the self-hosted drive (exit-3, no leg-red ticket) when get.idss.nz's served x-ourcloud-release pin predates any agent-affecting commit, closing the #597->#598 stale-pin ghost.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>

close-report for #600 — status success

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

envelope
{
  "issue": 600,
  "status": "success",
  "commits": [
    "ebbbd2bf3ea515a3baaaea4d274b7a3007d6013d"
  ],
  "changed_files": [
    "STATUS.md",
    "scripts/lib/bootstrap-staleness-lib.sh",
    "scripts/smoke-private-path.sh",
    "scripts/tests/bootstrap-staleness-test.sh"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/bootstrap-staleness-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/swarm-identity-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash -n scripts/smoke-private-path.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A drive attempted against a pin missing a newer agent-affecting commit parks in preflight with the staleness verdict; no leg-red ticket is filed for it": "scripts/smoke-private-path.sh selfhosted preflight calls oc_bootstrap_staleness (scripts/lib/bootstrap-staleness-lib.sh); a stale pin returns rc=1 with a `bootstrap-stale: served <sha> is N agent-commit(s) behind origin/main` verdict which the preflight die_host()s on — an exit-3 refusal that creates NO run dir, so rehearsal-cycle.sh's no-run-dir branch skips the reporter (files no leg-red ticket). Proven offline by bootstrap-staleness-test.sh checks 3+4 (agent/ and internal/ commits behind the pin park with rc=1).",
    "A drive against a fresh pin proceeds exactly as today": "The gate is guarded to `target == selfhosted` and returns rc=0 (no die_host) when the served pin is base tip or behind only agent-irrelevant churn; other targets never parse it. Proven by bootstrap-staleness-test.sh checks 1 (tip pin fresh) and 2 (docs-only-behind pin fresh).",
    "Self-tests green offline; no live network in tests": "scripts/tests/bootstrap-staleness-test.sh builds a throwaway git repo and calls the pure-git oc_bootstrap_staleness with fake served shas — no curl, no network; 8 checks pass (exit 0). The live header HEAD lives only in the preflight caller, not the test."
  },
  "summary": "Added a bootstrap-staleness preflight gate that parks the self-hosted drive (exit-3, no leg-red ticket) when get.idss.nz's served x-ourcloud-release pin predates any agent-affecting commit, closing the #597->#598 stale-pin ghost.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #600 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 600, "status": "success", "commits": [ "ebbbd2bf3ea515a3baaaea4d274b7a3007d6013d" ], "changed_files": [ "STATUS.md", "scripts/lib/bootstrap-staleness-lib.sh", "scripts/smoke-private-path.sh", "scripts/tests/bootstrap-staleness-test.sh" ], "tests": [ { "command": "bash scripts/tests/bootstrap-staleness-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/swarm-identity-test.sh", "exit_code": 0 }, { "command": "bash -n scripts/smoke-private-path.sh", "exit_code": 0 } ], "criteria": { "A drive attempted against a pin missing a newer agent-affecting commit parks in preflight with the staleness verdict; no leg-red ticket is filed for it": "scripts/smoke-private-path.sh selfhosted preflight calls oc_bootstrap_staleness (scripts/lib/bootstrap-staleness-lib.sh); a stale pin returns rc=1 with a `bootstrap-stale: served <sha> is N agent-commit(s) behind origin/main` verdict which the preflight die_host()s on — an exit-3 refusal that creates NO run dir, so rehearsal-cycle.sh's no-run-dir branch skips the reporter (files no leg-red ticket). Proven offline by bootstrap-staleness-test.sh checks 3+4 (agent/ and internal/ commits behind the pin park with rc=1).", "A drive against a fresh pin proceeds exactly as today": "The gate is guarded to `target == selfhosted` and returns rc=0 (no die_host) when the served pin is base tip or behind only agent-irrelevant churn; other targets never parse it. Proven by bootstrap-staleness-test.sh checks 1 (tip pin fresh) and 2 (docs-only-behind pin fresh).", "Self-tests green offline; no live network in tests": "scripts/tests/bootstrap-staleness-test.sh builds a throwaway git repo and calls the pure-git oc_bootstrap_staleness with fake served shas — no curl, no network; 8 checks pass (exit 0). The live header HEAD lives only in the preflight caller, not the test." }, "summary": "Added a bootstrap-staleness preflight gate that parks the self-hosted drive (exit-3, no leg-red ticket) when get.idss.nz's served x-ourcloud-release pin predates any agent-affecting commit, closing the #597->#598 stale-pin ghost.", "reason": "", "blockers": [], "no_code_change": "" } ``` </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#600
No description provided.