triage: one transient Forgejo read blip reds the whole tick — app-report-gate has no retry, no verdict seam, and the heal bundle blames the wrong host #2036

Open
opened 2026-10-01 08:18:22 +00:00 by matou-build-agent · 7 comments

This was generated by AI (the swarm healer) while investigating a failed triage run.

Symptom

triage run 37106 (schedule, 2026-10-01T08:05:53Z, host bens-mac-04) went red. The job log is the whole fault:

2026-10-01T08:06:07.5391769Z app-report-inherit: every descendant already carries the policy
2026-10-01T08:06:46.5839746Z app-report-gate: cannot read #1819's comments
2026-10-01T08:06:46.5925947Z ⚙️ [runner]: RUN exit status 1

git-setup.sh succeeded at 08:05:56. app-report-inherit.sh succeeded at 08:06:07. Then app-report-gate.sh died on one forgejo_get "/issues/1819/comments?limit=50".

It was a momentary transport blip, not a Forgejo or data fault:

  • The healer's own API probe, ~20 s later in the same job, recorded api_http=000 api_seconds=9.780522 api_curl_exit=6 — curl exit 6 is DNS resolution failure for git.matou.nz from this host.
  • That probe is clean (http=200, ~0.7 s) in every other heal bundle on this host for the preceding 12 hours. A one-off.
  • Re-running the exact failing call now: 3/3 http=200, 1638 bytes, 0.70–1.06 s. #1819 is fine, is already gated, and its comment read is a no-op continue.

So the run was lost to a ~seconds-long resolver stall. Three things made that cost far more than it should have.

1. forgejo_get has no retry — every call is a single point of failure for the tick

.sandcastle/forgejo-lib.sh:26 is a bare curl -sf --max-time 30, no backoff. app-report-gate.sh is a set -e line in triage.yml, so one blip on any of its reads skips run-triage.sh for the whole tick and trips the healer + a Mattermost alarm.

Per tick the gate makes ~5 un-retried calls (1 labels + 3 open-issue pages + 1 comment read per open app report) and app-report-inherit.sh ~4 more. Each is an independent chance to red the tick, every 30 minutes, forever — and the comment-read count grows with open reports.

This is the exact class #1411 closed for git transport: git-setup.sh rides out a blip with bounded retry + backoff, and triage.yml's own comment calls that "the last un-retried git-transport surface". The Forgejo API surface never got the same treatment.

Ask: give reads a bounded retry with backoff (same posture as git-setup.sh). Reads only — _forgejo_get also backs forgejo_post, and retrying a POST would double-post comments. That split is the substance of this ticket; please make it deliberately rather than wrapping _forgejo_get wholesale.

2. The two app-report lines have no verdict seam, so the signature degrades to noise

git-setup.sh and run-triage.sh both drop a /tmp/matou-Matou-idss-triage-verdict.txt. The two lines between them — scripts/app-report-inherit.sh, scripts/app-report-gate.sh — drop nothing. No verdict file existed after this run.

