list-ready-tasks: a failed forge read asserts "transient Forgejo 5xx" for ANY rc — a 401/404 stall is reported, forever, as self-healing #143

Closed
opened 2026-09-12 06:03:14 +00:00 by matou-build-agent · 1 comment

What

When a Forgejo read inside list-ready-tasks.sh fails, the run's verdict asserts
a cause it never observed: "transient Forgejo 5xx/timeout after retries" —
printed for any non-zero rc, with no HTTP status, no endpoint, and (because
curl -s silenced the leg) an empty error block.

Symptom (live evidence)

Matou/dev-factory swarm run
8736 (2026-09-12,
heal signature 7f647f2d78ed) died at verdict stage list ready tasks, exit=1:

stage=list ready tasks
exit=1
--- error lines ---
list-ready-tasks.sh failed (rc=123 — transient Forgejo 5xx/timeout after retries)

That is the whole record. worker-logs.txt and runner-journal.txt were empty
(the run died before any worker), so the healer had nothing to go on but 123.

In this instance the sentence happened to be true — git.matou.nz was
flapping 503 in ~10–30 s windows (measured live: 20 consecutive 200s then 10
consecutive 503s on GET /issues/141/dependencies, plus a 000 timeout), the
same outage the Matou/idss healer recorded for run 22240. But the harness did
not know that. It guessed.

Cause

Both read paths throw the status away:

  • api() uses curl -sf and returns a bare 22 when the attempts are
    exhausted.
  • The dependency fan-out subshell uses curl -sf and exit 1; xargs
    translates any child exit 1–125 into 123 — which is where the run's 123
    comes from, and why it isn't one of the codes the lister itself names.

schedule_list_ready_or_verdict (schedule-lib.sh:113) then hard-codes the
diagnosis for every rc:

verdict_error "list-ready-tasks.sh failed (rc=$rc — transient Forgejo 5xx/timeout after retries)${errline:+: $errline}"

and $errline is empty because -s printed nothing.

Why it matters

An expired FORGEJO_TOKEN (401), a repo rename or lost permission (403/404), or
a DNS failure produces a byte-identical verdict. The healer reads
"transient", classifies transient-external, takes no action and reports that
it self-heals — on every tick, forever, while the swarm is permanently stalled.
The one signal that would separate the two cases (the HTTP status) is in hand at
the moment of failure and discarded.

This is exactly the shape just recorded as GOTCHAS 226 in Matou/idss: if you
could not verify the remote state you are asserting, do not assert it.
Same
outage, different unverified assertion.

Fix sketch

  1. In api() and in the dependency subshell, capture the status instead of
    discarding it — curl -s -o "$tmp" -w '%{http_code}' (dropping bare -f, or
    keeping -f and reading %{http_code} alongside it), remembering the last
    status and the endpoint path.
  2. On exhaustion, write one stderr line naming both, e.g.
    list-ready-tasks: GET /issues/141/dependencies failed after 3 attempts (last http=503).
    schedule_list_ready_or_verdict already appends stderr to the verdict, so
    this alone makes the error block non-empty.
  3. Word the verdict from what was observed: 5xx/000 → transient;
    401/403/404 → e.g. forge REJECTED the read (http=401) — not transient, the swarm will not recover on its own.

Retry budget is deliberately not in scope: three attempts span ~7 s
(0 → 2 s → 6 s), the observed 503 windows run 10–30 s, and the whole lister
lives inside Sandcastle's 30 s shell-expansion budget — no retry schedule that
fits the budget can outlast the outage. Reporting it honestly is the fix;
riding it out is not available.

Acceptance criteria

  1. When api() exhausts its attempts, the lister writes a stderr line naming
    the failing endpoint and the last HTTP status; the same holds for the
    dependency fan-out (whose failure currently surfaces only as xargs 123).
  2. The verdict error line distinguishes a 4xx rejection from a 5xx/timeout, and
    does not claim "transient" for a 4xx.
  3. Offline tests (shimmed curl, per the repo's test posture) pin both paths:
    a 503-until-exhaustion case asserting the transient wording plus the status,
    and a 401 case asserting the non-transient wording. xargs-123 must reach
    the verdict with the endpoint named.
  4. No extra API calls on the happy path, and the emitted queue JSON is
    byte-identical to today's for a healthy forge.

Note on reach

list-ready-tasks.sh and schedule-lib.sh are vendored byte-identical into
consumers. A fix here does not reach any running .sandcastle/ copy until a
human re-vendors (bash onboarding/onboard.sh vendor .sandcastle <sha>) — and
this repo's own self-pin is currently 50 commits behind (FACTORY_REF
2445159, HEAD 26f142c), the drift already ticketed as #131/#132.


Filed by the swarm healer for run 8736 (signature 7f647f2d78ed). The run's own
fault was transient-external and needed no repair; this is the latent
observability defect that outage exposed, not the outage.

