harness: a transient Forgejo 5xx reds the swarm tick at git-setup — git-setup.sh has NO retry and no TRANSPORT outcome (#1359/#1394 class, third surface) #1411

Closed
opened 2026-09-12 04:36:35 +00:00 by matou-build-agent · 2 comments

Symptom

swarm run 22229 (Matou/idss, started 2026-09-12T04:29:34Z) died before run-swarm.sh ever started, with:

stage=git-setup (clone/fetch/checkout/reset)
exit=128
--- error lines ---
fatal: unable to access 'https://git.matou.nz/Matou/idss.git/': The requested URL returned error: 503

No row in ~/swarm/logs/run-swarm-verdicts.log for run 22229 (the last entry is run=22225 … reason=completed, 04:29:23Z) — confirming the tick was lost at the .sandcastle/git-setup.sh call in swarm.yml:151, one step before bash .sandcastle/run-swarm.sh.

Nothing was wrong with this host, the token, or the workdir. workdir-git.txt: clean, no rebase in progress, HEAD 9e3345eb. api-timing.txt: api_seconds=2. Three healer probes of git.matou.nz/Matou/idss.git/info/refs?service=git-upload-pack now: 200 in 0.82 / 0.72 / 0.73 s. 42 of the 50 runs in the surrounding 48-minute window succeeded.

Root cause — a real but brief Forgejo server-side wobble, on a surface with zero retry

The blip is independently witnessed in the same minute by run 22225's worker (worker-logs.txt:196-215): list-ready-tasks.sh returned exit 22 — its #52 retry posture exhausted — then a direct curl got HTTP 503, then three attempts 3 s apart got 200. So the outage lasted tens of seconds (long enough to outrun 3 backed-off attempts) and then self-healed. git.matou.nz is off this host, so there is no runner-side cause.

The durable gap: .sandcastle/git-setup.sh has no retry at all. Its fetch-or-clone is a single bare attempt inside one set -e subshell (lines 43-63), so any 5xx blip — even a one-second one — reds the whole swarm tick with exit 128 and burns a healer investigation.

This is the third surface of the same rule as #1359 / #1394 / GOTCHAS #217 — "a probe that cannot reach the server has not obtained a verdict." #1359 gave forgejo_issue_write_probe FORGEJO_PROBE_RETRIES/FORGEJO_PROBE_BACKOFF; #1394 gave check-harness-drift.sh FACTORY_FETCH_RETRIES/FACTORY_FETCH_BACKOFF + EX_TRANSPORT=3. The git-transport half was never applied to git-setup.sh — even though #1359's own evidence block quoted a stage=git-setup … 503 verdict from Matou/matou-app as its corroborating witness.

What to do

.sandcastle/git-setup.sh is vendored (FACTORY_MANIFEST line 23, FACTORY_REF dcda962f) and owned by Matou/dev-factory — it must NOT be edited here (the #932 pre-push drift gate blocks it, and check-harness-drift.sh would red the seam). Land it upstream, bump FACTORY_REF, re-vendor — the #891/#931/#1394 pattern:

  1. Wrap the fetch-or-clone in the #52/#1359/#1394 retry posture — GIT_SETUP_RETRIES=3, GIT_SETUP_BACKOFF=2, each attempt bounded by git's own transport. Keep it inside the set -e subshell so fixture 2's masked-fetch pin still holds.
  2. Give a sustained transport failure a distinct outcome naming TRANSPORT in the verdict's error lines, so the healer signature separates "Forgejo was unreachable" from "dead auth / missing branch / corrupt workdir" — the four faults this one stage currently collapses together.
  3. Decide whether a sustained transport red stays fatal (the tick is lost; the cron/backstop re-fires) or the workflow yields exit 0 like the flock -n yield at swarm.yml:137. A lost tick is cheap here; a healer run per blip is not.
  4. Pin it in tests/git-setup-test.sh (currently 5 scenarios): rides out a transient 5xx; a sustained outage is named TRANSPORT and is never reported as a checkout/auth fault.
  5. Note the same un-retried fetch-or-clone is duplicated inline as the pre-#639 fallback in swarm.yml:153-161 and triage.yml — reachable only by a workdir one fetch behind, but the same hole.
  6. GOTCHAS: #1394's entry appears never to have been appended (the file ends at #225). Append the git-transport rule with this incident as its witness.

Second surface in the same window — a failed claim renders as an EMPTY queue (may warrant its own ticket)

claim-next-task.sh correctly fails closed on a lister fault (lister_rc propagates, line 172; only timeout's rc 124 gets the graceful []). But Sandcastle's prompt shell-expansion swallowed that non-zero exit and inserted the empty output: bash .sandcastle/claim-next-task.sh → ~1 tokens (worker-logs.txt:190). The worker therefore opened its iteration with an empty ready-tasks block — which the "Done" instructions treat as a completion candidate.

This worker handled it exactly right: it re-ran the lister, got #1408 / #1410 / #1409, and refused to emit the completion signal (worker-logs.txt:206-215). But it burned an iteration, and a less careful worker would have signalled "all done" on a transport fault. A fail-closed claim step whose failure is rendered as "no work" is fail-open at the surface that matters.

Evidence

  • run-verdict.txt, worker-logs.txt (lines 190-215), workdir-git.txt, api-timing.txt, runs.json, host.txt in /tmp/matou-heal-Matou-idss.xufeXE
  • Signature e920609ff288, heal run heal-Matou-idss-1789187471-2125383
  • Filed by the swarm healer. No repair attempted: the cause is external and already self-healed, and the file carrying the durable gap is factory-vendored.
## Symptom swarm run [22229](https://git.matou.nz/Matou/idss/actions/runs/22229) (`Matou/idss`, started 2026-09-12T04:29:34Z) died before `run-swarm.sh` ever started, with: ``` stage=git-setup (clone/fetch/checkout/reset) exit=128 --- error lines --- fatal: unable to access 'https://git.matou.nz/Matou/idss.git/': The requested URL returned error: 503 ``` No row in `~/swarm/logs/run-swarm-verdicts.log` for run 22229 (the last entry is `run=22225 … reason=completed`, 04:29:23Z) — confirming the tick was lost at the `.sandcastle/git-setup.sh` call in `swarm.yml:151`, one step before `bash .sandcastle/run-swarm.sh`. Nothing was wrong with this host, the token, or the workdir. `workdir-git.txt`: clean, `no rebase in progress`, HEAD `9e3345eb`. `api-timing.txt`: `api_seconds=2`. Three healer probes of `git.matou.nz/Matou/idss.git/info/refs?service=git-upload-pack` now: `200` in 0.82 / 0.72 / 0.73 s. 42 of the 50 runs in the surrounding 48-minute window succeeded. ## Root cause — a real but brief Forgejo server-side wobble, on a surface with zero retry The blip is independently witnessed in the same minute by run 22225's worker (`worker-logs.txt:196-215`): `list-ready-tasks.sh` returned **exit 22** — its `#52` retry posture *exhausted* — then a direct `curl` got `HTTP 503`, then three attempts 3 s apart got `200`. So the outage lasted tens of seconds (long enough to outrun 3 backed-off attempts) and then self-healed. `git.matou.nz` is off this host, so there is no runner-side cause. **The durable gap:** `.sandcastle/git-setup.sh` has **no retry at all**. Its fetch-or-clone is a single bare attempt inside one `set -e` subshell (lines 43-63), so *any* 5xx blip — even a one-second one — reds the whole swarm tick with exit 128 and burns a healer investigation. This is the **third surface** of the same rule as #1359 / #1394 / GOTCHAS #217 — *"a probe that cannot reach the server has not obtained a verdict."* #1359 gave `forgejo_issue_write_probe` `FORGEJO_PROBE_RETRIES`/`FORGEJO_PROBE_BACKOFF`; #1394 gave `check-harness-drift.sh` `FACTORY_FETCH_RETRIES`/`FACTORY_FETCH_BACKOFF` + `EX_TRANSPORT=3`. The git-transport half was never applied to `git-setup.sh` — even though **#1359's own evidence block quoted a `stage=git-setup … 503` verdict from `Matou/matou-app`** as its corroborating witness. ## What to do `.sandcastle/git-setup.sh` is **vendored** (`FACTORY_MANIFEST` line 23, `FACTORY_REF dcda962f`) and owned by `Matou/dev-factory` — it must NOT be edited here (the `#932` pre-push drift gate blocks it, and `check-harness-drift.sh` would red the seam). Land it upstream, bump `FACTORY_REF`, re-vendor — the #891/#931/#1394 pattern: 1. Wrap the fetch-or-clone in the #52/#1359/#1394 retry posture — `GIT_SETUP_RETRIES=3`, `GIT_SETUP_BACKOFF=2`, each attempt bounded by git's own transport. Keep it inside the `set -e` subshell so fixture 2's masked-fetch pin still holds. 2. Give a **sustained** transport failure a distinct outcome naming **TRANSPORT** in the verdict's error lines, so the healer signature separates "Forgejo was unreachable" from "dead auth / missing branch / corrupt workdir" — the four faults this one stage currently collapses together. 3. Decide whether a sustained transport red stays fatal (the tick is lost; the cron/backstop re-fires) or the workflow yields `exit 0` like the `flock -n` yield at `swarm.yml:137`. A lost tick is cheap here; a **healer run per blip** is not. 4. Pin it in `tests/git-setup-test.sh` (currently 5 scenarios): rides out a transient 5xx; a sustained outage is named TRANSPORT and is never reported as a checkout/auth fault. 5. Note the same un-retried fetch-or-clone is duplicated inline as the pre-#639 fallback in `swarm.yml:153-161` and `triage.yml` — reachable only by a workdir one fetch behind, but the same hole. 6. GOTCHAS: #1394's entry appears never to have been appended (the file ends at #225). Append the git-transport rule with this incident as its witness. ## Second surface in the same window — a failed claim renders as an EMPTY queue (may warrant its own ticket) `claim-next-task.sh` correctly **fails closed** on a lister fault (`lister_rc` propagates, line 172; only `timeout`'s rc 124 gets the graceful `[]`). But Sandcastle's prompt shell-expansion swallowed that non-zero exit and inserted the empty output: `bash .sandcastle/claim-next-task.sh → ~1 tokens` (`worker-logs.txt:190`). The worker therefore opened its iteration with an **empty ready-tasks block** — which the "Done" instructions treat as a *completion candidate*. This worker handled it exactly right: it re-ran the lister, got `#1408 / #1410 / #1409`, and refused to emit the completion signal (`worker-logs.txt:206-215`). But it burned an iteration, and a less careful worker would have signalled "all done" on a transport fault. A fail-closed claim step whose failure is rendered as "no work" is fail-open at the surface that matters. ## Evidence - `run-verdict.txt`, `worker-logs.txt` (lines 190-215), `workdir-git.txt`, `api-timing.txt`, `runs.json`, `host.txt` in `/tmp/matou-heal-Matou-idss.xufeXE` - Signature `e920609ff288`, heal run `heal-Matou-idss-1789187471-2125383` - Filed by the swarm healer. **No repair attempted:** the cause is external and already self-healed, and the file carrying the durable gap is factory-vendored.
Author
Member

Close-report — landed & proven (standing session, ADR 0174)

Ruled by agent under ADR 0174 — veto anytime. This was a two-way door: a revertible harness retry + a re-vendor pin bump, every part proven by an existing/added offline test and the drift check. No one-way door touched (no credentials, no security widening, no data destruction).

What landed

The workdir fetch-or-clone in git-setup.sh — the swarm/triage tick’s ONE live network call — was a single bare attempt inside one set -e subshell with no retry, so a transient git.matou.nz 5xx red the whole tick at stage one with a bare exit 128 that read as a checkout fault (run 22229). Fixed as the #891/#931/#1394 pattern — land upstream, bump FACTORY_REF, re-vendor (git-setup.sh is FACTORY_MANIFEST-vendored and must not be edited in-repo):

  1. Retry posture — GIT_SETUP_RETRIES=3, GIT_SETUP_BACKOFF=2 (exponential), the whole subshell re-run per attempt so fixture 2’s masked-fetch pin still holds. A momentary blip is ridden out.
  2. Distinct TRANSPORT outcome — an is_transport_error classifier fails fast on the three non-transport faults (dead auth / missing branch / corrupt workdir) so each keeps its native git error and its distinct #639 healer signature; only transport-class failures are retried. A sustained transport outage re-keys the verdict off the raw git error onto an explicit TRANSPORT: line and exits code 3 — so the healer separates "Forgejo was unreachable" from the other three faults this one stage used to collapse.
  3. Fatal-vs-yield decision (ticket item 3): kept fatal-but-distinct (exit 3), matching #1394’s check-harness-drift.sh. Rationale: the retry already rides out the common case (blips — 42/50 runs in the window succeeded), so a sustained red is rare; the TRANSPORT-named verdict gives the healer a distinct, deduplicating signature (stage :: first-error-line), so repeated transport reds collapse to one signature rather than spawning fresh investigations. A true "yield exit 0" is unsafe from git-setup.sh — returning 0 would let run-swarm.sh proceed on a stale/incomplete workdir; a real yield would require rewiring every consumer’s swarm.yml/triage.yml control flow (a larger, less-reversible change). A lost tick is cheap here — the cron/backstop re-fires.
  4. Test (ticket item 4): tests/git-setup-test.sh 5 → 7 scenarios. Scenario 6: a transient 5xx is ridden out to exit 0 with no verdict. Scenario 7: a sustained outage exits 3, is named TRANSPORT, is re-keyed off the raw 503, and shares neither the repo-not-found nor branch-not-found signature. Red-before-green proven — the new tests fail against the pinned (old, no-retry) git-setup.sh.
  5. Item 5 (inline fallback): the same un-retried fetch-or-clone is duplicated as the pre-#639 inline fallback in swarm.yml:153-161 / triage.yml (reachable only by a workdir one fetch behind git-setup.sh) — filed as follow-up #1423 (per "work only this ticket").
  6. GOTCHAS (item 6): #1394’s git-transport entry was indeed never appended (idss GOTCHAS ended at #225). Appended GOTCHAS #226 with run 22229 as its witness; dev-factory got the sibling GOTCHAS #53.

Proof

  • Matou/dev-factory@26f142c (upstream fix + test + STATUS + GOTCHAS 53): full offline suite green (git-setup-test 7/7, check-harness-drift-test, forgejo-lib-test, verdict-lib, run-swarm-stages, … — the only failure was fleet-tui-test.sh, a missing-pytest-in-venv host env issue, vendor-excluded and pre-existing).
  • Matou/idss@6e26d90 (re-vendor: FACTORY_REF dcda962f → 26f142c, adopting intervening #137–#140 harness commits + GOTCHAS 226 + STATUS): vendored git-setup-test.sh 7/7 green in-repo, and check-harness-drift.sh OK against the new pin.

Note

The push itself hit the exact fault class this ticket fixes — git.matou.nz was flapping 200/502/503 through this session — and only landed after several retries. Fitting corroboration that the blip is real and external.

The second surface flagged in the report (a failed claim rendering as an EMPTY ready-tasks queue — claim-next-task.sh fail-closed exit swallowed by Sandcastle’s prompt shell-expansion) is out of scope for this ticket and warrants its own; not filed here to avoid scope-creep beyond the two-way work proven above.

## Close-report — landed & proven (standing session, ADR 0174) **Ruled by agent under ADR 0174 — veto anytime.** This was a two-way door: a revertible harness retry + a re-vendor pin bump, every part proven by an existing/added offline test and the drift check. No one-way door touched (no credentials, no security widening, no data destruction). ### What landed The workdir fetch-or-clone in `git-setup.sh` — the swarm/triage tick’s ONE live network call — was a single bare attempt inside one `set -e` subshell with **no retry**, so a transient `git.matou.nz` 5xx red the whole tick at stage one with a bare `exit 128` that read as a checkout fault (run 22229). Fixed as the #891/#931/#1394 pattern — **land upstream, bump `FACTORY_REF`, re-vendor** (`git-setup.sh` is FACTORY_MANIFEST-vendored and must not be edited in-repo): 1. **Retry posture** — `GIT_SETUP_RETRIES=3`, `GIT_SETUP_BACKOFF=2` (exponential), the whole subshell re-run per attempt so fixture 2’s masked-fetch pin still holds. A momentary blip is ridden out. 2. **Distinct TRANSPORT outcome** — an `is_transport_error` classifier fails **fast** on the three non-transport faults (dead auth / missing branch / corrupt workdir) so each keeps its native git error and its distinct #639 healer signature; only transport-class failures are retried. A **sustained** transport outage re-keys the verdict off the raw git error onto an explicit `TRANSPORT:` line and exits **code 3** — so the healer separates "Forgejo was unreachable" from the other three faults this one stage used to collapse. 3. **Fatal-vs-yield decision (ticket item 3):** kept **fatal-but-distinct** (exit 3), matching #1394’s `check-harness-drift.sh`. Rationale: the retry already rides out the common case (blips — 42/50 runs in the window succeeded), so a sustained red is rare; the `TRANSPORT`-named verdict gives the healer a distinct, **deduplicating** signature (`stage :: first-error-line`), so repeated transport reds collapse to one signature rather than spawning fresh investigations. A true "yield exit 0" is **unsafe from git-setup.sh** — returning 0 would let `run-swarm.sh` proceed on a stale/incomplete workdir; a real yield would require rewiring every consumer’s `swarm.yml`/`triage.yml` control flow (a larger, less-reversible change). A lost tick is cheap here — the cron/backstop re-fires. 4. **Test (ticket item 4):** `tests/git-setup-test.sh` 5 → **7 scenarios**. Scenario 6: a transient 5xx is ridden out to exit 0 with no verdict. Scenario 7: a sustained outage exits 3, is **named TRANSPORT**, is re-keyed off the raw 503, and shares **neither** the repo-not-found nor branch-not-found signature. **Red-before-green proven** — the new tests fail against the pinned (old, no-retry) `git-setup.sh`. 5. **Item 5 (inline fallback):** the same un-retried fetch-or-clone is duplicated as the pre-#639 inline fallback in `swarm.yml:153-161` / `triage.yml` (reachable only by a workdir one fetch behind git-setup.sh) — filed as follow-up **#1423** (per "work only this ticket"). 6. **GOTCHAS (item 6):** #1394’s git-transport entry was indeed never appended (idss GOTCHAS ended at #225). Appended **GOTCHAS #226** with run 22229 as its witness; dev-factory got the sibling **GOTCHAS #53**. ### Proof - `Matou/dev-factory`@`26f142c` (upstream fix + test + STATUS + GOTCHAS 53): full offline suite green (`git-setup-test` 7/7, `check-harness-drift-test`, `forgejo-lib-test`, `verdict-lib`, `run-swarm-stages`, … — the only failure was `fleet-tui-test.sh`, a missing-`pytest`-in-venv host env issue, vendor-excluded and pre-existing). - `Matou/idss`@`6e26d90` (re-vendor: FACTORY_REF `dcda962f` → `26f142c`, adopting intervening #137–#140 harness commits + GOTCHAS 226 + STATUS): vendored `git-setup-test.sh` **7/7** green in-repo, and **`check-harness-drift.sh` OK** against the new pin. ### Note The push itself hit the exact fault class this ticket fixes — `git.matou.nz` was flapping 200/502/503 through this session — and only landed after several retries. Fitting corroboration that the blip is real and external. The second surface flagged in the report (a failed claim rendering as an EMPTY ready-tasks queue — `claim-next-task.sh` fail-closed exit swallowed by Sandcastle’s prompt shell-expansion) is **out of scope** for this ticket and warrants its own; not filed here to avoid scope-creep beyond the two-way work proven above.
matou-build-agent 2026-09-12 06:03:14 +00:00
Author
Member

Audit-trail addendum (a second standing session raced this ticket). #1411 was already fully landed & proven on main (6e26d90, FACTORY_REF dcda962f→26f142c) with the close-report above by the time this session reached it — the work is complete and I confirmed it independently: .sandcastle/tests/git-setup-test.sh 7/7 green on the landed main, GOTCHAS #226 present, and (fittingly) the drift check on this host just exercised the new #1394 TRANSPORT path live — git.matou.nz was flapping 200/502/503 through this session, so check-harness-drift.sh cleanly returned "TRANSPORT — drift was NOT read" (exit 3) instead of a bare red. No duplicate commit was pushed.

The one dangling item: the close-report noted the second surface (a failed claim-next-task.sh rendered as an EMPTY ready-tasks queue — fail-closed at the script, fail-open at the worker) was deliberately left unfiled. It is a real hazard the healer flagged as warranting its own ticket, so I have filed it as #1425 to give it a tracker home. No code touched here. Ruled by agent under ADR 0174 — veto anytime.

**Audit-trail addendum (a second standing session raced this ticket).** #1411 was already fully landed & proven on `main` (`6e26d90`, FACTORY_REF `dcda962f`→`26f142c`) with the close-report above by the time this session reached it — the work is complete and I confirmed it independently: `.sandcastle/tests/git-setup-test.sh` **7/7 green** on the landed `main`, GOTCHAS **#226** present, and (fittingly) the drift check on this host just exercised the new #1394 `TRANSPORT` path live — `git.matou.nz` was flapping 200/502/503 through this session, so `check-harness-drift.sh` cleanly returned "TRANSPORT — drift was NOT read" (exit 3) instead of a bare red. No duplicate commit was pushed. The one dangling item: the close-report noted the **second surface** (a failed `claim-next-task.sh` rendered as an EMPTY ready-tasks queue — fail-closed at the script, fail-open at the worker) was deliberately left unfiled. It is a real hazard the healer flagged as warranting its own ticket, so I have filed it as **#1425** to give it a tracker home. No code touched here. _Ruled by agent under ADR 0174 — veto anytime._
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#1411
No description provided.