triage reds with no verdict when a Forgejo latency spike hits the un-sealed app-report stage — and the healer then misreports it as another pool host's leg #2048

Closed
opened 2026-10-16 12:45:58 +00:00 by matou-build-agent · 1 comment

The triage tick of 2026-10-16T12:35:53Z (run 47257, task 215882, host
bens-mac-04) reddened and the healer could not diagnose it from its own
evidence bundle. The trigger fault was transient — a ~1-minute Forgejo API
latency spike — and it self-healed. What this ticket is for is the three
machinery gaps the incident exposed, all of them in protected paths
(.sandcastle/, .forgejo/), so they need an interactive session's standing
(ADR 0174) rather than a worker.

What happened

  • 12:35:56 — .sandcastle/git-setup.sh finished its fetch/checkout/reset
    cleanly (.git/FETCH_HEAD mtime, git reflog entry HEAD@{2026-10-16 07:35:56 -0500}: reset: moving to origin/main). It left no verdict and no
    breadcrumb, which is its clean-run contract.
  • 12:35:56 → ~12:36:40 — the step spent ~44s in the two un-sealed
    app-report lines of .forgejo/workflows/triage.yml
    (scripts/app-report-inherit.sh, scripts/app-report-gate.sh) and exited
    non-zero. No issue in the repo was written in that window
    (GET /issues?since=2026-10-16T12:30:00Z → empty), so it died on a READ,
    before any mutation.
  • .sandcastle/run-triage.sh never started: no triage-Matou-idss-* row in
    ~/swarm/state/swarm.db, no verdict at
    /tmp/matou-Matou-idss-triage-verdict.txt, no fresh worker log.
  • Three independent signals put git.matou.nz in a degraded window at exactly
    that moment: the runner's own journal
    (forgejo-runner[2547855] level=error msg="failed to fetch task: deadline exceeded" at 07:36:39 -0500), the healer's API probe
    (api_seconds=18.736751 for GET /actions/tasks?limit=1), and recovery
    afterwards (the same probe now answers in 0.73–0.87s).
  • The host was healthy throughout: load 1.0, ~12 GB available, no OOM
    (~/swarm/state/host-samples.tsv, host.txt).

The arithmetic fits one un-retried call hitting its ceiling: ~13s on a
degraded GET /labels?limit=100 plus one 30s --max-time wall = the 43s
observed before the die.

Gap 1 — the app-report stage has no verdict seam