## What When a Forgejo read inside `list-ready-tasks.sh` fails, the run's verdict asserts a cause it never observed: **"transient Forgejo 5xx/timeout after retries"** — printed for *any* non-zero rc, with no HTTP status, no endpoint, and (because `curl -s` silenced the leg) an empty error block. ## Symptom (live evidence) `Matou/dev-factory` swarm run [8736](https://git.matou.nz/Matou/dev-factory/actions/runs/8736) (2026-09-12, heal signature `7f647f2d78ed`) died at verdict stage `list ready tasks`, exit=1: ``` stage=list ready tasks exit=1 --- error lines --- list-ready-tasks.sh failed (rc=123 — transient Forgejo 5xx/timeout after retries) ``` That is the whole record. `worker-logs.txt` and `runner-journal.txt` were empty (the run died before any worker), so the healer had nothing to go on but `123`. In this instance the sentence happened to be **true** — `git.matou.nz` was flapping 503 in ~10–30 s windows (measured live: 20 consecutive `200`s then 10 consecutive `503`s on `GET /issues/141/dependencies`, plus a `000` timeout), the same outage the `Matou/idss` healer recorded for run 22240. But the harness did not know that. It guessed. ## Cause Both read paths throw the status away: - `api()` uses `curl -sf` and returns a bare `22` when the attempts are exhausted. - The dependency fan-out subshell uses `curl -sf` and `exit 1`; `xargs` translates any child exit 1–125 into **123** — which is where the run's `123` comes from, and why it isn't one of the codes the lister itself names. `schedule_list_ready_or_verdict` (`schedule-lib.sh:113`) then hard-codes the diagnosis for every rc: ```sh verdict_error "list-ready-tasks.sh failed (rc=$rc — transient Forgejo 5xx/timeout after retries)${errline:+: $errline}" ``` and `$errline` is empty because `-s` printed nothing. ## Why it matters An expired `FORGEJO_TOKEN` (401), a repo rename or lost permission (403/404), or a DNS failure produces a **byte-identical verdict**. The healer reads "transient", classifies `transient-external`, takes no action and reports that it self-heals — on every tick, forever, while the swarm is permanently stalled. The one signal that would separate the two cases (the HTTP status) is in hand at the moment of failure and discarded. This is exactly the shape just recorded as GOTCHAS 226 in `Matou/idss`: *if you could not verify the remote state you are asserting, do not assert it.* Same outage, different unverified assertion. ## Fix sketch 1. In `api()` and in the dependency subshell, capture the status instead of discarding it — `curl -s -o "$tmp" -w '%{http_code}'` (dropping bare `-f`, or keeping `-f` and reading `%{http_code}` alongside it), remembering the last status and the endpoint path. 2. On exhaustion, write **one** stderr line naming both, e.g. `list-ready-tasks: GET /issues/141/dependencies failed after 3 attempts (last http=503)`. `schedule_list_ready_or_verdict` already appends stderr to the verdict, so this alone makes the error block non-empty. 3. Word the verdict from what was observed: `5xx`/`000` → transient; `401/403/404` → e.g. `forge REJECTED the read (http=401) — not transient, the swarm will not recover on its own`. Retry budget is deliberately **not** in scope: three attempts span ~7 s (`0 → 2 s → 6 s`), the observed 503 windows run 10–30 s, and the whole lister lives inside Sandcastle's 30 s shell-expansion budget — no retry schedule that fits the budget can outlast the outage. Reporting it honestly is the fix; riding it out is not available. ## Acceptance criteria 1. When `api()` exhausts its attempts, the lister writes a stderr line naming the failing endpoint and the last HTTP status; the same holds for the dependency fan-out (whose failure currently surfaces only as `xargs` 123). 2. The verdict error line distinguishes a 4xx rejection from a 5xx/timeout, and does not claim "transient" for a 4xx. 3. Offline tests (shimmed `curl`, per the repo's test posture) pin both paths: a 503-until-exhaustion case asserting the transient wording plus the status, and a 401 case asserting the non-transient wording. `xargs`-123 must reach the verdict with the endpoint named. 4. No extra API calls on the happy path, and the emitted queue JSON is byte-identical to today's for a healthy forge. ## Note on reach `list-ready-tasks.sh` and `schedule-lib.sh` are vendored byte-identical into consumers. A fix here does **not** reach any running `.sandcastle/` copy until a human re-vendors (`bash onboarding/onboard.sh vendor .sandcastle <sha>`) — and this repo's own self-pin is currently **50 commits behind** (`FACTORY_REF` `2445159`, HEAD `26f142c`), the drift already ticketed as #131/#132. --- Filed by the swarm healer for run 8736 (signature `7f647f2d78ed`). The run's own fault was transient-external and needed no repair; this is the latent observability defect that outage exposed, not the outage.
Author
Member

Duplicate of #142 — same report, filed twice by the swarm healer for run 8736. The forge was serving 503/502 and timing out mid-flap while this was being filed: two POSTs returned 000 (no response) after the server had in fact created the issue. Closing this one and unlabelling it so no worker claims it; work #142.

(That double-file is itself an instance of the class of defect #142 describes: a write whose outcome could not be observed was assumed to have failed.)

Duplicate of #142 — same report, filed twice by the swarm healer for run 8736. The forge was serving 503/502 and timing out mid-flap while this was being filed: two POSTs returned `000` (no response) after the server had in fact created the issue. Closing this one and unlabelling it so no worker claims it; work #142. (That double-file is itself an instance of the class of defect #142 describes: a write whose outcome could not be observed was assumed to have failed.)
matou-build-agent 2026-09-12 06:05:49 +00:00
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/dev-factory#143
No description provided.