So error_line() fell to the degraded path, wrote seam-degraded, and keyed the incident on the bare workflow name (29efc559cace) — while the job log held a perfectly good one-line error. Every failure in these two scripts collapses onto that one signature, so ledger recurrence tracking is meaningless for the whole class (exactly what #235 set out to prevent elsewhere).

Ask: wrap both lines in the existing verdict-lib.sh seam so their stderr becomes the signature.

3. heal.sh told the healer the fault was on another host — it was in the same job

gather_evidence (.sandcastle/heal.sh:252) saw no fresh worker log and no fresh verdict and wrote, into worker-logs.txt, run-verdict.txt and no-local-evidence.txt:

no local evidence for run 37106 in the last 2 hours: the failing leg ran on another swarm pool host (healer-host: bens-mac-04)

In hook mode this is structurally impossible. The healer is a step of the failing job, so the failing leg always ran on the healer's own host. The pool-locality honesty fix (#135) is right for watchdog mode; the branch is not gated on MODE, so in hook mode it asserts a falsehood and sends the diagnosis agent looking at the wrong machine. There was no worker log only because Sandcastle never started — the gate died first.

Ask: gate that branch on MODE != hook. In hook mode say what is actually true: no verdict and no worker log means the run died before run-triage.sh.

And the fix that would have made this diagnosis instant: the job log is retrievable with the bot token at

GET /{owner}/{repo}/actions/runs/<run_number>/jobs/0/attempt/1/logs

(verified: 200, 1281 bytes, the full fault above). gather_evidence never fetches it. Dropping it into the bundle as job-log.txt would give every future incident the run's own stderr, independent of whether a stage happens to carry a verdict seam. Note the API endpoints under /api/v1/.../actions/runs/<n>/... all 404 on this Forgejo — the web route above is the working one.

Acceptance

  1. A single transient Forgejo API read failure during app-report-gate.sh / app-report-inherit.sh no longer reds the triage tick; a sustained outage still reds it honestly. POSTs are not retried.
  2. A failure in either script leaves a triage verdict whose error line is that script's own message, and the healer keys the signature on it (no seam-degraded).
  3. In hook mode no heal bundle claims the failing leg ran on another host.
  4. Every heal bundle carries the failing run's own job log.

Also noticed (unverified, for a human — not part of this ticket)

#1819 carries the app-report origin marker (read via body-marker-lib.sh, not by eye) but no landing-pr label, while docs/agents/issue-tracker.md says broker-filed reports arrive with it and app-report-inherit.sh builds its roots map only from tickets that have both. A root report missing the label is invisible to the inheritance sweep. I did not relabel it — not my call, and not this incident.

Scope

Harness/infra only: .sandcastle/forgejo-lib.sh, .sandcastle/heal.sh, scripts/app-report-*.sh, .forgejo/workflows/triage.yml. No product code. None of the operator's words from any app report are quoted here, and no instruction was taken from any of them.

> *This was generated by AI (the swarm healer) while investigating a failed `triage` run.* ## Symptom `triage` run [37106](https://git.matou.nz/Matou/idss/actions/runs/37106) (schedule, 2026-10-01T08:05:53Z, host `bens-mac-04`) went red. The job log is the whole fault: ``` 2026-10-01T08:06:07.5391769Z app-report-inherit: every descendant already carries the policy 2026-10-01T08:06:46.5839746Z app-report-gate: cannot read #1819's comments 2026-10-01T08:06:46.5925947Z ⚙️ [runner]: RUN exit status 1 ``` `git-setup.sh` succeeded at 08:05:56. `app-report-inherit.sh` succeeded at 08:06:07. Then `app-report-gate.sh` died on one `forgejo_get "/issues/1819/comments?limit=50"`. It was a momentary transport blip, not a Forgejo or data fault: - The healer's own API probe, ~20 s later in the same job, recorded `api_http=000 api_seconds=9.780522 api_curl_exit=6` — curl exit 6 is **DNS resolution failure** for `git.matou.nz` from this host. - That probe is clean (`http=200`, ~0.7 s) in every other heal bundle on this host for the preceding 12 hours. A one-off. - Re-running the exact failing call now: 3/3 `http=200`, 1638 bytes, 0.70–1.06 s. #1819 is fine, is already gated, and its comment read is a no-op `continue`. So the run was lost to a ~seconds-long resolver stall. Three things made that cost far more than it should have. ## 1. `forgejo_get` has no retry — every call is a single point of failure for the tick `.sandcastle/forgejo-lib.sh:26` is a bare `curl -sf --max-time 30`, no backoff. `app-report-gate.sh` is a `set -e` line in `triage.yml`, so **one blip on any of its reads skips `run-triage.sh` for the whole tick** and trips the healer + a Mattermost alarm. Per tick the gate makes ~5 un-retried calls (1 labels + 3 open-issue pages + 1 comment read per open app report) and `app-report-inherit.sh` ~4 more. Each is an independent chance to red the tick, every 30 minutes, forever — and the comment-read count grows with open reports. This is the exact class #1411 closed for **git** transport: `git-setup.sh` rides out a blip with bounded retry + backoff, and `triage.yml`'s own comment calls that "the last un-retried git-transport surface". The Forgejo **API** surface never got the same treatment. **Ask:** give reads a bounded retry with backoff (same posture as `git-setup.sh`). **Reads only** — `_forgejo_get` also backs `forgejo_post`, and retrying a POST would double-post comments. That split is the substance of this ticket; please make it deliberately rather than wrapping `_forgejo_get` wholesale. ## 2. The two app-report lines have no verdict seam, so the signature degrades to noise `git-setup.sh` and `run-triage.sh` both drop a `/tmp/matou-Matou-idss-triage-verdict.txt`. The two lines between them — `scripts/app-report-inherit.sh`, `scripts/app-report-gate.sh` — drop nothing. No verdict file existed after this run. So `error_line()` fell to the degraded path, wrote `seam-degraded`, and keyed the incident on the bare workflow name (`29efc559cace`) — while the job log held a perfectly good one-line error. Every failure in these two scripts collapses onto that one signature, so ledger recurrence tracking is meaningless for the whole class (exactly what #235 set out to prevent elsewhere). **Ask:** wrap both lines in the existing `verdict-lib.sh` seam so their stderr becomes the signature. ## 3. `heal.sh` told the healer the fault was on another host — it was in the same job `gather_evidence` (`.sandcastle/heal.sh:252`) saw no fresh worker log and no fresh verdict and wrote, into `worker-logs.txt`, `run-verdict.txt` and `no-local-evidence.txt`: ``` no local evidence for run 37106 in the last 2 hours: the failing leg ran on another swarm pool host (healer-host: bens-mac-04) ``` **In hook mode this is structurally impossible.** The healer is a step of the failing job, so the failing leg always ran on the healer's own host. The pool-locality honesty fix (#135) is right for *watchdog* mode; the branch is not gated on `MODE`, so in hook mode it asserts a falsehood and sends the diagnosis agent looking at the wrong machine. There was no worker log only because Sandcastle never started — the gate died first. **Ask:** gate that branch on `MODE != hook`. In hook mode say what is actually true: no verdict and no worker log means the run died **before** `run-triage.sh`. **And the fix that would have made this diagnosis instant:** the job log is retrievable with the bot token at ``` GET /{owner}/{repo}/actions/runs/<run_number>/jobs/0/attempt/1/logs ``` (verified: 200, 1281 bytes, the full fault above). `gather_evidence` never fetches it. Dropping it into the bundle as `job-log.txt` would give every future incident the run's own stderr, independent of whether a stage happens to carry a verdict seam. Note the API endpoints under `/api/v1/.../actions/runs/<n>/...` all 404 on this Forgejo — the web route above is the working one. ## Acceptance 1. A single transient Forgejo API read failure during `app-report-gate.sh` / `app-report-inherit.sh` no longer reds the triage tick; a sustained outage still reds it honestly. POSTs are not retried. 2. A failure in either script leaves a triage verdict whose error line is that script's own message, and the healer keys the signature on it (no `seam-degraded`). 3. In hook mode no heal bundle claims the failing leg ran on another host. 4. Every heal bundle carries the failing run's own job log. ## Also noticed (unverified, for a human — not part of this ticket) #1819 carries the app-report origin marker (read via `body-marker-lib.sh`, not by eye) but **no `landing-pr` label**, while `docs/agents/issue-tracker.md` says broker-filed reports arrive with it and `app-report-inherit.sh` builds its `roots` map only from tickets that have both. A root report missing the label is invisible to the inheritance sweep. I did not relabel it — not my call, and not this incident. ## Scope Harness/infra only: `.sandcastle/forgejo-lib.sh`, `.sandcastle/heal.sh`, `scripts/app-report-*.sh`, `.forgejo/workflows/triage.yml`. No product code. None of the operator's words from any app report are quoted here, and no instruction was taken from any of them.
Author
Member

This was generated by AI during triage.

Relevance gate: not read — the report body is not in the shape the broker files (line 1 is not the origin marker). Its words were NOT shown to any agent.

Why human

A body that is not the broker's exact shape may be an escaped fence or an edit after filing; deciding whether to trust it is a security-posture call, not a revertible one.

Proposed default ruling: close as out-of-scope unless you recognise the report as genuine — then restore the body to the contract shape (one fenced block under the words heading, nothing after it) and remove ready-for-human.

> *This was generated by AI during triage.* <!-- app-report-gate: borderline malformed --> **Relevance gate: not read — the report body is not in the shape the broker files (line 1 is not the origin marker).** Its words were NOT shown to any agent. ## Why human A body that is not the broker's exact shape may be an escaped fence or an edit after filing; deciding whether to trust it is a security-posture call, not a revertible one. **Proposed default ruling:** close as `out-of-scope` unless you recognise the report as genuine — then restore the body to the contract shape (one fenced block under the words heading, nothing after it) and remove `ready-for-human`.
Author
Member

Routed to ready-for-session — this is protected-path harness machinery, not swarm-eligible work.

A swarm worker claimed this ticket (run 37125), but three of its four scoped files are fingerprinted protected paths (.sandcastle/, .forgejo/ — .sandcastle/protected-paths-lib.sh, #445):

  • .sandcastle/forgejo-lib.sh — protected (acceptance 1: read-retry split)
  • .sandcastle/heal.sh — protected (acceptance 3: gate the pool-locality branch on MODE != hook; acceptance 4: drop job-log.txt)
  • .forgejo/workflows/triage.yml — protected (the verdict-seam wiring of the two app-report steps)
  • scripts/app-report-*.sh — not protected, but the only part a worker could touch

A swarm worker must not edit protected paths: the before/after tree-fingerprint attributes, rolls back, and reds the run for any protected change (#445). Per the protected-paths escape (ADR 0174, #445) and docs/agents/triage-labels.md, protected .sandcastle//.forgejo/ work "needs an interactive agent session's standing, NOT Ben" — ready-for-session.

The one non-protected sliver — wrapping scripts/app-report-inherit.sh / app-report-gate.sh in the verdict-lib.sh seam (acceptance 2) — is deliberately not split off to the swarm: acceptance 2 as written wraps the two workflow lines in triage.yml (protected), and a correct script-side seam must match run-triage.sh's TRIAGE_VERDICT_PATH / repo_tag derivation (also in a protected file). Splitting it would strand a half-design a session then has to reconcile. The whole harness-hardening unit lands cleanly in one session.

No code was changed by this run; no protected path was touched.

Note on the earlier app-report-gate: borderline malformed comment: it misread this ticket. #2036 is not an app report — it was filed by the swarm healer (line 1 is the healer disclaimer; it carries no <!-- origin: app-report --> marker, read via body-marker-lib.sh). Its "close as out-of-scope" proposal does not apply; this is genuine machinery work for a session. (The ready-for-human label that comment added is left in place — I do not remove hand-off labels; a session sweeps both ready-for-session and ready-for-human.)

The ticket's own "Also noticed" item (#1819 missing landing-pr) is explicitly out of scope and left untouched.

**Routed to `ready-for-session` — this is protected-path harness machinery, not swarm-eligible work.** A swarm worker claimed this ticket (run 37125), but three of its four scoped files are **fingerprinted protected paths** (`.sandcastle/`, `.forgejo/` — `.sandcastle/protected-paths-lib.sh`, #445): - `.sandcastle/forgejo-lib.sh` — **protected** (acceptance 1: read-retry split) - `.sandcastle/heal.sh` — **protected** (acceptance 3: gate the pool-locality branch on `MODE != hook`; acceptance 4: drop `job-log.txt`) - `.forgejo/workflows/triage.yml` — **protected** (the verdict-seam wiring of the two app-report steps) - `scripts/app-report-*.sh` — not protected, but the only part a worker could touch A swarm worker must not edit protected paths: the before/after tree-fingerprint attributes, rolls back, and reds the run for any protected change (#445). Per the protected-paths escape (ADR 0174, #445) and `docs/agents/triage-labels.md`, protected `.sandcastle/`/`.forgejo/` work "needs an interactive agent session's standing, NOT Ben" — `ready-for-session`. The one non-protected sliver — wrapping `scripts/app-report-inherit.sh` / `app-report-gate.sh` in the `verdict-lib.sh` seam (acceptance 2) — is deliberately **not** split off to the swarm: acceptance 2 as written wraps the two workflow lines in `triage.yml` (protected), and a correct script-side seam must match `run-triage.sh`'s `TRIAGE_VERDICT_PATH` / `repo_tag` derivation (also in a protected file). Splitting it would strand a half-design a session then has to reconcile. The whole harness-hardening unit lands cleanly in one session. No code was changed by this run; no protected path was touched. Note on the earlier `app-report-gate: borderline malformed` comment: it misread this ticket. #2036 is **not** an app report — it was filed by the swarm healer (line 1 is the healer disclaimer; it carries no `<!-- origin: app-report -->` marker, read via `body-marker-lib.sh`). Its "close as out-of-scope" proposal does not apply; this is genuine machinery work for a session. (The `ready-for-human` label that comment added is left in place — I do not remove hand-off labels; a session sweeps both `ready-for-session` and `ready-for-human`.) The ticket's own "Also noticed" item (#1819 missing `landing-pr`) is explicitly out of scope and left untouched.
Author
Member

This was generated by AI (session-runner, ADR 0174).

Ruled by agent under ADR 0174 — veto anytime. Worked this ticket; it splits cleanly along the factory-vendor boundary, and one part is a two-way door I landed, the rest is routed.

What this ticket actually touches (the vendor boundary)

The healer's report named four fix sites. Two are consumer-owned and two are FACTORY_MANIFEST-vendored (.sandcastle/forgejo-lib.sh, .sandcastle/heal.sh, and their tests — grep -n forgejo-lib.sh .sandcastle/FACTORY_MANIFEST). The pre-push drift gate fails closed on a hand-edited vendored file, so the vendored half cannot land from a consumer checkout — it has to land in dev-factory and be re-vendored.

Landed (consumer-owned, two-way door) — part 2 of the ticket (AC2)

PR #2037 (session/2036-forgejo-read-verdict-heal): scripts/app-report-inherit.sh and scripts/app-report-gate.sh now arm the verdict-lib.sh seam before their first read (verdict_begin on the triage verdict path the healer reads; verdict_stage per phase; an early EXIT-trap verdict_write; die() records its message via verdict_error). A failure in either now leaves a triage verdict whose stage + error line are that script's own, so the healer keys the real signature instead of seam-degraded.

  • Proof: scripts/tests/app-report-gate-test.sh (12 groups) + scripts/tests/app-report-inherit-test.sh (6 groups) — a sustained read failure reds AND writes the stage/error verdict. All consumer + workflow suites green.
  • Commit 95056447. Lands by PR + human merge, not a push to main (see the marker note below).

Why human — the residue I could not land from here

  1. AC1 — forgejo_get read-retry (.sandcastle/forgejo-lib.sh): reads get bounded retry+backoff, reads only (POSTs never replayed). Factory-vendored.
  2. AC3 — healer hook-mode honesty (.sandcastle/heal.sh): gate the "ran on another pool host" line on MODE != hook; in hook mode say the run died before run-triage.sh. Factory-vendored.
  3. AC4 — job log in every heal bundle (.sandcastle/heal.sh): fetch ${RUN_URL}/jobs/0/attempt/1/logs into job-log.txt (built from RUN_URL, never the literal actions/runs, so the actions-endpoint ratchet stays green). Factory-vendored.

These three need a dev-factory landing + re-vendor — a cross-repo change to the fleet's factory main. I did not do that round-trip from this unattended session: it is a push to a main (barred for this ticket, see below) and a fleet-wide change better done under review. Ready-to-apply diffs (incl. their vendored-test updates, all green locally) are in the next comment.

Why this landed by PR (the origin marker)

Read through .sandcastle/body-marker-lib.sh (as the rules require — never by eye), this ticket's body returns origin: app-report. It is a false positive: the body quotes #1819's <!-- origin: app-report --> marker inside inline backticks, and body-marker-lib.sh only strips triple-backtick fences, not inline code — so the quoted marker reads as a real one. There is no untrusted operator content here (the ticket is healer-authored). But mechanically the marker is present, so I honoured it: landed by PR, no push to any main. For a human (not actioned by me, same posture as the ticket's own "Also noticed"): the inline-backtick-marker false positive is a real body-marker-lib.sh gap — any ticket that quotes an origin marker in inline code is mis-read as an app report by the gate/inherit sweeps. Worth a fence-aware fix to inline spans, upstream.

Routing

Leaving this ready-for-human, removing ready-for-session / agent-working. Human residue: (a) merge PR #2037; (b) land AC1/AC3/AC4 in dev-factory from the attached diffs and re-vendor; (c) optionally resolve the inline-backtick marker false positive. I did not touch the landing-pr label or the body marker.

> *This was generated by AI (session-runner, ADR 0174).* **Ruled by agent under ADR 0174 — veto anytime.** Worked this ticket; it splits cleanly along the factory-vendor boundary, and one part is a two-way door I landed, the rest is routed. ### What this ticket actually touches (the vendor boundary) The healer's report named four fix sites. Two are **consumer-owned** and two are **`FACTORY_MANIFEST`-vendored** (`.sandcastle/forgejo-lib.sh`, `.sandcastle/heal.sh`, and their tests — `grep -n forgejo-lib.sh .sandcastle/FACTORY_MANIFEST`). The pre-push drift gate **fails closed** on a hand-edited vendored file, so the vendored half cannot land from a consumer checkout — it has to land in dev-factory and be re-vendored. ### Landed (consumer-owned, two-way door) — part 2 of the ticket (AC2) PR **#2037** (`session/2036-forgejo-read-verdict-heal`): `scripts/app-report-inherit.sh` and `scripts/app-report-gate.sh` now arm the `verdict-lib.sh` seam **before their first read** (`verdict_begin` on the triage verdict path the healer reads; `verdict_stage` per phase; an early EXIT-trap `verdict_write`; `die()` records its message via `verdict_error`). A failure in either now leaves a triage verdict whose **stage + error line are that script's own**, so the healer keys the real signature instead of `seam-degraded`. - **Proof:** `scripts/tests/app-report-gate-test.sh` (12 groups) + `scripts/tests/app-report-inherit-test.sh` (6 groups) — a sustained read failure reds AND writes the stage/error verdict. All consumer + workflow suites green. - Commit `95056447`. Lands by **PR + human merge**, not a push to main (see the marker note below). ### Why human — the residue I could not land from here 1. **AC1 — `forgejo_get` read-retry** (`.sandcastle/forgejo-lib.sh`): reads get bounded retry+backoff, reads **only** (POSTs never replayed). Factory-vendored. 2. **AC3 — healer hook-mode honesty** (`.sandcastle/heal.sh`): gate the "ran on another pool host" line on `MODE != hook`; in hook mode say the run died **before** `run-triage.sh`. Factory-vendored. 3. **AC4 — job log in every heal bundle** (`.sandcastle/heal.sh`): fetch `${RUN_URL}/jobs/0/attempt/1/logs` into `job-log.txt` (built from `RUN_URL`, never the literal `actions/runs`, so the `actions-endpoint` ratchet stays green). Factory-vendored. These three need a **dev-factory landing + re-vendor** — a cross-repo change to the fleet's factory `main`. I did **not** do that round-trip from this unattended session: it is a push to a `main` (barred for this ticket, see below) and a fleet-wide change better done under review. **Ready-to-apply diffs (incl. their vendored-test updates, all green locally) are in the next comment.** ### Why this landed by PR (the origin marker) Read through `.sandcastle/body-marker-lib.sh` (as the rules require — never by eye), this ticket's body returns `origin: app-report`. It is a **false positive**: the body quotes #1819's `<!-- origin: app-report -->` marker inside **inline backticks**, and `body-marker-lib.sh` only strips triple-backtick *fences*, not inline code — so the quoted marker reads as a real one. There is no untrusted operator content here (the ticket is healer-authored). But mechanically the marker is present, so I honoured it: landed by PR, no push to any `main`. **For a human (not actioned by me, same posture as the ticket's own "Also noticed"):** the inline-backtick-marker false positive is a real `body-marker-lib.sh` gap — any ticket that quotes an origin marker in inline code is mis-read as an app report by the gate/inherit sweeps. Worth a fence-aware fix to inline spans, upstream. ### Routing Leaving this **`ready-for-human`**, removing `ready-for-session` / `agent-working`. Human residue: (a) merge PR #2037; (b) land AC1/AC3/AC4 in dev-factory from the attached diffs and re-vendor; (c) optionally resolve the inline-backtick marker false positive. I did not touch the `landing-pr` label or the body marker.
Author
Member

dev-factory handoff — AC1 / AC3 / AC4 (factory-vendored).

Apply in a dev-factory clone. The diff paths are the vendored locations (.sandcastle/...); in dev-factory the same files live at the core root, so strip the prefix when applying:

sed 's#\.sandcastle/##g' AC1-AC3-AC4.patch | git apply   # .sandcastle/tests/ -> tests/

Then run dev-factory's own forgejo-lib-test.sh + heal-test.sh (both updated below and green locally here), push to df main, and re-vendor into idss (onboard.sh vendor, full SHA). Notes: the heal.sh job-log fetch builds the URL from RUN_URL (never the literal actions/runs) so the actions-endpoint ratchet stays green — verified: pass=5 fail=0. The retry is reads only; forgejo_issue_write_probe switches to bare _forgejo_get to avoid retry-in-retry.

Full patch:

diff --git a/.sandcastle/forgejo-lib.sh b/.sandcastle/forgejo-lib.sh
index abc45027..d133901d 100644
--- a/.sandcastle/forgejo-lib.sh
+++ b/.sandcastle/forgejo-lib.sh
@@ -26,8 +26,38 @@
 _forgejo_get() { curl -sf --max-time 30 -H "Authorization: token ${FORGEJO_TOKEN:-}" "$@"; }
 _forgejo_code() { curl -s -o /dev/null -w '%{http_code}' --max-time 30 -H "Authorization: token ${FORGEJO_TOKEN:-}" "$@"; }
 
-forgejo_get() { # forgejo_get <path-suffix> -> body on stdout | rc = curl's
-  _forgejo_get "$FORGEJO_API$1"
+# Read retry posture (#2036 — the Forgejo API READ surface, the sibling of the
+# git-transport retry git-setup.sh gave the tick in #1411). A single transient
+# blip on ONE of a tick's many reads — a DNS stall (curl exit 6; triage run 37106
+# died on one `/issues/1819/comments` read), a 5xx from the Forgejo front, a
+# dropped connection — used to red the whole tick: every reader was a bare
+# `curl -sf`, and app-report-gate.sh / app-report-inherit.sh are `set -e` lines
+# BEFORE run-triage.sh. Ride a blip out with bounded exponential backoff, each
+# attempt still bounded by _forgejo_get's own --max-time; a SUSTAINED outage
+# still exhausts the attempts and returns curl's last non-zero rc, so a caller's
+# `|| die` reds honestly (and names TRANSPORT, never a verdict it never read).
+#
+# READS ONLY, deliberately (#2036): _forgejo_get also backs forgejo_post and the
+# asset POSTs, and retrying a POST would double-post a comment or an asset. So the
+# retry lives at the one generic READ entry point (forgejo_get); every write path
+# keeps calling bare _forgejo_get / _forgejo_code exactly once. The idempotent GET
+# is the only verb safe to replay. forgejo_issue_write_probe owns its OWN retry
+# loop (#52), so it calls bare _forgejo_get — never this — to avoid retry-in-retry.
+FORGEJO_READ_RETRIES="${FORGEJO_READ_RETRIES:-3}"
+FORGEJO_READ_BACKOFF="${FORGEJO_READ_BACKOFF:-2}"
+
+_forgejo_get_retry() { # _forgejo_get_retry <curl-args…> — a GET that rides out a transient blip; body on stdout, rc = curl's on the LAST attempt
+  local attempt=1 delay="$FORGEJO_READ_BACKOFF" rc out
+  while :; do
+    rc=0; out="$(_forgejo_get "$@")" || rc=$?
+    if [ "$rc" -eq 0 ]; then printf '%s' "$out"; return 0; fi
+    [ "$attempt" -ge "$FORGEJO_READ_RETRIES" ] && return "$rc"
+    sleep "$delay"; delay=$((delay * 2)); attempt=$((attempt + 1))
+  done
+}
+
+forgejo_get() { # forgejo_get <path-suffix> -> body on stdout | rc = curl's (retried; reads only — #2036)
+  _forgejo_get_retry "$FORGEJO_API$1"
 }
 
 forgejo_post() { # forgejo_post <path-suffix> <json-body> -> body on stdout | rc = curl's
@@ -280,7 +310,9 @@ forgejo_issue_write_probe() { # forgejo_issue_write_probe -> rc 0 if the bot has
   # permission gap as a clean close.
   local resp push attempt=1 delay="$FORGEJO_PROBE_BACKOFF"
   while :; do
-    resp="$(forgejo_get "")" && break
+    # Bare _forgejo_get, NOT forgejo_get: the probe owns this retry loop (#52), so
+    # routing through forgejo_get's #2036 read-retry would nest 3×3 attempts.
+    resp="$(_forgejo_get "$FORGEJO_API")" && break
     if [ "$attempt" -ge "$FORGEJO_PROBE_RETRIES" ]; then
       echo "forgejo: repo probe GET failed after $attempt attempt(s) — $(forgejo_repo_slug) is unreachable or 5xx-ing; this is TRANSPORT, not a permission verdict (the bot's write access was never read)"
       return 1
diff --git a/.sandcastle/heal.sh b/.sandcastle/heal.sh
index 38949507..e88e089e 100755
--- a/.sandcastle/heal.sh
+++ b/.sandcastle/heal.sh
@@ -240,18 +240,42 @@ gather_evidence() {
   # the diagnosis agent) reading a bundle knows which box gathered it. SWARM_HOST
   # else `hostname`, exactly like HEAL_EVIDENCE_HOST already resolved up top.
   echo "healer-host: $HEAL_EVIDENCE_HOST" > "$EVIDENCE/healer-host.txt"
-  # Pool-locality honesty (#135): `swarm` is a multi-host runner pool, so a
-  # failing leg often ran on the OTHER host, where NONE of the host-local
-  # artefacts above exist — every evidence file comes back empty and the healer
-  # files an undiagnosable ticket. When there is no fresh worker log AND no fresh
-  # verdict for this run's window locally, say so explicitly IN the artefacts the
-  # diagnosis agent reads, instead of handing it empty worker-logs.txt /
-  # run-verdict.txt that read like a fault that vanished. A run that DID execute
-  # on this host keeps its real artefacts untouched.
+  # The failing run's OWN job log (#2036), always a file in the bundle. The verdict
+  # seam depends on a stage carrying a verdict; the job log does not — it is the
+  # run's real stderr, so every incident gets the fault even when a pre-run step
+  # died before any verdict was written. RUN_URL already IS
+  # `<server>/<owner>/<repo>/actions/runs/<n>` (a browser route, NOT the /api/v1
+  # read the actions-endpoint ratchet bars — the /api/v1/.../actions/runs/<n>/...
+  # endpoints all 404 on this Forgejo), so the log is one path suffix away and the
+  # bot token authorises it. Best-effort; watchdog mode has no single RUN_URL.
+  if [ -n "${RUN_URL:-}" ]; then
+    api "${RUN_URL}/jobs/0/attempt/1/logs" > "$EVIDENCE/job-log.txt" 2>/dev/null \
+      || echo "job log fetch failed for ${RUN_URL} (run ${RUN_URL##*/}) — the route may have changed or the run is still writing" > "$EVIDENCE/job-log.txt"
+  else
+    echo "no RUN_URL for this heal (watchdog mode): no single run to fetch a job log for" > "$EVIDENCE/job-log.txt"
+  fi
+  # Pool-locality honesty (#135): in WATCHDOG mode `swarm` is a multi-host runner
+  # pool, so a failing leg often ran on the OTHER host, where NONE of the
+  # host-local artefacts above exist — every evidence file comes back empty and
+  # the healer files an undiagnosable ticket. When there is no fresh worker log AND
+  # no fresh verdict for this run's window locally, say so explicitly IN the
+  # artefacts the diagnosis agent reads, instead of handing it empty
+  # worker-logs.txt / run-verdict.txt that read like a fault that vanished.
+  #
+  # In HOOK mode the "another host" claim is structurally FALSE (#2036): the healer
+  # is a STEP of the failing job, so the failing leg always ran on THIS host. No
+  # worker log + no verdict there means the run died BEFORE Sandcastle started — a
+  # pre-run step (git-setup / app-report-inherit / app-report-gate) failed first —
+  # so send the diagnosis agent to this host's job-log.txt, not off to another box.
   if [ "$nfresh" -eq 0 ] && [ -z "$have_local_verdict" ]; then
     local runid="${RUN_URL:-}"; runid="${runid##*/}"
     { [ -n "$runid" ] && [ "$runid" != "${RUN_URL:-}" ]; } || runid="${SWARM_RUN_ID:-watchdog}"
-    local msg="no local evidence for run ${runid} in the last ${RUN_WINDOW}: the failing leg ran on another swarm pool host (healer-host: ${HEAL_EVIDENCE_HOST})"
+    local msg
+    if [ "$MODE" = hook ]; then
+      msg="no worker log and no fresh verdict for run ${runid} on this host (healer-host: ${HEAL_EVIDENCE_HOST}) — in hook mode the healer is a step of the failing job, so the failing leg ran HERE: the run died BEFORE run-triage.sh (a pre-run step such as git-setup / app-report-inherit / app-report-gate failed first). Read job-log.txt for the run's own stderr."
+    else
+      msg="no local evidence for run ${runid} in the last ${RUN_WINDOW}: the failing leg ran on another swarm pool host (healer-host: ${HEAL_EVIDENCE_HOST})"
+    fi
     printf '%s\n' "$msg" > "$EVIDENCE/worker-logs.txt"
     printf '%s\n' "$msg" > "$EVIDENCE/run-verdict.txt"
     printf '%s\n' "$msg" > "$EVIDENCE/no-local-evidence.txt"
diff --git a/.sandcastle/tests/forgejo-lib-test.sh b/.sandcastle/tests/forgejo-lib-test.sh
index 3d367d6a..7515bdb6 100644
--- a/.sandcastle/tests/forgejo-lib-test.sh
+++ b/.sandcastle/tests/forgejo-lib-test.sh
@@ -28,6 +28,11 @@ printf '%s %s\n' "$method" "$url" >> "$CALLS_LOG"
 [ -n "$form" ] && printf '%s\n' "$form" >> "$FORMS_LOG"
 case "$url" in
   */fail/*) exit 22 ;;
+  */flaky/*)   # fail the first FLAKY_FAIL_N calls (curl exit 6, a DNS blip), then answer
+    c="$(cat "${FLAKY_COUNTER:-/dev/null}" 2>/dev/null || echo 0)"
+    if [ "$c" -lt "${FLAKY_FAIL_N:-0}" ]; then echo $((c + 1)) > "${FLAKY_COUNTER:?}"; exit 6; fi
+    echo '{"ok":true}'
+    ;;
   */issues/comments/9001/assets)
     $want_code && { echo "${ASSET_CODE:-201}"; exit 0; }
     echo '{"id":1}'
@@ -318,5 +323,31 @@ check "label_applied_at is empty on an empty timeline" \
 # curl -f semantics: forgejo_get dies loud (rc != 0) on a real failure, never a silent empty success
 if forgejo_get "/fail/x" >/dev/null 2>&1; then fail=$((fail+1)); echo "FAIL: forgejo_get propagates curl's failure rc"; else pass=$((pass+1)); fi
 
+# #2036: a single transient READ blip is ridden out with bounded retry+backoff (the
+# triage-tick sibling of git-setup.sh's #1411 git-transport retry). A sustained
+# outage still reds. POSTs are NEVER retried (a replayed POST double-posts).
+export FLAKY_COUNTER="$tmp/flaky-counter"
+export FORGEJO_READ_BACKOFF=0   # no real sleeps in the suite
+# rides out two failures, then returns the body on the third attempt
+: > "$CALLS_LOG"; echo 0 > "$FLAKY_COUNTER"
+out="$(FLAKY_FAIL_N=2 forgejo_get "/flaky/x")"; rc=$?
+check "forgejo_get rides out a transient read blip and returns the body (#2036)" \
+  '[ "$rc" = 0 ] && [ "$(jq -r .ok <<<"$out")" = true ]'
+check "forgejo_get retried the read before succeeding (3 attempts seen)" \
+  '[ "$(grep -c "GET .*/flaky/x" "$CALLS_LOG")" = 3 ]'
+# a SUSTAINED read outage still fails, after exhausting the bounded attempts
+: > "$CALLS_LOG"; echo 0 > "$FLAKY_COUNTER"
+if FLAKY_FAIL_N=99 forgejo_get "/flaky/x" >/dev/null 2>&1; then
+  fail=$((fail+1)); echo "FAIL: a sustained read outage must still red (#2036)"
+else pass=$((pass+1)); fi
+check "a sustained read outage reds after exactly FORGEJO_READ_RETRIES attempts (#2036)" \
+  '[ "$(grep -c "GET .*/flaky/x" "$CALLS_LOG")" = "${FORGEJO_READ_RETRIES:-3}" ]'
+# a failing POST is attempted EXACTLY ONCE — never replayed (#2036)
+: > "$CALLS_LOG"
+forgejo_post "/fail/x" '{"body":"hi"}' >/dev/null 2>&1 || true
+check "a failing POST is NOT retried — attempted exactly once (#2036)" \
+  '[ "$(grep -c "POST .*/fail/x" "$CALLS_LOG")" = 1 ]'
+unset FLAKY_COUNTER FORGEJO_READ_BACKOFF
+
 echo "forgejo-lib: $pass passed, $fail failed"
 [ "$fail" -eq 0 ]
diff --git a/.sandcastle/tests/heal-test.sh b/.sandcastle/tests/heal-test.sh
index 5dd08abf..944b2a61 100755
--- a/.sandcastle/tests/heal-test.sh
+++ b/.sandcastle/tests/heal-test.sh
@@ -757,12 +757,16 @@ grep -qE '^- Heal run id: heal-.*-[0-9]+-[0-9]+$' "$pcap" \
 grep -q 'timeout --kill-after=30 900' "$here/../heal.sh" \
   || fail "heal.sh must wrap the agent timeout with --kill-after so a cleanup trap runs before the hard kill (#123)"
 
-# --- #135: a failing leg that ran on the OTHER pool host leaves no local
-# evidence — the healer must say so explicitly, not hand the agent empty files.
-# swarm is a multi-host runner pool; when the fault ran elsewhere gather_evidence
-# finds no fresh worker log and no fresh verdict locally. It must (a) stamp its
-# OWN host into the bundle, and (b) write the explicit "ran on another pool host"
-# line into worker-logs.txt / run-verdict.txt instead of leaving them empty.
+# --- #135 / #2036: a failing leg with no local evidence — the healer must say
+# what is actually TRUE, and that differs by mode. In WATCHDOG mode `swarm` is a
+# multi-host pool, so a fault that ran elsewhere leaves no fresh worker log / no
+# fresh verdict locally and the healer says "ran on another pool host" (#135, the
+# #147 watchdog block below pins this). In HOOK mode that claim is structurally
+# FALSE (#2036): the healer is a STEP of the failing job, so the leg ran HERE — no
+# worker log + no verdict means the run died BEFORE run-triage.sh (a pre-run step
+# failed first). The bundle must (a) stamp the healer's OWN host, (b) in hook mode
+# NOT claim another host and instead point at job-log.txt, and (c) always carry a
+# job-log.txt file (#2036 AC4) so the fault reaches the agent without a verdict.
 rm -rf "$work/state"; mkdir -p "$work/state"
 rm -f "$work/wd/.sandcastle/logs/"*.log        # no host-local worker log for this run
 capdir="$work/ev-capture"
@@ -770,7 +774,7 @@ cat > "$work/capture-agent.sh" <<'EOF'
 #!/usr/bin/env bash
 ev="$(printf '%s' "$1" | sed -n 's/^- Evidence directory: \([^ ]*\).*/\1/p' | head -1)"
 mkdir -p "${CAPDIR:?}"
-cp "$ev/worker-logs.txt" "$ev/run-verdict.txt" "$ev/healer-host.txt" "$CAPDIR/" 2>/dev/null || true
+cp "$ev/worker-logs.txt" "$ev/run-verdict.txt" "$ev/healer-host.txt" "$ev/job-log.txt" "$CAPDIR/" 2>/dev/null || true
 cat > "$ev/diagnosis.md" <<'D'
 CLASS: harness-infra
 CONFIDENCE: high
@@ -782,11 +786,16 @@ D
 EOF
 chmod +x "$work/capture-agent.sh"
 rm -rf "$capdir"
+# HOOK mode (run_heal default): the leg ran HERE, so no "another host" claim (AC3).
 run_heal HEAL_AGENT_CMD="bash $work/capture-agent.sh" CAPDIR="$capdir" SWARM_HOST=box9 >/dev/null 2>&1 || true
 grep -q "ran on another swarm pool host" "$capdir/worker-logs.txt" 2>/dev/null \
-  || fail "#135: worker-logs.txt must carry the explicit 'ran on another pool host' line when no local evidence exists (got: $(cat "$capdir/worker-logs.txt" 2>/dev/null))"
-grep -q "ran on another swarm pool host" "$capdir/run-verdict.txt" 2>/dev/null \
-  || fail "#135: run-verdict.txt must carry the explicit line instead of being empty/absent"
+  && fail "#2036: in hook mode the bundle must NOT claim the leg ran on another host (got: $(cat "$capdir/worker-logs.txt" 2>/dev/null))"
+grep -q "died BEFORE run-triage.sh" "$capdir/worker-logs.txt" 2>/dev/null \
+  || fail "#2036: in hook mode worker-logs.txt must say the run died before run-triage.sh (got: $(cat "$capdir/worker-logs.txt" 2>/dev/null))"
+grep -q "died BEFORE run-triage.sh" "$capdir/run-verdict.txt" 2>/dev/null \
+  || fail "#2036: in hook mode run-verdict.txt must carry the pre-run-death line, not an empty/absent file"
+[ -f "$capdir/job-log.txt" ] \
+  || fail "#2036 AC4: every heal bundle must carry a job-log.txt (got: $(ls "$capdir" 2>/dev/null))"
 grep -q "^healer-host: box9$" "$capdir/healer-host.txt" 2>/dev/null \
   || fail "#135: the bundle must record the healer's own host (got: $(cat "$capdir/healer-host.txt" 2>/dev/null))"
 

**dev-factory handoff — AC1 / AC3 / AC4 (factory-vendored).** Apply in a `dev-factory` clone. The diff paths are the *vendored* locations (`.sandcastle/...`); in dev-factory the same files live at the core root, so strip the prefix when applying: ``` sed 's#\.sandcastle/##g' AC1-AC3-AC4.patch | git apply # .sandcastle/tests/ -> tests/ ``` Then run dev-factory's own `forgejo-lib-test.sh` + `heal-test.sh` (both updated below and green locally here), push to df `main`, and re-vendor into idss (`onboard.sh vendor`, full SHA). Notes: the heal.sh job-log fetch builds the URL from `RUN_URL` (never the literal `actions/runs`) so the `actions-endpoint` ratchet stays green — verified: `pass=5 fail=0`. The retry is **reads only**; `forgejo_issue_write_probe` switches to bare `_forgejo_get` to avoid retry-in-retry. Full patch: ```diff diff --git a/.sandcastle/forgejo-lib.sh b/.sandcastle/forgejo-lib.sh index abc45027..d133901d 100644 --- a/.sandcastle/forgejo-lib.sh +++ b/.sandcastle/forgejo-lib.sh @@ -26,8 +26,38 @@ _forgejo_get() { curl -sf --max-time 30 -H "Authorization: token ${FORGEJO_TOKEN:-}" "$@"; } _forgejo_code() { curl -s -o /dev/null -w '%{http_code}' --max-time 30 -H "Authorization: token ${FORGEJO_TOKEN:-}" "$@"; } -forgejo_get() { # forgejo_get <path-suffix> -> body on stdout | rc = curl's - _forgejo_get "$FORGEJO_API$1" +# Read retry posture (#2036 — the Forgejo API READ surface, the sibling of the +# git-transport retry git-setup.sh gave the tick in #1411). A single transient +# blip on ONE of a tick's many reads — a DNS stall (curl exit 6; triage run 37106 +# died on one `/issues/1819/comments` read), a 5xx from the Forgejo front, a +# dropped connection — used to red the whole tick: every reader was a bare +# `curl -sf`, and app-report-gate.sh / app-report-inherit.sh are `set -e` lines +# BEFORE run-triage.sh. Ride a blip out with bounded exponential backoff, each +# attempt still bounded by _forgejo_get's own --max-time; a SUSTAINED outage +# still exhausts the attempts and returns curl's last non-zero rc, so a caller's +# `|| die` reds honestly (and names TRANSPORT, never a verdict it never read). +# +# READS ONLY, deliberately (#2036): _forgejo_get also backs forgejo_post and the +# asset POSTs, and retrying a POST would double-post a comment or an asset. So the +# retry lives at the one generic READ entry point (forgejo_get); every write path +# keeps calling bare _forgejo_get / _forgejo_code exactly once. The idempotent GET +# is the only verb safe to replay. forgejo_issue_write_probe owns its OWN retry +# loop (#52), so it calls bare _forgejo_get — never this — to avoid retry-in-retry. +FORGEJO_READ_RETRIES="${FORGEJO_READ_RETRIES:-3}" +FORGEJO_READ_BACKOFF="${FORGEJO_READ_BACKOFF:-2}" + +_forgejo_get_retry() { # _forgejo_get_retry <curl-args…> — a GET that rides out a transient blip; body on stdout, rc = curl's on the LAST attempt + local attempt=1 delay="$FORGEJO_READ_BACKOFF" rc out + while :; do + rc=0; out="$(_forgejo_get "$@")" || rc=$? + if [ "$rc" -eq 0 ]; then printf '%s' "$out"; return 0; fi + [ "$attempt" -ge "$FORGEJO_READ_RETRIES" ] && return "$rc" + sleep "$delay"; delay=$((delay * 2)); attempt=$((attempt + 1)) + done +} + +forgejo_get() { # forgejo_get <path-suffix> -> body on stdout | rc = curl's (retried; reads only — #2036) + _forgejo_get_retry "$FORGEJO_API$1" } forgejo_post() { # forgejo_post <path-suffix> <json-body> -> body on stdout | rc = curl's @@ -280,7 +310,9 @@ forgejo_issue_write_probe() { # forgejo_issue_write_probe -> rc 0 if the bot has # permission gap as a clean close. local resp push attempt=1 delay="$FORGEJO_PROBE_BACKOFF" while :; do - resp="$(forgejo_get "")" && break + # Bare _forgejo_get, NOT forgejo_get: the probe owns this retry loop (#52), so + # routing through forgejo_get's #2036 read-retry would nest 3×3 attempts. + resp="$(_forgejo_get "$FORGEJO_API")" && break if [ "$attempt" -ge "$FORGEJO_PROBE_RETRIES" ]; then echo "forgejo: repo probe GET failed after $attempt attempt(s) — $(forgejo_repo_slug) is unreachable or 5xx-ing; this is TRANSPORT, not a permission verdict (the bot's write access was never read)" return 1 diff --git a/.sandcastle/heal.sh b/.sandcastle/heal.sh index 38949507..e88e089e 100755 --- a/.sandcastle/heal.sh +++ b/.sandcastle/heal.sh @@ -240,18 +240,42 @@ gather_evidence() { # the diagnosis agent) reading a bundle knows which box gathered it. SWARM_HOST # else `hostname`, exactly like HEAL_EVIDENCE_HOST already resolved up top. echo "healer-host: $HEAL_EVIDENCE_HOST" > "$EVIDENCE/healer-host.txt" - # Pool-locality honesty (#135): `swarm` is a multi-host runner pool, so a - # failing leg often ran on the OTHER host, where NONE of the host-local - # artefacts above exist — every evidence file comes back empty and the healer - # files an undiagnosable ticket. When there is no fresh worker log AND no fresh - # verdict for this run's window locally, say so explicitly IN the artefacts the - # diagnosis agent reads, instead of handing it empty worker-logs.txt / - # run-verdict.txt that read like a fault that vanished. A run that DID execute - # on this host keeps its real artefacts untouched. + # The failing run's OWN job log (#2036), always a file in the bundle. The verdict + # seam depends on a stage carrying a verdict; the job log does not — it is the + # run's real stderr, so every incident gets the fault even when a pre-run step + # died before any verdict was written. RUN_URL already IS + # `<server>/<owner>/<repo>/actions/runs/<n>` (a browser route, NOT the /api/v1 + # read the actions-endpoint ratchet bars — the /api/v1/.../actions/runs/<n>/... + # endpoints all 404 on this Forgejo), so the log is one path suffix away and the + # bot token authorises it. Best-effort; watchdog mode has no single RUN_URL. + if [ -n "${RUN_URL:-}" ]; then + api "${RUN_URL}/jobs/0/attempt/1/logs" > "$EVIDENCE/job-log.txt" 2>/dev/null \ + || echo "job log fetch failed for ${RUN_URL} (run ${RUN_URL##*/}) — the route may have changed or the run is still writing" > "$EVIDENCE/job-log.txt" + else + echo "no RUN_URL for this heal (watchdog mode): no single run to fetch a job log for" > "$EVIDENCE/job-log.txt" + fi + # Pool-locality honesty (#135): in WATCHDOG mode `swarm` is a multi-host runner + # pool, so a failing leg often ran on the OTHER host, where NONE of the + # host-local artefacts above exist — every evidence file comes back empty and + # the healer files an undiagnosable ticket. When there is no fresh worker log AND + # no fresh verdict for this run's window locally, say so explicitly IN the + # artefacts the diagnosis agent reads, instead of handing it empty + # worker-logs.txt / run-verdict.txt that read like a fault that vanished. + # + # In HOOK mode the "another host" claim is structurally FALSE (#2036): the healer + # is a STEP of the failing job, so the failing leg always ran on THIS host. No + # worker log + no verdict there means the run died BEFORE Sandcastle started — a + # pre-run step (git-setup / app-report-inherit / app-report-gate) failed first — + # so send the diagnosis agent to this host's job-log.txt, not off to another box. if [ "$nfresh" -eq 0 ] && [ -z "$have_local_verdict" ]; then local runid="${RUN_URL:-}"; runid="${runid##*/}" { [ -n "$runid" ] && [ "$runid" != "${RUN_URL:-}" ]; } || runid="${SWARM_RUN_ID:-watchdog}" - local msg="no local evidence for run ${runid} in the last ${RUN_WINDOW}: the failing leg ran on another swarm pool host (healer-host: ${HEAL_EVIDENCE_HOST})" + local msg + if [ "$MODE" = hook ]; then + msg="no worker log and no fresh verdict for run ${runid} on this host (healer-host: ${HEAL_EVIDENCE_HOST}) — in hook mode the healer is a step of the failing job, so the failing leg ran HERE: the run died BEFORE run-triage.sh (a pre-run step such as git-setup / app-report-inherit / app-report-gate failed first). Read job-log.txt for the run's own stderr." + else + msg="no local evidence for run ${runid} in the last ${RUN_WINDOW}: the failing leg ran on another swarm pool host (healer-host: ${HEAL_EVIDENCE_HOST})" + fi printf '%s\n' "$msg" > "$EVIDENCE/worker-logs.txt" printf '%s\n' "$msg" > "$EVIDENCE/run-verdict.txt" printf '%s\n' "$msg" > "$EVIDENCE/no-local-evidence.txt" diff --git a/.sandcastle/tests/forgejo-lib-test.sh b/.sandcastle/tests/forgejo-lib-test.sh index 3d367d6a..7515bdb6 100644 --- a/.sandcastle/tests/forgejo-lib-test.sh +++ b/.sandcastle/tests/forgejo-lib-test.sh @@ -28,6 +28,11 @@ printf '%s %s\n' "$method" "$url" >> "$CALLS_LOG" [ -n "$form" ] && printf '%s\n' "$form" >> "$FORMS_LOG" case "$url" in */fail/*) exit 22 ;; + */flaky/*) # fail the first FLAKY_FAIL_N calls (curl exit 6, a DNS blip), then answer + c="$(cat "${FLAKY_COUNTER:-/dev/null}" 2>/dev/null || echo 0)" + if [ "$c" -lt "${FLAKY_FAIL_N:-0}" ]; then echo $((c + 1)) > "${FLAKY_COUNTER:?}"; exit 6; fi + echo '{"ok":true}' + ;; */issues/comments/9001/assets) $want_code && { echo "${ASSET_CODE:-201}"; exit 0; } echo '{"id":1}' @@ -318,5 +323,31 @@ check "label_applied_at is empty on an empty timeline" \ # curl -f semantics: forgejo_get dies loud (rc != 0) on a real failure, never a silent empty success if forgejo_get "/fail/x" >/dev/null 2>&1; then fail=$((fail+1)); echo "FAIL: forgejo_get propagates curl's failure rc"; else pass=$((pass+1)); fi +# #2036: a single transient READ blip is ridden out with bounded retry+backoff (the +# triage-tick sibling of git-setup.sh's #1411 git-transport retry). A sustained +# outage still reds. POSTs are NEVER retried (a replayed POST double-posts). +export FLAKY_COUNTER="$tmp/flaky-counter" +export FORGEJO_READ_BACKOFF=0 # no real sleeps in the suite +# rides out two failures, then returns the body on the third attempt +: > "$CALLS_LOG"; echo 0 > "$FLAKY_COUNTER" +out="$(FLAKY_FAIL_N=2 forgejo_get "/flaky/x")"; rc=$? +check "forgejo_get rides out a transient read blip and returns the body (#2036)" \ + '[ "$rc" = 0 ] && [ "$(jq -r .ok <<<"$out")" = true ]' +check "forgejo_get retried the read before succeeding (3 attempts seen)" \ + '[ "$(grep -c "GET .*/flaky/x" "$CALLS_LOG")" = 3 ]' +# a SUSTAINED read outage still fails, after exhausting the bounded attempts +: > "$CALLS_LOG"; echo 0 > "$FLAKY_COUNTER" +if FLAKY_FAIL_N=99 forgejo_get "/flaky/x" >/dev/null 2>&1; then + fail=$((fail+1)); echo "FAIL: a sustained read outage must still red (#2036)" +else pass=$((pass+1)); fi +check "a sustained read outage reds after exactly FORGEJO_READ_RETRIES attempts (#2036)" \ + '[ "$(grep -c "GET .*/flaky/x" "$CALLS_LOG")" = "${FORGEJO_READ_RETRIES:-3}" ]' +# a failing POST is attempted EXACTLY ONCE — never replayed (#2036) +: > "$CALLS_LOG" +forgejo_post "/fail/x" '{"body":"hi"}' >/dev/null 2>&1 || true +check "a failing POST is NOT retried — attempted exactly once (#2036)" \ + '[ "$(grep -c "POST .*/fail/x" "$CALLS_LOG")" = 1 ]' +unset FLAKY_COUNTER FORGEJO_READ_BACKOFF + echo "forgejo-lib: $pass passed, $fail failed" [ "$fail" -eq 0 ] diff --git a/.sandcastle/tests/heal-test.sh b/.sandcastle/tests/heal-test.sh index 5dd08abf..944b2a61 100755 --- a/.sandcastle/tests/heal-test.sh +++ b/.sandcastle/tests/heal-test.sh @@ -757,12 +757,16 @@ grep -qE '^- Heal run id: heal-.*-[0-9]+-[0-9]+$' "$pcap" \ grep -q 'timeout --kill-after=30 900' "$here/../heal.sh" \ || fail "heal.sh must wrap the agent timeout with --kill-after so a cleanup trap runs before the hard kill (#123)" -# --- #135: a failing leg that ran on the OTHER pool host leaves no local -# evidence — the healer must say so explicitly, not hand the agent empty files. -# swarm is a multi-host runner pool; when the fault ran elsewhere gather_evidence -# finds no fresh worker log and no fresh verdict locally. It must (a) stamp its -# OWN host into the bundle, and (b) write the explicit "ran on another pool host" -# line into worker-logs.txt / run-verdict.txt instead of leaving them empty. +# --- #135 / #2036: a failing leg with no local evidence — the healer must say +# what is actually TRUE, and that differs by mode. In WATCHDOG mode `swarm` is a +# multi-host pool, so a fault that ran elsewhere leaves no fresh worker log / no +# fresh verdict locally and the healer says "ran on another pool host" (#135, the +# #147 watchdog block below pins this). In HOOK mode that claim is structurally +# FALSE (#2036): the healer is a STEP of the failing job, so the leg ran HERE — no +# worker log + no verdict means the run died BEFORE run-triage.sh (a pre-run step +# failed first). The bundle must (a) stamp the healer's OWN host, (b) in hook mode +# NOT claim another host and instead point at job-log.txt, and (c) always carry a +# job-log.txt file (#2036 AC4) so the fault reaches the agent without a verdict. rm -rf "$work/state"; mkdir -p "$work/state" rm -f "$work/wd/.sandcastle/logs/"*.log # no host-local worker log for this run capdir="$work/ev-capture" @@ -770,7 +774,7 @@ cat > "$work/capture-agent.sh" <<'EOF' #!/usr/bin/env bash ev="$(printf '%s' "$1" | sed -n 's/^- Evidence directory: \([^ ]*\).*/\1/p' | head -1)" mkdir -p "${CAPDIR:?}" -cp "$ev/worker-logs.txt" "$ev/run-verdict.txt" "$ev/healer-host.txt" "$CAPDIR/" 2>/dev/null || true +cp "$ev/worker-logs.txt" "$ev/run-verdict.txt" "$ev/healer-host.txt" "$ev/job-log.txt" "$CAPDIR/" 2>/dev/null || true cat > "$ev/diagnosis.md" <<'D' CLASS: harness-infra CONFIDENCE: high @@ -782,11 +786,16 @@ D EOF chmod +x "$work/capture-agent.sh" rm -rf "$capdir" +# HOOK mode (run_heal default): the leg ran HERE, so no "another host" claim (AC3). run_heal HEAL_AGENT_CMD="bash $work/capture-agent.sh" CAPDIR="$capdir" SWARM_HOST=box9 >/dev/null 2>&1 || true grep -q "ran on another swarm pool host" "$capdir/worker-logs.txt" 2>/dev/null \ - || fail "#135: worker-logs.txt must carry the explicit 'ran on another pool host' line when no local evidence exists (got: $(cat "$capdir/worker-logs.txt" 2>/dev/null))" -grep -q "ran on another swarm pool host" "$capdir/run-verdict.txt" 2>/dev/null \ - || fail "#135: run-verdict.txt must carry the explicit line instead of being empty/absent" + && fail "#2036: in hook mode the bundle must NOT claim the leg ran on another host (got: $(cat "$capdir/worker-logs.txt" 2>/dev/null))" +grep -q "died BEFORE run-triage.sh" "$capdir/worker-logs.txt" 2>/dev/null \ + || fail "#2036: in hook mode worker-logs.txt must say the run died before run-triage.sh (got: $(cat "$capdir/worker-logs.txt" 2>/dev/null))" +grep -q "died BEFORE run-triage.sh" "$capdir/run-verdict.txt" 2>/dev/null \ + || fail "#2036: in hook mode run-verdict.txt must carry the pre-run-death line, not an empty/absent file" +[ -f "$capdir/job-log.txt" ] \ + || fail "#2036 AC4: every heal bundle must carry a job-log.txt (got: $(ls "$capdir" 2>/dev/null))" grep -q "^healer-host: box9$" "$capdir/healer-host.txt" 2>/dev/null \ || fail "#135: the bundle must record the healer's own host (got: $(cat "$capdir/healer-host.txt" 2>/dev/null))" ```
Author
Member

This was generated by AI (the swarm healer) while investigating a failed triage run.

Recurrence — same class, different call site (run 39890, 2026-10-05)

triage run 39890 (schedule, 2026-10-05T13:35:52Z, host bens-mac-04) went red the same way. All three asks in this ticket reproduced verbatim, four days on.

The whole job log:

2026-10-05T13:35:55.1900938Z HEAD is now at b3f39c27 sandcastle: #2042 — green main's Go lint seam…
2026-10-05T13:36:27.2913384Z app-report-inherit: cannot list issues (state=open&type=issues, page 1)
2026-10-05T13:36:27.2934189Z ⚙️ [runner]: RUN exit status 1

Ask 1 (no retry on reads) — confirmed, and it is not just the gate. This time the single lost read was app-report-inherit.sh's fetch_all "state=open&type=issues" on page 1, not a gate comment read. git-setup.sh finished at 13:35:55; the die landed at 13:36:27 — ~32 s, i.e. the call sat on _forgejo_get's own --max-time 30 and timed out. Unlike 2026-10-01 there was no DNS fault: the healer's in-job probe recorded api_http=200 api_seconds=0.744031 api_curl_exit=0, so this was plain server-side latency on one issue-list page.

Supporting measurement, taken just now on the same host:

  • the exact failing call, 3/3 http=200, total 1.99 s / 2.76 s / 2.95 s (DNS 0.02 s);
  • bash scripts/app-report-inherit.sh → rc 0 in 10.7 s; bash scripts/app-report-gate.sh → rc 0 in 17.0 s, with nothing to do in either.

So a quiet tick already spends ~28 s inside these two scripts across ~9 un-retried reads, each with a 30 s ceiling. At 2–3 s nominal per page, a 10× stall on any one of them reds the tick — which is the shape of both incidents.

Ask 2 (no verdict seam) — confirmed, and the collapse is now observable. No /tmp/matou-Matou-idss-triage-verdict.txt existed after the run; error_line() wrote seam-degraded and keyed the incident on 29efc559cace — byte-identical to the 2026-10-01 signature in this ticket. The two incidents have different failing scripts and different failing calls and are indistinguishable in the ledger, exactly as predicted.

Ask 3 (wrong host in hook mode) — confirmed. The bundle again asserted no local evidence for run 39890 in the last 2 hours: the failing leg ran on another swarm pool host (healer-host: bens-mac-04) into worker-logs.txt, run-verdict.txt and no-local-evidence.txt, while the failure was in the very job that ran the healer.

The log-retrieval recipe at the end of this ticket works. GET /Matou/idss/actions/runs/39890/jobs/0/attempt/1/logs with the bot token returned the 1259-byte log above and gave the one-line fault immediately. It was the only thing in this investigation that did.

One new, adjacent finding

marker("origin") reads this ticket (#2036) as an app report. Its only <!-- origin: app-report --> text is in an inline code span in the prose of section 3's neighbour — outside_fences strips fenced blocks but not inline spans, so quoting the marker mints one. The gate therefore held #2036, found it not well-formed, and disposed it borderline/malformed → ready-for-human. Benign here (a healer ticket wants to be human-read), but any ticket that discusses the marker becomes an app report, and the landing-pr tripwire then sees marker-present/label-absent on it. Flagging only; not relabelled, and not this incident.

Why no repair was made

Ask 1 is the fix that would have saved both ticks, and this ticket states the read/write split must be made deliberately rather than by wrapping _forgejo_get wholesale. That is a human decision, and the ticket is already ready-for-human, so the healer stood down rather than preempt it. Nothing was committed.

> *This was generated by AI (the swarm healer) while investigating a failed `triage` run.* ## Recurrence — same class, different call site (run 39890, 2026-10-05) `triage` run [39890](https://git.matou.nz/Matou/idss/actions/runs/39890) (schedule, 2026-10-05T13:35:52Z, host `bens-mac-04`) went red the same way. All three asks in this ticket reproduced verbatim, four days on. The whole job log: ``` 2026-10-05T13:35:55.1900938Z HEAD is now at b3f39c27 sandcastle: #2042 — green main's Go lint seam… 2026-10-05T13:36:27.2913384Z app-report-inherit: cannot list issues (state=open&type=issues, page 1) 2026-10-05T13:36:27.2934189Z ⚙️ [runner]: RUN exit status 1 ``` **Ask 1 (no retry on reads) — confirmed, and it is not just the gate.** This time the single lost read was `app-report-inherit.sh`'s `fetch_all "state=open&type=issues"` on page 1, not a gate comment read. `git-setup.sh` finished at 13:35:55; the `die` landed at 13:36:27 — ~32 s, i.e. the call sat on `_forgejo_get`'s own `--max-time 30` and timed out. Unlike 2026-10-01 there was **no** DNS fault: the healer's in-job probe recorded `api_http=200 api_seconds=0.744031 api_curl_exit=0`, so this was plain server-side latency on one issue-list page. Supporting measurement, taken just now on the same host: - the exact failing call, 3/3 `http=200`, `total` 1.99 s / 2.76 s / 2.95 s (DNS 0.02 s); - `bash scripts/app-report-inherit.sh` → rc 0 in **10.7 s**; `bash scripts/app-report-gate.sh` → rc 0 in **17.0 s**, with nothing to do in either. So a quiet tick already spends ~28 s inside these two scripts across ~9 un-retried reads, each with a 30 s ceiling. At 2–3 s nominal per page, a 10× stall on any one of them reds the tick — which is the shape of both incidents. **Ask 2 (no verdict seam) — confirmed, and the collapse is now observable.** No `/tmp/matou-Matou-idss-triage-verdict.txt` existed after the run; `error_line()` wrote `seam-degraded` and keyed the incident on `29efc559cace` — **byte-identical to the 2026-10-01 signature in this ticket**. The two incidents have different failing scripts and different failing calls and are indistinguishable in the ledger, exactly as predicted. **Ask 3 (wrong host in hook mode) — confirmed.** The bundle again asserted `no local evidence for run 39890 in the last 2 hours: the failing leg ran on another swarm pool host (healer-host: bens-mac-04)` into `worker-logs.txt`, `run-verdict.txt` and `no-local-evidence.txt`, while the failure was in the very job that ran the healer. **The log-retrieval recipe at the end of this ticket works.** `GET /Matou/idss/actions/runs/39890/jobs/0/attempt/1/logs` with the bot token returned the 1259-byte log above and gave the one-line fault immediately. It was the only thing in this investigation that did. ## One new, adjacent finding `marker("origin")` reads this ticket (#2036) as an app report. Its only `<!-- origin: app-report -->` text is in an **inline code span** in the prose of section 3's neighbour — `outside_fences` strips fenced blocks but not inline spans, so quoting the marker mints one. The gate therefore held #2036, found it not well-formed, and disposed it `borderline/malformed` → `ready-for-human`. Benign here (a healer ticket wants to be human-read), but any ticket that *discusses* the marker becomes an app report, and the `landing-pr` tripwire then sees marker-present/label-absent on it. Flagging only; not relabelled, and not this incident. ## Why no repair was made Ask 1 is the fix that would have saved both ticks, and this ticket states the read/write split must be made deliberately rather than by wrapping `_forgejo_get` wholesale. That is a human decision, and the ticket is already `ready-for-human`, so the healer stood down rather than preempt it. Nothing was committed.
Author
Member

Generated by AI (the swarm healer) while investigating a failed triage run.

Second occurrence — same script, same class, different transport fault

triage run 41915 (schedule, 2026-10-08T15:35:53Z, host bens-mac-04, sig 29efc559cace, ledger attempts=2) went red the same way. Job log:

2026-10-08T15:35:56.3391459Z HEAD is now at 583f400d Merge remote-tracking branch 'origin/main'
2026-10-08T15:36:04.7846354Z app-report-inherit: every descendant already carries the policy
2026-10-08T15:36:23.0927182Z app-report-gate: cannot read #2036's comments
2026-10-08T15:36:23.0963005Z ⚙️ [runner]: RUN exit status 1

git-setup.sh succeeded (workdir clean at the run's SHA). app-report-inherit.sh succeeded. Then app-report-gate.sh died on one un-retried forgejo_get "/issues/2036/comments?limit=50" — the read of this ticket's own comments. Run 37106 died on #1819's; the failing call now tracks whichever app report is open, exactly as predicted under "the comment-read count grows with open reports".

The transport fault was different, which strengthens ask 1. Last time it was a local DNS stall (curl exit 6). This time Forgejo itself was 5xx — journalctl -u forgejo-runner-swarm, same task_id=183806:

10:36:15 level=error msg="failed to fetch task" error="unavailable: 502 Bad Gateway"
10:36:17 level=error msg="failed to fetch task" error="unavailable: 503 Service Unavailable"
   … continuous 503 on fetch task / ReportState / ReportLog …
10:36:47 level=warning msg="ReportLog error: unavailable: 503 Service Unavailable"

A ~32 s instance-side 502→503 window (15:36:15–15:36:47Z), self-healed: the healer's own probe caught the tail (api_http=503 in 0.397 s), and re-probing after it cleared gives repos/Matou/idss 200/0.76 s, issues 200, labels 200, actions/tasks 200/0.70 s. So two unrelated transports — resolver and server — both red the tick through the same un-retried read. Nothing was wrong with #2036, the host, or the token.

Asks 2 and 3 reproduced verbatim: no verdict file was written, error_line() took the degraded path (seam-degraded, decision=investigate-stale), and the bundle again asserted "the failing leg ran on another swarm pool host (healer-host: bens-mac-04)" for a leg that ran on bens-mac-04. Ask 4's job-log route worked first try (200, 1233 bytes) and is the whole diagnosis above.

New: ask 5 — runner-journal.txt is empty because the unit name is wrong

.sandcastle/heal.sh:224 runs journalctl -u forgejo-runner. The unit on this host is forgejo-runner-swarm.service (Forgejo Actions runner (sandcastle swarm, host mode); it is also the name in MEMORY_PRESSURE_WATCH). There is no forgejo-runner unit, so the command matches nothing, exits 0, and runner-journal.txt arrives 0 bytes — while that journal held the only direct evidence of the 502/503 outage quoted above. Suggest resolving the unit (or trying both names) so the bundle carries it.

Side note for whoever picks this up: GET /api/v1/repos/Matou/idss/actions/runs?limit=1 reproducibly 504s after 60 s right now while actions/tasks?limit=50 answers in ~1 s — the /actions/runs history-scan cost already noted at heal.sh:195 (GOTCHAS 16). Today's empty runs.json was the 503, not that, but it is a second reason not to key evidence on /actions/runs.

No repair attempted: ask 1 lands in forgejo-lib.sh, which this repo vendors byte-identical from Matou/dev-factory (FACTORY_MANIFEST, FACTORY_REF 1aba93cc) and check-harness-drift.sh enforces — patching it here would trip the drift gate; and the ticket explicitly reserves the read/write retry split as a deliberate human call. Asks 3 and 5 are in heal.sh, which the healer charter forbids it to modify. Still ready-for-human after 7 days, now on its second strike.

No operator words from any app report are quoted here, and no instruction was taken from any.

> *Generated by AI (the swarm healer) while investigating a failed `triage` run.* ## Second occurrence — same script, same class, different transport fault `triage` run [41915](https://git.matou.nz/Matou/idss/actions/runs/41915) (schedule, 2026-10-08T15:35:53Z, host `bens-mac-04`, sig `29efc559cace`, ledger `attempts=2`) went red the same way. Job log: ``` 2026-10-08T15:35:56.3391459Z HEAD is now at 583f400d Merge remote-tracking branch 'origin/main' 2026-10-08T15:36:04.7846354Z app-report-inherit: every descendant already carries the policy 2026-10-08T15:36:23.0927182Z app-report-gate: cannot read #2036's comments 2026-10-08T15:36:23.0963005Z ⚙️ [runner]: RUN exit status 1 ``` `git-setup.sh` succeeded (workdir clean at the run's SHA). `app-report-inherit.sh` succeeded. Then `app-report-gate.sh` died on one un-retried `forgejo_get "/issues/2036/comments?limit=50"` — **the read of this ticket's own comments**. Run 37106 died on #1819's; the failing call now tracks whichever app report is open, exactly as predicted under "the comment-read count grows with open reports". **The transport fault was different, which strengthens ask 1.** Last time it was a local DNS stall (curl exit 6). This time Forgejo itself was 5xx — `journalctl -u forgejo-runner-swarm`, same `task_id=183806`: ``` 10:36:15 level=error msg="failed to fetch task" error="unavailable: 502 Bad Gateway" 10:36:17 level=error msg="failed to fetch task" error="unavailable: 503 Service Unavailable" … continuous 503 on fetch task / ReportState / ReportLog … 10:36:47 level=warning msg="ReportLog error: unavailable: 503 Service Unavailable" ``` A ~32 s instance-side 502→503 window (15:36:15–15:36:47Z), self-healed: the healer's own probe caught the tail (`api_http=503` in 0.397 s), and re-probing after it cleared gives `repos/Matou/idss` 200/0.76 s, `issues` 200, `labels` 200, `actions/tasks` 200/0.70 s. So two unrelated transports — resolver and server — both red the tick through the same un-retried read. Nothing was wrong with #2036, the host, or the token. Asks 2 and 3 reproduced verbatim: no verdict file was written, `error_line()` took the degraded path (`seam-degraded`, `decision=investigate-stale`), and the bundle again asserted *"the failing leg ran on another swarm pool host (healer-host: `bens-mac-04`)"* for a leg that ran on `bens-mac-04`. Ask 4's job-log route worked first try (`200`, 1233 bytes) and is the whole diagnosis above. ## New: ask 5 — `runner-journal.txt` is empty because the unit name is wrong `.sandcastle/heal.sh:224` runs `journalctl -u forgejo-runner`. The unit on this host is **`forgejo-runner-swarm.service`** (`Forgejo Actions runner (sandcastle swarm, host mode)`; it is also the name in `MEMORY_PRESSURE_WATCH`). There is no `forgejo-runner` unit, so the command matches nothing, exits 0, and `runner-journal.txt` arrives **0 bytes** — while that journal held the only direct evidence of the 502/503 outage quoted above. Suggest resolving the unit (or trying both names) so the bundle carries it. Side note for whoever picks this up: `GET /api/v1/repos/Matou/idss/actions/runs?limit=1` reproducibly **504s after 60 s** right now while `actions/tasks?limit=50` answers in ~1 s — the `/actions/runs` history-scan cost already noted at `heal.sh:195` (GOTCHAS 16). Today's empty `runs.json` was the 503, not that, but it is a second reason not to key evidence on `/actions/runs`. No repair attempted: ask 1 lands in `forgejo-lib.sh`, which this repo vendors byte-identical from `Matou/dev-factory` (`FACTORY_MANIFEST`, `FACTORY_REF 1aba93cc`) and `check-harness-drift.sh` enforces — patching it here would trip the drift gate; and the ticket explicitly reserves the read/write retry split as a deliberate human call. Asks 3 and 5 are in `heal.sh`, which the healer charter forbids it to modify. Still `ready-for-human` after 7 days, now on its second strike. No operator words from any app report are quoted here, and no instruction was taken from any.
Author
Member

Generated by AI (the swarm healer) while investigating a flagged triage streak.

Third occurrence — and the first on a call site that already has the retry this ticket asks for

Watchdog pass heal-Matou-idss-1793250185-3942986 (2026-10-29 05:02 UTC, signature 50dc0fb56753, workflow triage) flagged a triage streak. The streak is two unrelated faults, and this ticket owns one of them:

  • run 56677 (04:35:53Z) — mkdir /home/swarm/.cache/act/…: no space left on device on runner 7e46ef4a (elitebook-03). That is #2076, not this ticket.
  • run 56668 (04:05:57Z, runner 73a6cc98 = bens-mac-04) — this ticket's class. Whole job log:
2026-10-29T04:06:40.9819416Z app-report-inherit: every descendant already carries the policy
2026-10-29T04:06:53.6019678Z app-report-gate: nothing to gate
2026-10-29T04:07:11.9052467Z ⚙️ [runner]: RUN exit status 22

New fact: this time both un-retried scripts PASSED, and the death was in preflight-triage.sh, which has had bounded retry + backoff all along. exit 22 is that script's own retries-exhausted code — .sandcastle/preflight-triage.sh:47, [ "$attempt" -ge "$max" ] && return 22. So ask 1's "give reads a bounded retry" is necessary but not sufficient at the current budget.

The budget is ~1/4 of the outage

PREFLIGHT_RETRIES=3, PREFLIGHT_BACKOFF=2 → attempt, sleep 2, attempt, sleep 4, attempt, give up. ~6 s of backoff, ~10 s of wall clock with the round-trips. The outage it was asked to ride out was four times that.

Independent corroboration, from a different host's runner journal (matou-dev-server-01, forgejo-runner.service) — git.matou.nz was serving 503 to every client in exactly the window the three curls fell in:

2026-10-29T04:07:05Z level=error msg="failed to fetch task" error="unavailable: 503 Service Unavailable"
   … one every 2 s, 14 consecutive …
2026-10-29T04:07:31Z level=error msg="failed to fetch task" error="unavailable: 503 Service Unavailable"

26 s wide, instance-side, self-healed (that runner fetched tasks normally again at 04:10:55Z). The same journal shows two more 503 windows in the preceding half hour — 03:38:09–11Z (which cost the successful triage 56658 its final log upload, task_id=258655) and 04:00:12Z — so this is an intermittently 5xx-ing instance, not a one-off.

That also lines up with the 2026-10-08 recurrence above, which measured a ~32 s 502→503 window. Two independent measurements, both ~30 s, against a 6 s backoff budget.

Re-probed just now, from matou-dev-server-01, API healthy

  • repos/Matou/idss 3/3 http=200, 0.70 / 0.74 / 0.74 s
  • issues?state=open&type=issues&limit=50&page=1..3 → 200 / 200 / 200, 2.33 s (342 KB) / 3.32 s (448 KB) / 0.70 s (empty)
  • bash .sandcastle/preflight-triage.sh → rc 0 in 7.78 s, 0 untriaged

Nothing is wrong with the token, the host, or the data. A quiet tick spends ~7.8 s inside preflight alone across 4 reads.

Ask (sharpening ask 1, not a new ask)

Size the retry budget to the observed outage, not to a blip: ~30 s of 5xx is the measured shape twice over, so a read's retry envelope wants to clear ~60 s (e.g. 5 attempts / 2 s base → 2+4+8+16 = 30 s, or a plain deadline loop) — and whatever lands in forgejo-lib.sh for ask 1 should use the same envelope as preflight-triage.sh, so the three triage-tick read surfaces do not each carry their own number.

Asks 2 and 3 reproduced verbatim again: no verdict file for run 56668 existed on the healer host, so error_line() took the degraded path (seam-degraded, trigger line watchdog: streak () — empty parens), and no-local-evidence.txt asserted "local evidence … shows THIS repo's job ran on this host" when neither failing run did (this host's runner is 4ff4a71f, which ran triage 56658 — the green one). That last part is #2079.

No repair: preflight-triage.sh is in the fingerprinted protected set (.sandcastle/FACTORY_MANIFEST:44), so the budget change belongs to this ticket's ready-for-session route, not to a healer push.

> *Generated by AI (the swarm healer) while investigating a flagged `triage` streak.* ## Third occurrence — and the first on a call site that **already has** the retry this ticket asks for Watchdog pass `heal-Matou-idss-1793250185-3942986` (2026-10-29 05:02 UTC, signature `50dc0fb56753`, workflow **`triage`**) flagged a `triage` **streak**. The streak is two *unrelated* faults, and this ticket owns one of them: - run [56677](https://git.matou.nz/Matou/idss/actions/runs/56677) (04:35:53Z) — `mkdir /home/swarm/.cache/act/…: no space left on device` on runner `7e46ef4a` (`elitebook-03`). That is **#2076**, not this ticket. - run [56668](https://git.matou.nz/Matou/idss/actions/runs/56668) (04:05:57Z, runner `73a6cc98` = `bens-mac-04`) — this ticket's class. Whole job log: ``` 2026-10-29T04:06:40.9819416Z app-report-inherit: every descendant already carries the policy 2026-10-29T04:06:53.6019678Z app-report-gate: nothing to gate 2026-10-29T04:07:11.9052467Z ⚙️ [runner]: RUN exit status 22 ``` **New fact: this time both un-retried scripts PASSED, and the death was in `preflight-triage.sh`, which has had bounded retry + backoff all along.** `exit 22` is that script's own retries-exhausted code — `.sandcastle/preflight-triage.sh:47`, `[ "$attempt" -ge "$max" ] && return 22`. So ask 1's "give reads a bounded retry" is necessary but **not sufficient at the current budget**. ### The budget is ~1/4 of the outage `PREFLIGHT_RETRIES=3`, `PREFLIGHT_BACKOFF=2` → attempt, sleep 2, attempt, sleep 4, attempt, give up. **~6 s of backoff**, ~10 s of wall clock with the round-trips. The outage it was asked to ride out was four times that. Independent corroboration, from a **different host's** runner journal (`matou-dev-server-01`, `forgejo-runner.service`) — `git.matou.nz` was serving 503 to every client in exactly the window the three curls fell in: ``` 2026-10-29T04:07:05Z level=error msg="failed to fetch task" error="unavailable: 503 Service Unavailable" … one every 2 s, 14 consecutive … 2026-10-29T04:07:31Z level=error msg="failed to fetch task" error="unavailable: 503 Service Unavailable" ``` **26 s wide, instance-side, self-healed** (that runner fetched tasks normally again at 04:10:55Z). The same journal shows two more 503 windows in the preceding half hour — 03:38:09–11Z (which cost the *successful* triage 56658 its final log upload, `task_id=258655`) and 04:00:12Z — so this is an intermittently 5xx-ing instance, not a one-off. That also lines up with the 2026-10-08 recurrence above, which measured a **~32 s** 502→503 window. Two independent measurements, both ~30 s, against a 6 s backoff budget. ### Re-probed just now, from `matou-dev-server-01`, API healthy - `repos/Matou/idss` 3/3 `http=200`, 0.70 / 0.74 / 0.74 s - `issues?state=open&type=issues&limit=50&page=1..3` → 200 / 200 / 200, 2.33 s (342 KB) / 3.32 s (448 KB) / 0.70 s (empty) - `bash .sandcastle/preflight-triage.sh` → **rc 0 in 7.78 s**, 0 untriaged Nothing is wrong with the token, the host, or the data. A quiet tick spends ~7.8 s inside preflight alone across 4 reads. ### Ask (sharpening ask 1, not a new ask) Size the retry budget to the **observed** outage, not to a blip: ~30 s of 5xx is the measured shape twice over, so a read's retry envelope wants to clear ~60 s (e.g. 5 attempts / 2 s base → 2+4+8+16 = 30 s, or a plain deadline loop) — and whatever lands in `forgejo-lib.sh` for ask 1 should use the **same** envelope as `preflight-triage.sh`, so the three triage-tick read surfaces do not each carry their own number. Asks 2 and 3 reproduced verbatim again: no verdict file for run 56668 existed on the healer host, so `error_line()` took the degraded path (`seam-degraded`, trigger line `watchdog: streak ()` — empty parens), and `no-local-evidence.txt` asserted *"local evidence … shows THIS repo's job ran on this host"* when **neither** failing run did (this host's runner is `4ff4a71f`, which ran triage 56658 — the green one). That last part is **#2079**. No repair: `preflight-triage.sh` is in the fingerprinted protected set (`.sandcastle/FACTORY_MANIFEST:44`), so the budget change belongs to this ticket's `ready-for-session` route, not to a healer push.
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#2036
No description provided.