.forgejo/workflows/triage.yml runs scripts/app-report-inherit.sh and
scripts/app-report-gate.sh between git-setup.sh (sealed, #639) and
run-triage.sh (sealed, #235). Those two lines are the only part of the step
that can red without leaving a stage/exit/error verdict, so the healer
degraded to the bare workflow-name signature 29efc559cace with
Trigger error line: unknown — the exact phantom the verdict seam exists to
prevent. Wire them into verdict-lib.sh the way git-setup.sh is.

Gap 2 — forgejo_get has no bounded retry

.sandcastle/forgejo-lib.sh:26 is curl -sf --max-time 30 with no retry, and
every call site dies on a non-zero rc under set -e. The app-report stage
makes ~11 sequential such calls (labels + 1 policy page + 3 open-issue pages
in inherit; labels + 3 open-issue pages + one comments read per open report in
gate), so a sub-minute latency spike reds the tick with near-certainty. #1411
gave every git-transport surface bounded retry with backoff; this API surface
was left bare. Note the retry must sit on the GET path only —
forgejo_post/forgejo_post_code go through the same _forgejo_get helper,
and a retried POST would double-post a comment.

Gap 3 — the healer's own evidence collection misreports this class

Both are in .sandcastle/heal.sh, which the healer charter forbids the healer
from editing — hence this ticket.

  • heal.sh:226 reads the wrong systemd unit. It runs
    journalctl -u forgejo-runner; the unit on this host is
    forgejo-runner-swarm.service ("Forgejo Actions runner (sandcastle swarm,
    host mode)"). runner-journal.txt therefore comes back EMPTY on every
    incident — and the real unit's journal is what identified both the host and
    the degraded window in this one. Worth checking the unit name on every pool
    host and keying off the runner's actual unit.
  • heal.sh:252-258 draws a false conclusion. "no fresh worker log AND no
    fresh verdict" is treated as proof the leg ran on another pool host, and it
    wrote, into run-verdict.txt, worker-logs.txt and
    no-local-evidence.txt: "the failing leg ran on another swarm pool host
    (healer-host: bens-mac-04)"
    . The leg provably ran on bens-mac-04 — the same
    box that gathered the bundle. Any failure in the same job before Sandcastle
    spins and outside the verdict seam looks identical to a remote leg. The
    healer already has local evidence that distinguishes them: the per-repo
    workdir lock mtime (/tmp/matou-workdir-Matou-idss.lock, 12:35:55), the
    git reflog reset entry, and the runner journal's
    task <id> repo is <slug> line. The claim should be downgraded to "no
    local evidence" without the pool-locality inference unless one of those
    says the job never ran here.

Acceptance

  1. A red in app-report-inherit.sh/app-report-gate.sh leaves a verdict
    naming the stage, and the healer's signature keys on it, not on triage|.
  2. A single Forgejo GET that 5xx-es or exceeds its deadline is retried with
    bounded backoff; POSTs are NOT retried. Covered by a test.
  3. runner-journal.txt is non-empty on a pool host whose runner unit is
    forgejo-runner-swarm.
  4. The "ran on another swarm pool host" sentence is only emitted when local
    evidence says the job did not run here.

Filed by the swarm healer; evidence bundle
/tmp/matou-heal-Matou-idss.5dI899 on bens-mac-04 (ephemeral).

The triage tick of 2026-10-16T12:35:53Z (run 47257, task 215882, host `bens-mac-04`) reddened and the healer could not diagnose it from its own evidence bundle. The trigger fault was transient — a ~1-minute Forgejo API latency spike — and it self-healed. What this ticket is for is the three machinery gaps the incident exposed, all of them in protected paths (`.sandcastle/`, `.forgejo/`), so they need an interactive session's standing (ADR 0174) rather than a worker. ## What happened - `12:35:56` — `.sandcastle/git-setup.sh` finished its fetch/checkout/reset cleanly (`.git/FETCH_HEAD` mtime, `git reflog` entry `HEAD@{2026-10-16 07:35:56 -0500}: reset: moving to origin/main`). It left no verdict and no breadcrumb, which is its clean-run contract. - `12:35:56 → ~12:36:40` — the step spent ~44s in the two un-sealed app-report lines of `.forgejo/workflows/triage.yml` (`scripts/app-report-inherit.sh`, `scripts/app-report-gate.sh`) and exited non-zero. No issue in the repo was written in that window (`GET /issues?since=2026-10-16T12:30:00Z` → empty), so it died on a READ, before any mutation. - `.sandcastle/run-triage.sh` never started: no `triage-Matou-idss-*` row in `~/swarm/state/swarm.db`, no verdict at `/tmp/matou-Matou-idss-triage-verdict.txt`, no fresh worker log. - Three independent signals put git.matou.nz in a degraded window at exactly that moment: the runner's own journal (`forgejo-runner[2547855] level=error msg="failed to fetch task: deadline exceeded"` at `07:36:39 -0500`), the healer's API probe (`api_seconds=18.736751` for `GET /actions/tasks?limit=1`), and recovery afterwards (the same probe now answers in 0.73–0.87s). - The host was healthy throughout: load 1.0, ~12 GB available, no OOM (`~/swarm/state/host-samples.tsv`, `host.txt`). The arithmetic fits one un-retried call hitting its ceiling: ~13s on a degraded `GET /labels?limit=100` plus one 30s `--max-time` wall = the 43s observed before the `die`. ## Gap 1 — the app-report stage has no verdict seam `.forgejo/workflows/triage.yml` runs `scripts/app-report-inherit.sh` and `scripts/app-report-gate.sh` between `git-setup.sh` (sealed, #639) and `run-triage.sh` (sealed, #235). Those two lines are the only part of the step that can red without leaving a stage/exit/error verdict, so the healer degraded to the bare workflow-name signature `29efc559cace` with `Trigger error line: unknown` — the exact phantom the verdict seam exists to prevent. Wire them into `verdict-lib.sh` the way `git-setup.sh` is. ## Gap 2 — `forgejo_get` has no bounded retry `.sandcastle/forgejo-lib.sh:26` is `curl -sf --max-time 30` with no retry, and every call site dies on a non-zero rc under `set -e`. The app-report stage makes ~11 sequential such calls (labels + 1 policy page + 3 open-issue pages in inherit; labels + 3 open-issue pages + one comments read per open report in gate), so a sub-minute latency spike reds the tick with near-certainty. #1411 gave every git-transport surface bounded retry with backoff; this API surface was left bare. Note the retry must sit on the GET path only — `forgejo_post`/`forgejo_post_code` go through the same `_forgejo_get` helper, and a retried POST would double-post a comment. ## Gap 3 — the healer's own evidence collection misreports this class Both are in `.sandcastle/heal.sh`, which the healer charter forbids the healer from editing — hence this ticket. - **`heal.sh:226` reads the wrong systemd unit.** It runs `journalctl -u forgejo-runner`; the unit on this host is `forgejo-runner-swarm.service` ("Forgejo Actions runner (sandcastle swarm, host mode)"). `runner-journal.txt` therefore comes back EMPTY on every incident — and the real unit's journal is what identified both the host and the degraded window in this one. Worth checking the unit name on every pool host and keying off the runner's actual unit. - **`heal.sh:252-258` draws a false conclusion.** "no fresh worker log AND no fresh verdict" is treated as proof the leg ran on another pool host, and it wrote, into `run-verdict.txt`, `worker-logs.txt` and `no-local-evidence.txt`: *"the failing leg ran on another swarm pool host (healer-host: bens-mac-04)"*. The leg provably ran on bens-mac-04 — the same box that gathered the bundle. Any failure in the same job before Sandcastle spins and outside the verdict seam looks identical to a remote leg. The healer already has local evidence that distinguishes them: the per-repo workdir lock mtime (`/tmp/matou-workdir-Matou-idss.lock`, 12:35:55), the `git reflog` reset entry, and the runner journal's `task <id> repo is <slug>` line. The claim should be downgraded to "no local evidence" without the pool-locality inference unless one of those says the job never ran here. ## Acceptance 1. A red in `app-report-inherit.sh`/`app-report-gate.sh` leaves a verdict naming the stage, and the healer's signature keys on it, not on `triage|`. 2. A single Forgejo GET that 5xx-es or exceeds its deadline is retried with bounded backoff; POSTs are NOT retried. Covered by a test. 3. `runner-journal.txt` is non-empty on a pool host whose runner unit is `forgejo-runner-swarm`. 4. The "ran on another swarm pool host" sentence is only emitted when local evidence says the job did not run here. Filed by the swarm healer; evidence bundle `/tmp/matou-heal-Matou-idss.5dI899` on bens-mac-04 (ephemeral).
Author
Member

Close report — generated by AI during a standing session (ADR 0174).

Done. All three machinery gaps fixed and proven offline; landed on idss main and (for the vendored half) on a dev-factory cheap-backport branch, then re-vendored.

Gap 1 — the app-report stage has a verdict seam. scripts/app-report-inherit.sh and scripts/app-report-gate.sh (idss-local, not vendored) now source verdict-lib.sh, call verdict_begin on the triage verdict path heal.sh reads (/tmp/matou-<repo-tag>-triage-verdict.txt), name their stage (app-report-inherit / app-report-gate), and write the stage/exit/error verdict from an EXIT trap; die() records the fault as the error line. A red there now keys the healer's signature on the stage, not the bare triage| phantom (the 29efc559 degrade). A clean run leaves no verdict (verdict_write's contract). → AC1.

Gap 2 — forgejo_get has bounded retry. forgejo-lib.sh's public forgejo_get rides out a transient GET with exponential backoff (FORGEJO_GET_RETRIES=3, FORGEJO_GET_BACKOFF=2), each attempt still bounded by --max-time. The retry sits on the GET path ONLY — forgejo_post / forgejo_attach_issue_asset_url route a POST through the same _forgejo_get helper and are never retried (a retried comment double-posts). The #20 write probe keeps its own retry loop and now calls the low-level _forgejo_get directly, so the two never nest. → AC2.

Gap 3 — the healer's evidence is honest. heal.sh resolves the Forgejo runner's real systemd unit off systemctl list-units 'forgejo-runner*' (this pool host's is forgejo-runner-swarm.service, not the bare forgejo-runner), with a HEAL_RUNNER_UNIT override and a known-unit fallback — so runner-journal.txt is no longer empty on every incident. → AC3. And the "ran on another swarm pool host" line is now emitted ONLY when job_ran_here is false — it checks the fresh per-repo workdir-lock mtime and the runner journal naming this repo's task, either of which proves the job ran here; when it did, the healer names a pre-Sandcastle fault this host owns instead. → AC4.

Landing (vendored files go through dev-factory, ADR 0180): forgejo-lib.sh + heal.sh + their vendored tests are byte-identical from Matou/dev-factory, so the fix was authored on the cheap-backport branch backport/idss-2048 (SHA 7d40af3, off the pinned FACTORY_REF 1aba93c — main-HEAD adoption is the human-gated #1684, not for a headless session), pushed, and re-vendored with onboard.sh vendor: FACTORY_REF 1aba93c→7d40af3, FACTORY_MANIFEST unchanged (0 added/removed), drift-gate OK.

Commits:

  • idss main c6b9535a (Gap 1 scripts + re-vendored Gaps 2/3 + STATUS).
  • dev-factory backport/idss-2048 7d40af3 (forgejo-lib.sh, heal.sh, their tests).

Proof (all offline, green in place on the committed tree):

  • scripts/tests/app-report-inherit-test.sh 5 groups, app-report-gate-test.sh 10 groups (new verdict-seam assertions: clean run → no verdict; a red → verdict names the stage and keys a signature ≠ triage|).
  • .sandcastle/tests/forgejo-lib-test.sh 64 passed (new: a 2-blip GET rides out and returns the body with 3 attempts logged; a sustained outage dies after 3; a POST is attempted exactly once).
  • .sandcastle/tests/heal-test.sh 22 scenarios (new AC3: runner-journal.txt carries the forgejo-runner-swarm journal; AC4: a fresh-workdir-lock run is NOT blamed on another pool host).
  • dev-factory dependents re-run green: heal-lib, git-setup, preflight-swarm (the probe consumer), run-triage, run-swarm-drive-yield, actions-endpoint, claude-call-guards, limit-lib, park-wiring, model-lib, policy-lib.

Owed (filed #2049): forward-port Gaps 2+3 onto dev-factory main. The forgejo-lib.sh half cherry-picks cleanly; the heal.sh half conflicts with main's #188/#203 heal rework (a 385-line heal-test.sh conflict) and dev-factory is now LANDING=pr, so resolving + pushing it unreviewed to a shared repo other products consume was judged outside this session's safe two-way-door remit. #1684's eventual adoption must carry the fix.

Ruled by agent under ADR 0174 — veto anytime. The trigger fault (the ~1-min Forgejo spike) was transient and self-healed; this ticket only closed the machinery gaps it exposed.

> *Close report — generated by AI during a standing session (ADR 0174).* **Done.** All three machinery gaps fixed and proven offline; landed on idss `main` and (for the vendored half) on a dev-factory cheap-backport branch, then re-vendored. **Gap 1 — the app-report stage has a verdict seam.** `scripts/app-report-inherit.sh` and `scripts/app-report-gate.sh` (idss-local, not vendored) now source `verdict-lib.sh`, call `verdict_begin` on the triage verdict path heal.sh reads (`/tmp/matou-<repo-tag>-triage-verdict.txt`), name their stage (`app-report-inherit` / `app-report-gate`), and write the stage/exit/error verdict from an EXIT trap; `die()` records the fault as the error line. A red there now keys the healer's signature on the stage, not the bare `triage|` phantom (the `29efc559` degrade). A clean run leaves no verdict (verdict_write's contract). → **AC1**. **Gap 2 — `forgejo_get` has bounded retry.** `forgejo-lib.sh`'s public `forgejo_get` rides out a transient GET with exponential backoff (`FORGEJO_GET_RETRIES=3`, `FORGEJO_GET_BACKOFF=2`), each attempt still bounded by `--max-time`. The retry sits on the GET path ONLY — `forgejo_post` / `forgejo_attach_issue_asset_url` route a POST through the same `_forgejo_get` helper and are never retried (a retried comment double-posts). The #20 write probe keeps its own retry loop and now calls the low-level `_forgejo_get` directly, so the two never nest. → **AC2**. **Gap 3 — the healer's evidence is honest.** `heal.sh` resolves the Forgejo runner's real systemd unit off `systemctl list-units 'forgejo-runner*'` (this pool host's is `forgejo-runner-swarm.service`, not the bare `forgejo-runner`), with a `HEAL_RUNNER_UNIT` override and a known-unit fallback — so `runner-journal.txt` is no longer empty on every incident. → **AC3**. And the "ran on another swarm pool host" line is now emitted ONLY when `job_ran_here` is false — it checks the fresh per-repo workdir-lock mtime and the runner journal naming this repo's task, either of which proves the job ran here; when it did, the healer names a pre-Sandcastle fault this host owns instead. → **AC4**. **Landing (vendored files go through dev-factory, ADR 0180):** `forgejo-lib.sh` + `heal.sh` + their vendored tests are byte-identical from `Matou/dev-factory`, so the fix was authored on the cheap-backport branch `backport/idss-2048` (SHA `7d40af3`, off the pinned `FACTORY_REF` `1aba93c` — `main`-HEAD adoption is the human-gated #1684, not for a headless session), pushed, and re-vendored with `onboard.sh vendor`: `FACTORY_REF` `1aba93c`→`7d40af3`, `FACTORY_MANIFEST` unchanged (0 added/removed), drift-gate OK. **Commits:** - idss `main` `c6b9535a` (Gap 1 scripts + re-vendored Gaps 2/3 + STATUS). - dev-factory `backport/idss-2048` `7d40af3` (forgejo-lib.sh, heal.sh, their tests). **Proof (all offline, green in place on the committed tree):** - `scripts/tests/app-report-inherit-test.sh` 5 groups, `app-report-gate-test.sh` 10 groups (new verdict-seam assertions: clean run → no verdict; a red → verdict names the stage and keys a signature ≠ `triage|`). - `.sandcastle/tests/forgejo-lib-test.sh` 64 passed (new: a 2-blip GET rides out and returns the body with 3 attempts logged; a sustained outage dies after 3; a POST is attempted exactly once). - `.sandcastle/tests/heal-test.sh` 22 scenarios (new AC3: `runner-journal.txt` carries the `forgejo-runner-swarm` journal; AC4: a fresh-workdir-lock run is NOT blamed on another pool host). - dev-factory dependents re-run green: heal-lib, git-setup, preflight-swarm (the probe consumer), run-triage, run-swarm-drive-yield, actions-endpoint, claude-call-guards, limit-lib, park-wiring, model-lib, policy-lib. **Owed (filed #2049):** forward-port Gaps 2+3 onto dev-factory `main`. The `forgejo-lib.sh` half cherry-picks cleanly; the `heal.sh` half conflicts with `main`'s #188/#203 heal rework (a 385-line `heal-test.sh` conflict) and dev-factory is now `LANDING=pr`, so resolving + pushing it unreviewed to a shared repo other products consume was judged outside this session's safe two-way-door remit. #1684's eventual adoption must carry the fix. Ruled by agent under ADR 0174 — veto anytime. The trigger fault (the ~1-min Forgejo spike) was transient and self-healed; this ticket only closed the machinery gaps it exposed.
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#2048
No description provided.