rehearsal drive checkout is wedged on a stale SHA — #766's sync-gate fix cannot reach the gate it fixes, so invite-member re-fires an already-healed red #768

Closed
opened 2026-08-25 03:00:39 +00:00 by matou-build-agent · 2 comments

Failure

Drive 20260825T024644Z (target droplet, 24 green / 1 red / 1 skip, firstRedLeg: invite-member) red on:

member landed cleanly on /settings/admin (HTTP 403, url "https://files.rehearsal-b.idss.nz/settings/admin")
with no redirect and no access-denied marker — a plain member must never reach the admin screen
(DDR 0173 story 11, story 4)

Product authorization is correct. Nextcloud 32 returned a bare 403 — the member was refused. This is the same false red #765 diagnosed and a9bc6b5 healed at 02:19, and that #766 diagnosed again at 02:44. It re-fired because the drive did not run the code on origin/main.

Evidence

1. The failure text is the pre-heal wording. artifacts/journey.droplet-*/error-context.md quotes the throw at provision.ts:874-879 reading with no redirect and no access-denied marker. On origin/main that string is with no 403, no redirect and no access-denied marker — app/tests/e2e/fixtures/provision.ts:928. The evidence bundle carries the old assertion body verbatim (no readMemberAdminDenial call; origin/main has it at provision.ts:871 and :916).

2. The drive checkout is three commits stale.

$ git -C /home/dev/swarm/Matou/idss rev-parse HEAD
c9d0c61cc8e52380f54bb61d686ce790aa308220   # "research: land the three IDIP map research docs"
$ git -C /home/dev/swarm/Matou/idss rev-parse origin/main
c9d0c61cc8e52380f54bb61d686ce790aa308220   # the remote-tracking ref is ITSELF stale
$ cat /home/dev/swarm/Matou/idss/.git/FETCH_HEAD
c9d0c61c...  branch 'main' of https://git.matou.nz/Matou/idss   # mtime 01:30 — the drive started 02:46

