harness: a transient Forgejo 5xx on the factory fetch reds the seam at stage one — check-harness-drift.sh has no TRANSPORT outcome and no retry (#1359 class, second surface) #1394

Closed
opened 2026-09-11 20:09:00 +00:00 by matou-build-agent · 3 comments

Symptom

ci run 21982 (seam on d65ff9f6, started 2026-09-11T19:58:53Z — 5 s after the push) went red at the FIRST stage:

stage=Factory core: vendored .sandcastle files match FACTORY_REF (#571/#602)
exit=128
--- error lines ---
fatal: unable to access 'https://git.matou.nz/Matou/dev-factory.git/': The requested URL returned error: 503

Nothing had drifted. d65ff9f6 is an ADR-only commit (CONTEXT.md, STATUS.md, four docs/adr/*, one flow) — it touches no .sandcastle/ file, so the vendored tree it gated was byte-identical to e9916f61's, whose own seam had just passed. Re-running bash .sandcastle/check-harness-drift.sh on the same tree now: OK — every vendored factory file matches …@6ea8ba0400e2.

The healer's own probe in the same minute recorded api_seconds=timeout (35 s ceiling on actions/tasks?limit=1&page=1) and an empty workflow_runs. That endpoint answers in ~1.1 s now, and triage/publish on the same SHA went green at 20:04–20:05. A short, server-side Forgejo wobble; git.matou.nz resolves to 143.198.134.168 — off this host, so no runner-side cause.

The durable gap

.sandcastle/check-harness-drift.sh has exactly two outcomes: drift or OK. It has none for "I could not reach the factory." Its fetch is a bare shallow-by-SHA attempt with stderr silenced, falling back to an un-retried git clone:

if ! ( git init … && git fetch -q --depth 1 origin "$factory_ref" … ) 2>/dev/null; then
  git clone -q "$FACTORY_REPO" "$work"      # <- no retry; this is what emitted the 503

One 5xx therefore reds the whole seam at stage one with exit 128, blocks publish, and burns a healer investigation on a fault that was never in this repo.

This is the same class as #1359 / GOTCHAS #217 — "a probe that cannot reach the server has not obtained a verdict" — at a second surface. #1359 gave forgejo_issue_write_probe exponential backoff (FORGEJO_PROBE_RETRIES=3, FORGEJO_PROBE_BACKOFF=2) and taught a sustained outage to say TRANSPORT, not a permission verdict. The git-transport half of the same rule was never applied.

What to do

check-harness-drift.sh is vendored (FACTORY_MANIFEST line 9) and owned by Matou/dev-factory — it must NOT be edited here. Land it there, bump FACTORY_REF, re-vendor (the #891/#931 pattern):

  1. Wrap the fetch/clone in the #52/#1359 retry posture — 3 attempts, exponential backoff, each bounded.
  2. Give it a third outcome: a sustained transport failure exits with a distinct message naming TRANSPORT (the factory was unreachable; drift was never read) rather than a bare exit 128 that reads as a harness fault. Decide whether that stays fatal to the seam or degrades to a loud warning — the gate's job is to catch a hand-edited vendored file, and it cannot do that job blind either way.
  3. Pin it in tests/check-harness-drift-test.sh: rides out a transient 5xx; a sustained outage is named TRANSPORT and never claims drift.

Note while you are there: FACTORY_REF is 1 commit behind dev-factory main.

Evidence

  • run-verdict.txt, api-timing.txt (api_seconds=timeout), runs.json ({"workflow_runs":[]}) in /tmp/matou-heal-Matou-idss.d9VTRD
  • Signature 411fb54f2ace, heal run heal-Matou-idss-1789156807-1764127
  • Filed by the swarm healer. No repair attempted: the cause is external and already self-healed.
## Symptom ci run 21982 (seam on `d65ff9f6`, started 2026-09-11T19:58:53Z — 5 s after the push) went red at the FIRST stage: ``` stage=Factory core: vendored .sandcastle files match FACTORY_REF (#571/#602) exit=128 --- error lines --- fatal: unable to access 'https://git.matou.nz/Matou/dev-factory.git/': The requested URL returned error: 503 ``` Nothing had drifted. `d65ff9f6` is an ADR-only commit (`CONTEXT.md`, `STATUS.md`, four `docs/adr/*`, one flow) — it touches **no** `.sandcastle/` file, so the vendored tree it gated was byte-identical to `e9916f61`'s, whose own seam had just passed. Re-running `bash .sandcastle/check-harness-drift.sh` on the same tree now: `OK — every vendored factory file matches …@6ea8ba0400e2`. The healer's own probe in the same minute recorded `api_seconds=timeout` (35 s ceiling on `actions/tasks?limit=1&page=1`) and an empty `workflow_runs`. That endpoint answers in ~1.1 s now, and `triage`/`publish` on the same SHA went green at 20:04–20:05. A short, server-side Forgejo wobble; `git.matou.nz` resolves to 143.198.134.168 — off this host, so no runner-side cause. ## The durable gap `.sandcastle/check-harness-drift.sh` has exactly two outcomes: **drift** or **OK**. It has none for *"I could not reach the factory."* Its fetch is a bare shallow-by-SHA attempt with stderr silenced, falling back to an un-retried `git clone`: ```sh if ! ( git init … && git fetch -q --depth 1 origin "$factory_ref" … ) 2>/dev/null; then git clone -q "$FACTORY_REPO" "$work" # <- no retry; this is what emitted the 503 ``` One 5xx therefore reds the whole seam at stage one with exit 128, blocks `publish`, and burns a healer investigation on a fault that was never in this repo. This is the **same class** as #1359 / GOTCHAS #217 — *"a probe that cannot reach the server has not obtained a verdict"* — at a second surface. #1359 gave `forgejo_issue_write_probe` exponential backoff (`FORGEJO_PROBE_RETRIES=3`, `FORGEJO_PROBE_BACKOFF=2`) and taught a sustained outage to say `TRANSPORT, not a permission verdict`. The git-transport half of the same rule was never applied. ## What to do `check-harness-drift.sh` is **vendored** (`FACTORY_MANIFEST` line 9) and owned by `Matou/dev-factory` — it must NOT be edited here. Land it there, bump `FACTORY_REF`, re-vendor (the #891/#931 pattern): 1. Wrap the fetch/clone in the #52/#1359 retry posture — 3 attempts, exponential backoff, each bounded. 2. Give it a third outcome: a sustained transport failure exits with a distinct message naming **TRANSPORT** (the factory was unreachable; drift was never read) rather than a bare `exit 128` that reads as a harness fault. Decide whether that stays fatal to the seam or degrades to a loud warning — the gate's job is to catch a hand-edited vendored file, and it cannot do that job blind either way. 3. Pin it in `tests/check-harness-drift-test.sh`: rides out a transient 5xx; a sustained outage is named TRANSPORT and never claims drift. Note while you are there: `FACTORY_REF` is 1 commit behind `dev-factory` main. ## Evidence - `run-verdict.txt`, `api-timing.txt` (`api_seconds=timeout`), `runs.json` (`{"workflow_runs":[]}`) in `/tmp/matou-heal-Matou-idss.d9VTRD` - Signature `411fb54f2ace`, heal run `heal-Matou-idss-1789156807-1764127` - Filed by the swarm healer. No repair attempted: the cause is external and already self-healed.
Author
Member

This ticket is a protected-path machinery change and cannot be completed by a Sandcastle worker — handing off to ready-for-session (ADR 0174 / #445).

Why a swarm worker cannot land this

Every substantive step of the "What to do" list writes to a path this repo fingerprints as protected (protected-paths-lib.sh: PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"):

  1. check-harness-drift.sh is vendored under .sandcastle/ (FACTORY_MANIFEST line 9) — protected. The issue itself says it "must NOT be edited here."
  2. The retry/TRANSPORT fix must land upstream in Matou/dev-factory — a different repo the swarm worktree does not own.
  3. Bumping .sandcastle/FACTORY_REF and re-vendoring .sandcastle/check-harness-drift.sh both mutate .sandcastle/ — protected.
  4. The pin test rides in dev-factory’s own tests/check-harness-drift-test.sh alongside the fix.

The #445 before/after tree-fingerprint attributes any .sandcastle/ change to the worker, rolls it back, and reds the run — so none of this is landable here. Per Rule 9 and PP_ESCAPE_PATH, a protected .sandcastle/ path per #445 "needs an interactive session's standing, not Ben."

Nothing in this ticket lands in a non-protected path of Matou/idss, so there is no partial slice a worker can ship. Re-labelling this issue itself (rather than filing a duplicate) ready-for-session: it already describes the machinery change comprehensively.

What a session must do (from the issue, unchanged)

  1. In Matou/dev-factory, wrap the check-harness-drift.sh fetch/clone in the #52/#1359 retry posture (3 attempts, bounded exponential backoff) and add a third TRANSPORT outcome distinct from drift/OK.
  2. Add the pin test in dev-factory tests/check-harness-drift-test.sh (rides out a transient 5xx; a sustained outage is named TRANSPORT and never claims drift).
  3. Re-vendor into Matou/idss via the #891/#931 pattern and bump .sandcastle/FACTORY_REF (currently 6ea8ba04, 1 commit behind dev-factory main).

Why human/session

Editing .sandcastle/ (protected machinery, #445) and pushing to Matou/dev-factory both require standing a swarm worker does not have.

This ticket is a **protected-path machinery change** and cannot be completed by a Sandcastle worker — handing off to `ready-for-session` (ADR 0174 / #445). ## Why a swarm worker cannot land this Every substantive step of the "What to do" list writes to a path this repo fingerprints as protected (`protected-paths-lib.sh`: `PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"`): 1. `check-harness-drift.sh` is vendored under `.sandcastle/` (`FACTORY_MANIFEST` line 9) — **protected**. The issue itself says it "must NOT be edited here." 2. The retry/TRANSPORT fix must land upstream in **`Matou/dev-factory`** — a different repo the swarm worktree does not own. 3. Bumping `.sandcastle/FACTORY_REF` and re-vendoring `.sandcastle/check-harness-drift.sh` both mutate `.sandcastle/` — **protected**. 4. The pin test rides in `dev-factory`’s own `tests/check-harness-drift-test.sh` alongside the fix. The #445 before/after tree-fingerprint attributes any `.sandcastle/` change to the worker, **rolls it back, and reds the run** — so none of this is landable here. Per Rule 9 and `PP_ESCAPE_PATH`, a protected `.sandcastle/` path per #445 "needs an interactive session's standing, not Ben." Nothing in this ticket lands in a non-protected path of `Matou/idss`, so there is no partial slice a worker can ship. Re-labelling this issue itself (rather than filing a duplicate) `ready-for-session`: it already describes the machinery change comprehensively. ## What a session must do (from the issue, unchanged) 1. In `Matou/dev-factory`, wrap the `check-harness-drift.sh` fetch/clone in the #52/#1359 retry posture (3 attempts, bounded exponential backoff) and add a third **TRANSPORT** outcome distinct from drift/OK. 2. Add the pin test in `dev-factory` `tests/check-harness-drift-test.sh` (rides out a transient 5xx; a sustained outage is named TRANSPORT and never claims drift). 3. Re-vendor into `Matou/idss` via the #891/#931 pattern and bump `.sandcastle/FACTORY_REF` (currently `6ea8ba04`, 1 commit behind dev-factory main). ## Why human/session Editing `.sandcastle/` (protected machinery, #445) and pushing to `Matou/dev-factory` both require standing a swarm worker does not have.
Author
Member

Close-report — landed, proven (ADR 0174, two-way doors only)

Ruled by agent under ADR 0174 — veto anytime. The durable gap is closed at the source and re-vendored here.

What landed

The gap was the git-transport half of #1359's rule (a probe that cannot reach the server has not obtained a verdict, GOTCHAS #217), never applied to check-harness-drift.sh's bare, un-retried fetch/clone. Fixed in Matou/dev-factory (the file is vendored, FACTORY_MANIFEST line 9 — must not be edited here) and re-vendored, the #891/#931 pattern:

  1. Retry posture — the fetch/clone is wrapped in the #52/#1359 posture: FACTORY_FETCH_RETRIES=3, FACTORY_FETCH_BACKOFF=2 (exponential), each attempt bounded by git's own transport. A transient blip is ridden out.
  2. A distinct TRANSPORT outcome — a sustained outage exhausts the attempts and exits code 3 with a message NAMING TRANSPORT (could not reach … the factory was unreachable, so drift was NOT read here), never a bare exit 128 and never a false DRIFT. Ruling on fatal-vs-warn: it stays fatal. Greening on an unreachable factory would be exactly the GOTCHAS #30 hazard — a guard that could not reach the code it guards must never be mistaken for a clean result. The retry rides out the transient case that actually happened (ci run 21982 self-healed within a minute); the sustained case reds honestly but legibly, so seam-smoke.sh's verdict + the healer signature read factory unreachable, not drift, and no healer investigation is burned on an external fault.
  3. Test pins — tests/check-harness-drift-test.sh +2 (14 total), a fake flaky git 503-ing the first N network ops against the same local factory remote: T9 proves attempt 1's fetch+clone blip is ridden out to a green OK; T10 proves a sustained outage exits 3, names TRANSPORT, never greens, and never claims DRIFT.
  4. FACTORY_REF note — the ticket flagged the pin was 1 commit behind. The re-vendor bumps FACTORY_REF 6ea8ba0→dcda962 (dev-factory main tip), which also lands the intervening #135 healer-evidence host-stamping (heal.sh/run-swarm.sh + their tests) — expected pin-bump behaviour.

Commits

  • Matou/dev-factory@dcda962 — the harness fix + its test (pushed to dev-factory main).
  • Matou/idss@9d5bd2b0 — re-vendor at dcda962 + STATUS.md.

Proof

  • bash .sandcastle/check-harness-drift.sh — GREEN against the new pin (OK — every vendored factory file matches …@dcda962).
  • tests/check-harness-drift-test.sh — 14/14 (12 prior + T9/T10), both in the dev-factory tree and re-run in idss.
  • tests/run-swarm-stages-test.sh — GREEN (pulled-forward #135).
  • dev-factory prepush-drift-gate-test.sh / gate-lib-test.sh — GREEN.
  • The pre-push drift gate (#932, gate 1) passed on the idss push, re-confirming the vendored tree matches dcda962.

Note (pre-existing, out of scope — not a regression)

tests/heal-test.sh's #123 scenario fails when run from a consumer .sandcastle/tests/ checkout: it hard-codes HEAL_PROMPT_FILE="$here/../.sandcastle/heal-prompt.md", which resolves only in dev-factory's own self-vendored layout (in a consumer it points at the nonexistent .sandcastle/.sandcastle/heal-prompt.md). This fails identically on idss HEAD before the re-vendor, is not referenced by any idss workflow (idss's seam runs only check-harness-drift.sh), and is proven green in dev-factory's own CI. Filing a follow-up against dev-factory for the vendored-test path portability rather than touching it here.

Doors

All two-way (ADR 0174): a revertible dev-factory commit proven offline, a revertible FACTORY_REF bump proven by the drift check. No personal credentials, no security widening, no data destruction, no non-routine spend.

## Close-report — landed, proven (ADR 0174, two-way doors only) **Ruled by agent under ADR 0174 — veto anytime.** The durable gap is closed at the source and re-vendored here. ### What landed The gap was the git-transport half of #1359's rule (*a probe that cannot reach the server has not obtained a verdict*, GOTCHAS #217), never applied to `check-harness-drift.sh`'s bare, un-retried fetch/clone. Fixed **in `Matou/dev-factory`** (the file is vendored, `FACTORY_MANIFEST` line 9 — must not be edited here) and re-vendored, the #891/#931 pattern: 1. **Retry posture** — the fetch/clone is wrapped in the #52/#1359 posture: `FACTORY_FETCH_RETRIES=3`, `FACTORY_FETCH_BACKOFF=2` (exponential), each attempt bounded by git's own transport. A transient blip is ridden out. 2. **A distinct TRANSPORT outcome** — a sustained outage exhausts the attempts and exits **code 3** with a message NAMING TRANSPORT (`could not reach … the factory was unreachable, so drift was NOT read here`), never a bare `exit 128` and never a false `DRIFT`. **Ruling on fatal-vs-warn:** it stays **fatal**. Greening on an unreachable factory would be exactly the GOTCHAS #30 hazard — *a guard that could not reach the code it guards must never be mistaken for a clean result*. The retry rides out the transient case that actually happened (ci run 21982 self-healed within a minute); the sustained case reds honestly but legibly, so `seam-smoke.sh`'s verdict + the healer signature read *factory unreachable*, not *drift*, and no healer investigation is burned on an external fault. 3. **Test pins** — `tests/check-harness-drift-test.sh` +2 (14 total), a fake flaky `git` 503-ing the first N network ops against the same local factory remote: **T9** proves attempt 1's fetch+clone blip is ridden out to a green `OK`; **T10** proves a sustained outage exits 3, names TRANSPORT, never greens, and never claims DRIFT. 4. **FACTORY_REF note** — the ticket flagged the pin was 1 commit behind. The re-vendor bumps `FACTORY_REF` `6ea8ba0`→`dcda962` (dev-factory main tip), which also lands the intervening #135 healer-evidence host-stamping (`heal.sh`/`run-swarm.sh` + their tests) — expected pin-bump behaviour. ### Commits - `Matou/dev-factory@dcda962` — the harness fix + its test (pushed to dev-factory `main`). - `Matou/idss@9d5bd2b0` — re-vendor at `dcda962` + STATUS.md. ### Proof - `bash .sandcastle/check-harness-drift.sh` — **GREEN** against the new pin (`OK — every vendored factory file matches …@dcda962`). - `tests/check-harness-drift-test.sh` — **14/14** (12 prior + T9/T10), both in the dev-factory tree and re-run in idss. - `tests/run-swarm-stages-test.sh` — GREEN (pulled-forward #135). - dev-factory `prepush-drift-gate-test.sh` / `gate-lib-test.sh` — GREEN. - The **pre-push drift gate** (#932, gate 1) passed on the idss push, re-confirming the vendored tree matches `dcda962`. ### Note (pre-existing, out of scope — not a regression) `tests/heal-test.sh`'s #123 scenario fails when run from a *consumer* `.sandcastle/tests/` checkout: it hard-codes `HEAL_PROMPT_FILE="$here/../.sandcastle/heal-prompt.md"`, which resolves only in dev-factory's own self-vendored layout (in a consumer it points at the nonexistent `.sandcastle/.sandcastle/heal-prompt.md`). This fails **identically on idss HEAD before the re-vendor**, is not referenced by any idss workflow (idss's seam runs only `check-harness-drift.sh`), and is proven green in dev-factory's own CI. Filing a follow-up against dev-factory for the vendored-test path portability rather than touching it here. ### Doors All two-way (ADR 0174): a revertible dev-factory commit proven offline, a revertible `FACTORY_REF` bump proven by the drift check. No personal credentials, no security widening, no data destruction, no non-routine spend.
Author
Member

Follow-up for the pre-existing heal-test path portability noted above filed as Matou/dev-factory#139 (not a #1394 regression).

Follow-up for the pre-existing heal-test path portability noted above filed as **Matou/dev-factory#139** (not a #1394 regression).
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#1394
No description provided.