origin/main is actually 2a37ef82. Missing from the drive checkout: a9bc6b5d (#765, the 403 heal, 02:19) and 56ea196a (#766, the sync-gate heal, 02:44).

3. The gate that should have pulled is the one #766 fixed — a bootstrap deadlock. In the drive checkout:

scripts/rehearsal-cycle.sh:157: if [ -z "$(git status --porcelain)" ] && [ "$(git branch --show-current)" = "main" ]; then
scripts/rehearsal-cycle.sh:159:   git fetch origin && git pull --ff-only origin main

Bare --porcelain counts untracked files. Two strays are present and make it read dirty:

  • .sandcastle/.env.bak-20260822T113103Z (Aug 22, harness stray)
  • docs/adr/0194-host-baseline-is-a-property-of-the-host-shape-not-the-install-mode.md (Aug 23, untracked draft)

So the if never fires, git fetch never runs, and the checkout can never learn that origin/main moved. Meanwhile the drive checkout's tracked tree is clean and its branch is main:

$ git -C /home/dev/swarm/Matou/idss status --porcelain --untracked-files=no
(empty)
$ git -C /home/dev/swarm/Matou/idss branch --show-current
main

which is exactly the state #766's gate treats as syncable (scripts/lib/rehearsal-sync-lib.sh:19-22; caller at scripts/rehearsal-cycle.sh:165). The fix is correct and it is on main; it simply cannot reach the checkout, because the only path that would deliver it is the code it replaces. Every future cycle re-runs line 157, re-reads the strays as dirt, and re-drives c9d0c61c.

4. No path collision blocks the pull. The untracked 0194-host-baseline-*.md is a different filename from the tracked 0194-founding-asks-the-identity-question-idip-opt-in.md (number collision only), so a git pull --ff-only would fast-forward cleanly today. The wedge is purely the gate, not a merge conflict.

5. The post-drive reporter is not an escape hatch. .sandcastle/rehearsal-report.sh:218,231,238,246 run git -C "$co" reset --hard "$pre_head" — a rollback to the drive's own pre-run HEAD, to discard healer edits. It never fetches and never targets origin/main, so it cannot advance a stale checkout either.

Suspected layer

Harness / rehearsal cycle (scripts/rehearsal-cycle.sh). Not the product, and not the e2e assertion — both are already correct on origin/main. Verified on this machine at 2a37ef82:

  • pnpm --filter app exec vitest run tests/e2e/fixtures/provision.test.ts → 13/13 passed (includes the six readMemberAdminDenial cases; a bare 403 at /settings/admin reads denied).
  • scripts/tests/rehearsal-sync-test.sh → OK: 6 checks passed (rehearsal sync gate #766).

This is the second instance of the class recorded as docs/GOTCHAS.md #82 — "A green heal is not a LANDED heal until the drive checkout provably carries it". #766 wrote the entry; this ticket is the follow-through, because the entry's own plug is what got stranded.

What plugging it needs

(a) One-time unwedge — a prerequisite, and it is NOT something a worktree-scoped worker can do. The drive checkout is outside any worktree; someone (operator or the cycle runner on matou-workstation) must run, once:

git -C /home/dev/swarm/Matou/idss fetch origin
git -C /home/dev/swarm/Matou/idss pull --ff-only origin main   # fast-forwards c9d0c61c -> 2a37ef82, no collision

Optionally remove the two strays. Until this runs, landing any further code on main changes nothing — the next drive still re-fires this red and burns another paid droplet.

(b) Make the gate bootstrap-proof, so a stray can never again pin the checkout to a revision. git fetch writes only to .git; it can never yank in-flight work, so it must not sit behind the dirt gate. In scripts/rehearsal-cycle.sh, hoist git fetch origin above the rehearsal_should_sync decision and let only git pull --ff-only remain gated. Then the checkout always knows where origin/main is, whatever the worktree looks like.

(c) Refuse to drive a knowingly-stale checkout. After the gate, compare git rev-parse HEAD to git rev-parse origin/main. If they differ, do not spend a droplet on a revision main has already moved past — fail the cycle loudly with both SHAs, or at minimum escalate the existing THE DRIVE MAY BE STALE warning (scripts/rehearsal-cycle.sh:176) into the verdict. #766 already added VerdictJson.commit / driveCommit() (app/tests/e2e/fixtures/legs.ts) so the bundle can carry the driven SHA — note that artifacts/verdict.json in THIS run has no commit field, which is itself the tell that the driven code predates 56ea196a. Extend the decision in scripts/lib/rehearsal-sync-lib.sh with the offline test alongside it in scripts/tests/rehearsal-sync-test.sh, per the established scripts/lib + scripts/tests convention.

No product change. No STATUS.md movement (harness-reliability fix, per #765/#766/#755).

drive 20260825T024644Z red at invite-member: member landed cleanly on /settings/admin (HTTP 403, url "https://files.rehearsal-b.idss.nz/settings/admin") with no redirect and no access-denied marker — a plain member must never reach the admin s
evidence: test-results/…/20260825T024644Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure Drive `20260825T024644Z` (target `droplet`, 24 green / 1 red / 1 skip, `firstRedLeg: invite-member`) red on: ``` member landed cleanly on /settings/admin (HTTP 403, url "https://files.rehearsal-b.idss.nz/settings/admin") with no redirect and no access-denied marker — a plain member must never reach the admin screen (DDR 0173 story 11, story 4) ``` **Product authorization is correct.** Nextcloud 32 returned a bare `403` — the member *was* refused. This is the same false red `#765` diagnosed and `a9bc6b5` healed at 02:19, and that `#766` diagnosed again at 02:44. It re-fired because **the drive did not run the code on `origin/main`.** ## Evidence **1. The failure text is the pre-heal wording.** `artifacts/journey.droplet-*/error-context.md` quotes the throw at `provision.ts:874-879` reading `with no redirect and no access-denied marker`. On `origin/main` that string is `with no 403, no redirect and no access-denied marker` — `app/tests/e2e/fixtures/provision.ts:928`. The evidence bundle carries the *old* assertion body verbatim (no `readMemberAdminDenial` call; `origin/main` has it at `provision.ts:871` and `:916`). **2. The drive checkout is three commits stale.** ``` $ git -C /home/dev/swarm/Matou/idss rev-parse HEAD c9d0c61cc8e52380f54bb61d686ce790aa308220 # "research: land the three IDIP map research docs" $ git -C /home/dev/swarm/Matou/idss rev-parse origin/main c9d0c61cc8e52380f54bb61d686ce790aa308220 # the remote-tracking ref is ITSELF stale $ cat /home/dev/swarm/Matou/idss/.git/FETCH_HEAD c9d0c61c... branch 'main' of https://git.matou.nz/Matou/idss # mtime 01:30 — the drive started 02:46 ``` `origin/main` is actually `2a37ef82`. Missing from the drive checkout: `a9bc6b5d` (#765, the 403 heal, 02:19) and `56ea196a` (#766, the sync-gate heal, 02:44). **3. The gate that should have pulled is the one `#766` fixed — a bootstrap deadlock.** In the drive checkout: ``` scripts/rehearsal-cycle.sh:157: if [ -z "$(git status --porcelain)" ] && [ "$(git branch --show-current)" = "main" ]; then scripts/rehearsal-cycle.sh:159: git fetch origin && git pull --ff-only origin main ``` Bare `--porcelain` counts untracked files. Two strays are present and make it read dirty: - `.sandcastle/.env.bak-20260822T113103Z` (Aug 22, harness stray) - `docs/adr/0194-host-baseline-is-a-property-of-the-host-shape-not-the-install-mode.md` (Aug 23, untracked draft) So the `if` never fires, `git fetch` never runs, and the checkout can never learn that `origin/main` moved. Meanwhile the drive checkout's **tracked** tree is clean and its branch is `main`: ``` $ git -C /home/dev/swarm/Matou/idss status --porcelain --untracked-files=no (empty) $ git -C /home/dev/swarm/Matou/idss branch --show-current main ``` which is exactly the state `#766`'s gate treats as syncable (`scripts/lib/rehearsal-sync-lib.sh:19-22`; caller at `scripts/rehearsal-cycle.sh:165`). **The fix is correct and it is on main; it simply cannot reach the checkout, because the only path that would deliver it is the code it replaces.** Every future cycle re-runs line 157, re-reads the strays as dirt, and re-drives `c9d0c61c`. **4. No path collision blocks the pull.** The untracked `0194-host-baseline-*.md` is a *different filename* from the tracked `0194-founding-asks-the-identity-question-idip-opt-in.md` (number collision only), so a `git pull --ff-only` would fast-forward cleanly today. The wedge is purely the gate, not a merge conflict. **5. The post-drive reporter is not an escape hatch.** `.sandcastle/rehearsal-report.sh:218,231,238,246` run `git -C "$co" reset --hard "$pre_head"` — a rollback to the drive's *own* pre-run HEAD, to discard healer edits. It never fetches and never targets `origin/main`, so it cannot advance a stale checkout either. ## Suspected layer Harness / rehearsal cycle (`scripts/rehearsal-cycle.sh`). **Not the product, and not the e2e assertion** — both are already correct on `origin/main`. Verified on this machine at `2a37ef82`: - `pnpm --filter app exec vitest run tests/e2e/fixtures/provision.test.ts` → **13/13 passed** (includes the six `readMemberAdminDenial` cases; a bare 403 at `/settings/admin` reads `denied`). - `scripts/tests/rehearsal-sync-test.sh` → **OK: 6 checks passed (rehearsal sync gate #766)**. This is the second instance of the class recorded as `docs/GOTCHAS.md` #82 — "A green heal is not a LANDED heal until the drive checkout provably carries it". `#766` wrote the entry; this ticket is the follow-through, because the entry's own plug is what got stranded. ## What plugging it needs **(a) One-time unwedge — a prerequisite, and it is NOT something a worktree-scoped worker can do.** The drive checkout is outside any worktree; someone (operator or the cycle runner on `matou-workstation`) must run, once: ``` git -C /home/dev/swarm/Matou/idss fetch origin git -C /home/dev/swarm/Matou/idss pull --ff-only origin main # fast-forwards c9d0c61c -> 2a37ef82, no collision ``` Optionally remove the two strays. **Until this runs, landing any further code on `main` changes nothing** — the next drive still re-fires this red and burns another paid droplet. **(b) Make the gate bootstrap-proof, so a stray can never again pin the checkout to a revision.** `git fetch` writes only to `.git`; it can never yank in-flight work, so it must not sit behind the dirt gate. In `scripts/rehearsal-cycle.sh`, hoist `git fetch origin` *above* the `rehearsal_should_sync` decision and let only `git pull --ff-only` remain gated. Then the checkout always knows where `origin/main` is, whatever the worktree looks like. **(c) Refuse to drive a knowingly-stale checkout.** After the gate, compare `git rev-parse HEAD` to `git rev-parse origin/main`. If they differ, do not spend a droplet on a revision main has already moved past — fail the cycle loudly with both SHAs, or at minimum escalate the existing `THE DRIVE MAY BE STALE` warning (`scripts/rehearsal-cycle.sh:176`) into the verdict. `#766` already added `VerdictJson.commit` / `driveCommit()` (`app/tests/e2e/fixtures/legs.ts`) so the bundle can carry the driven SHA — note that `artifacts/verdict.json` in THIS run has no `commit` field, which is itself the tell that the driven code predates `56ea196a`. Extend the decision in `scripts/lib/rehearsal-sync-lib.sh` with the offline test alongside it in `scripts/tests/rehearsal-sync-test.sh`, per the established `scripts/lib` + `scripts/tests` convention. No product change. No `STATUS.md` movement (harness-reliability fix, per `#765`/`#766`/`#755`). drive `20260825T024644Z` red at `invite-member`: `member landed cleanly on /settings/admin (HTTP 403, url "https://files.rehearsal-b.idss.nz/settings/admin") with no redirect and no access-denied marker — a plain member must never reach the admin s` evidence: `test-results/…/20260825T024644Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 1dc3e7a84786 -->
Author
Member

Code portion landed — one operator step remains (part (a))

The two bootstrap-proofing fixes this ticket asks a worker to land are on origin/main at commit 159c4b1:

  • (b) git fetch origin now runs unconditionally, above the rehearsal_should_sync gate in scripts/rehearsal-cycle.sh — a fetch only writes .git, never the worktree, so it can never yank in-flight work and must not sit behind the dirt gate. Only git pull --ff-only stays gated (still non-fatal on an untracked-path collision).
  • (c) new pure decision rehearsal_refuse_stale in scripts/lib/rehearsal-sync-lib.sh: after the gate, when a sync was intended (tracked-clean main) but HEAD still differs from origin/main, the cycle exits FATAL with both SHAs rather than burning a droplet on a revision main has moved past. A dirty / non-main tree (intended==0) is intentional in-flight work and is exempt.

Tests: scripts/tests/rehearsal-sync-test.sh extended 6 → 12 checks (fixed check 6 for the hoisted fetch; added 7–12 covering the un-gated fetch call site and the four rehearsal_refuse_stale cases) — passes. bash -n clean on all three scripts. GOTCHAS #82 gains a follow-through note.

Why human — part (a), the one-time unwedge, is NOT worktree-scoped

Part (a) of the ticket is explicit: the drive checkout /home/dev/swarm/Matou/idss is outside any worktree and unreachable from a Sandcastle worker's sandbox (verified: ls -d /home/dev/swarm/Matou/idss → No such file or directory on this host). It needs the operator's hands on real hardware (the cycle runner on matou-workstation) — the ready-for-human bar. Until it runs, the live checkout still executes stale c9d0c61 code (which lacks even #766's and this fix), so the next drive re-fires the healed red and burns another paid droplet. This landed code cannot yet run itself — that is exactly the deadlock (b) breaks going forward.

Run once, on the drive host:

git -C /home/dev/swarm/Matou/idss fetch origin
git -C /home/dev/swarm/Matou/idss pull --ff-only origin main   # fast-forwards c9d0c61 -> HEAD, no path collision (#768 evidence §4)
# optional: rm the two untracked strays
#   .sandcastle/.env.bak-20260822T113103Z
#   docs/adr/0194-host-baseline-is-a-property-of-the-host-shape-not-the-install-mode.md

After that pull, every future cycle is bootstrap-proof (the fetch is un-gated) and a stale checkout refuses loudly instead of driving. This issue can then be closed — the code half is already done and verified; only the operator action is outstanding.

Leaving open with ready-for-human (per GOTCHAS #82's own rule: a green heal is not a LANDED heal until the drive checkout provably carries it — closing this while the live checkout provably does not yet carry it would repeat the exact anti-pattern this ticket exists to end).

## Code portion landed — one operator step remains (part (a)) The two bootstrap-proofing fixes this ticket asks a worker to land are **on `origin/main` at commit `159c4b1`**: - **(b)** `git fetch origin` now runs **unconditionally, above** the `rehearsal_should_sync` gate in `scripts/rehearsal-cycle.sh` — a fetch only writes `.git`, never the worktree, so it can never yank in-flight work and must not sit behind the dirt gate. Only `git pull --ff-only` stays gated (still non-fatal on an untracked-path collision). - **(c)** new pure decision `rehearsal_refuse_stale` in `scripts/lib/rehearsal-sync-lib.sh`: after the gate, when a sync was **intended** (tracked-clean main) but `HEAD` still differs from `origin/main`, the cycle exits **FATAL with both SHAs** rather than burning a droplet on a revision main has moved past. A dirty / non-main tree (`intended==0`) is intentional in-flight work and is exempt. Tests: `scripts/tests/rehearsal-sync-test.sh` extended 6 → **12 checks** (fixed check 6 for the hoisted fetch; added 7–12 covering the un-gated fetch call site and the four `rehearsal_refuse_stale` cases) — **passes**. `bash -n` clean on all three scripts. `GOTCHAS #82` gains a follow-through note. ## Why human — part (a), the one-time unwedge, is NOT worktree-scoped Part (a) of the ticket is explicit: the drive checkout `/home/dev/swarm/Matou/idss` is **outside any worktree** and **unreachable from a Sandcastle worker's sandbox** (verified: `ls -d /home/dev/swarm/Matou/idss` → *No such file or directory* on this host). It needs the **operator's hands on real hardware** (the cycle runner on `matou-workstation`) — the `ready-for-human` bar. Until it runs, the live checkout still executes stale `c9d0c61` code (which lacks even #766's and this fix), so the next drive re-fires the healed red and burns another paid droplet. **This landed code cannot yet run itself** — that is exactly the deadlock (b) breaks going forward. **Run once, on the drive host:** ``` git -C /home/dev/swarm/Matou/idss fetch origin git -C /home/dev/swarm/Matou/idss pull --ff-only origin main # fast-forwards c9d0c61 -> HEAD, no path collision (#768 evidence §4) # optional: rm the two untracked strays # .sandcastle/.env.bak-20260822T113103Z # docs/adr/0194-host-baseline-is-a-property-of-the-host-shape-not-the-install-mode.md ``` After that pull, every future cycle is bootstrap-proof (the fetch is un-gated) and a stale checkout refuses loudly instead of driving. **This issue can then be closed** — the code half is already done and verified; only the operator action is outstanding. Leaving open with `ready-for-human` (per GOTCHAS #82's own rule: *a green heal is not a LANDED heal until the drive checkout provably carries it* — closing this while the live checkout provably does not yet carry it would repeat the exact anti-pattern this ticket exists to end).
Owner

Operator step (a) complete — closing

Ruled by agent under ADR 0174 acting as the watch's hands (Ben's monitoring delegation tonight) — veto anytime.

Part (a) was done at ~03:55Z, minutes before this comment landed: the two wedging untracked files (.sandcastle/.env.bak-20260822T113103Z, the stray docs/adr/0194-host-baseline-…md draft whose number a landed ADR has since taken) were QUARANTINED — not deleted — to ~/idss-untracked-quarantine/ on matou-workstation, and the checkout fast-forwarded clean. Verified just now: git status empty, HEAD = 159c4b1b (this ticket's own (b)+(c) fix, so the refuse-stale gate is live for the next wedge too).

#722 unblocks on this close; its re-drive rides current code with #765's status-aware assertion.

## Operator step (a) complete — closing Ruled by agent under ADR 0174 acting as the watch's hands (Ben's monitoring delegation tonight) — veto anytime. Part (a) was done at ~03:55Z, minutes before this comment landed: the two wedging untracked files (`.sandcastle/.env.bak-20260822T113103Z`, the stray `docs/adr/0194-host-baseline-…md` draft whose number a landed ADR has since taken) were QUARANTINED — not deleted — to `~/idss-untracked-quarantine/` on matou-workstation, and the checkout fast-forwarded clean. Verified just now: `git status` empty, HEAD = `159c4b1b` (this ticket's own (b)+(c) fix, so the refuse-stale gate is live for the next wedge too). #722 unblocks on this close; its re-drive rides current code with #765's status-aware assertion.
ben closed this issue 2026-08-25 04:14:31 +00:00
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.

Reference
Matou/idss#768
No description provided.