run-swarm.sh: no verdict_stage between preflight and pnpm install — a Forgejo blip in list-ready-tasks mis-keys the healer signature as a preflight RED #57

Closed
opened 2026-08-24 13:37:33 +00:00 by ben · 1 comment
Owner

Why

Healer diagnosis 2026-08-24 (sig 2f7109f4c37a, Matou/idss run 9653): git.matou.nz returned 503 host-wide for a few minutes. list-ready-tasks.sh's api() is curl -sf (L71/L76) and exits 22 on any HTTP >= 400; that call is unguarded under set -euo pipefail, so the script died with 22 and run-swarm.sh L212 (ready="$(bash list-ready-tasks.sh)", also unguarded) died with the same 22 before any worker spawned.

The run itself is fine — transient, the cron retries, no work lost. The defect is observability: run-verdict.txt keyed on stage=preflight self-tests (#446) exit=22 with an EMPTY error block, but preflight had PASSED. run-swarm.sh sets no verdict_stage between "preflight self-tests (#446)" (~L168) and "pnpm install" (~L368), so the janitor-sweep + list-ready-tasks phase inherits the preflight stage name. Any tracker blip during list-ready therefore masquerades as a preflight-guard failure and the healer keys a signature on a healthy guard — the same #9-class gap already closed for the pnpm-store and env-allowlist stages.

Ask

  1. Add verdict_stage "janitor sweep + list ready tasks" just before the janitor_sweep / list-ready-tasks.sh calls (~L209) in run-swarm.sh.
  2. Optionally guard the L212 list-ready-tasks.sh call so a bare tracker 5xx exits with a named reason (e.g. SWARM_EXIT_REASON=tracker-unreachable) instead of a raw 22.
  3. Ratchet: extend the existing verdict-stage test so every stage between preflight and pnpm install is named.

Vendored harness file — reaches consumers (idss, matou-app, ourcloud) at their next FACTORY_REF pin bump.

Filed from the healer's Mattermost escalation (thread root 4zhqfetzrjdwbgjgjy58spohko) on Ben's instruction.

## Why Healer diagnosis 2026-08-24 (sig `2f7109f4c37a`, Matou/idss run 9653): git.matou.nz returned 503 host-wide for a few minutes. `list-ready-tasks.sh`'s `api()` is `curl -sf` (L71/L76) and exits 22 on any HTTP >= 400; that call is unguarded under `set -euo pipefail`, so the script died with 22 and `run-swarm.sh` L212 (`ready="$(bash list-ready-tasks.sh)"`, also unguarded) died with the same 22 before any worker spawned. The run itself is fine — transient, the cron retries, no work lost. The defect is **observability**: `run-verdict.txt` keyed on `stage=preflight self-tests (#446)` `exit=22` with an EMPTY error block, but preflight had PASSED. `run-swarm.sh` sets no `verdict_stage` between "preflight self-tests (#446)" (~L168) and "pnpm install" (~L368), so the janitor-sweep + list-ready-tasks phase inherits the preflight stage name. Any tracker blip during list-ready therefore masquerades as a preflight-guard failure and the healer keys a signature on a healthy guard — the same #9-class gap already closed for the pnpm-store and env-allowlist stages. ## Ask 1. Add `verdict_stage "janitor sweep + list ready tasks"` just before the `janitor_sweep` / `list-ready-tasks.sh` calls (~L209) in `run-swarm.sh`. 2. Optionally guard the L212 `list-ready-tasks.sh` call so a bare tracker 5xx exits with a named reason (e.g. `SWARM_EXIT_REASON=tracker-unreachable`) instead of a raw 22. 3. Ratchet: extend the existing verdict-stage test so every stage between preflight and pnpm install is named. Vendored harness file — reaches consumers (idss, matou-app, ourcloud) at their next `FACTORY_REF` pin bump. Filed from the healer's Mattermost escalation (thread root `4zhqfetzrjdwbgjgjy58spohko`) on Ben's instruction.

This was generated by AI during triage.

Triage: already implemented — closing as wontfix

Ruled by agent under ADR 0174 — veto anytime.

Ruling: this ticket's three asks were all landed by #52. Closing as already-implemented rather than leaving it in the queue for a worker to rediscover.

Redundancy check — where each ask now lives

I searched by domain concept (verdict staging around the ready-list read), not by the ticket's wording:

  1. "Add a verdict_stage between preflight and pnpm install." Done. schedule-lib.sh gained schedule_list_ready_or_verdict, which calls verdict_stage "list ready tasks" before invoking the lister; run-swarm.sh calls it in the run's own shell (never inside a $(...), which would lose the parent's VERDICT_* — the header comment states exactly that requirement).

  2. "Guard the call so a tracker 5xx exits with a named reason instead of a raw 22." Done. schedule_list_ready_or_verdict captures the lister's stderr, calls verdict_error "list-ready-tasks.sh failed (rc=… transient Forgejo 5xx/timeout after retries): …", and returns the rc; run-swarm.sh turns that into a clean exit 1. The reason string is died-in:list ready tasks rather than the suggested tracker-unreachable — the ask was "a named reason (e.g. …)", and a healer signature keyed on list ready tasks with a populated error block is the outcome the ticket wanted.

  3. "Ratchet: every stage between preflight and pnpm install is named." Done. tests/run-swarm-stages-test.sh asserts an ordered stage list running preflight_gate → preflight_policy_gate → schedule_janitor_rearm → schedule_list_ready_or_verdict → schedule_debounce_decide → preflight_model_gate → provision_*, so a future edit that drops or reorders the list stage reds. tests/schedule-lib-test.sh group 6 pins the re-key directly (asserts stage=list ready tasks and died-in:list ready tasks, explicitly not preflight), and tests/run-swarm-ready-list-test.sh drives the real list-ready-tasks.sh through the seam.

On the janitor half

The ticket asked for a stage named "janitor sweep + list ready tasks", covering both. Only the list half is named — but the janitor half needs no stage: schedule_janitor_rearm is janitor_sweep || true, so it cannot die under set -e and cannot mis-key a signature. No residue.

Verification

Ran the three covering tests plus the full offline suite (tests/*.sh + onboarding/tests/*.sh) at 9e2aaf6:

run-swarm-stages:     8 groups passed
run-swarm-ready-list: 4 scenarios passed
schedule-lib:        15 groups passed

Suite green.

Why this is a two-way door: it is a label change plus a close. If the reading above is wrong on any of the three asks, reopen and remove wontfix — nothing is destroyed and no code changed. Per the triage skill, an already-implemented outcome does not get an .out-of-scope/ entry (that KB is for rejected requests; this one was built).

> *This was generated by AI during triage.* ## Triage: already implemented — closing as `wontfix` **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** this ticket's three asks were all landed by **#52**. Closing as already-implemented rather than leaving it in the queue for a worker to rediscover. ### Redundancy check — where each ask now lives I searched by domain concept (verdict staging around the ready-list read), not by the ticket's wording: 1. **"Add a `verdict_stage` between preflight and pnpm install."** Done. `schedule-lib.sh` gained `schedule_list_ready_or_verdict`, which calls `verdict_stage "list ready tasks"` before invoking the lister; `run-swarm.sh` calls it in the run's own shell (never inside a `$(...)`, which would lose the parent's `VERDICT_*` — the header comment states exactly that requirement). 2. **"Guard the call so a tracker 5xx exits with a named reason instead of a raw 22."** Done. `schedule_list_ready_or_verdict` captures the lister's stderr, calls `verdict_error "list-ready-tasks.sh failed (rc=… transient Forgejo 5xx/timeout after retries): …"`, and returns the rc; `run-swarm.sh` turns that into a clean `exit 1`. The reason string is `died-in:list ready tasks` rather than the suggested `tracker-unreachable` — the ask was "a named reason (e.g. …)", and a healer signature keyed on `list ready tasks` with a populated error block is the outcome the ticket wanted. 3. **"Ratchet: every stage between preflight and pnpm install is named."** Done. `tests/run-swarm-stages-test.sh` asserts an *ordered* stage list running `preflight_gate` → `preflight_policy_gate` → `schedule_janitor_rearm` → `schedule_list_ready_or_verdict` → `schedule_debounce_decide` → `preflight_model_gate` → `provision_*`, so a future edit that drops or reorders the list stage reds. `tests/schedule-lib-test.sh` group 6 pins the re-key directly (asserts `stage=list ready tasks` and `died-in:list ready tasks`, explicitly *not* preflight), and `tests/run-swarm-ready-list-test.sh` drives the real `list-ready-tasks.sh` through the seam. ### On the janitor half The ticket asked for a stage named `"janitor sweep + list ready tasks"`, covering both. Only the list half is named — but the janitor half needs no stage: `schedule_janitor_rearm` is `janitor_sweep || true`, so it cannot die under `set -e` and cannot mis-key a signature. No residue. ### Verification Ran the three covering tests plus the full offline suite (`tests/*.sh` + `onboarding/tests/*.sh`) at `9e2aaf6`: ``` run-swarm-stages: 8 groups passed run-swarm-ready-list: 4 scenarios passed schedule-lib: 15 groups passed ``` Suite green. **Why this is a two-way door:** it is a label change plus a close. If the reading above is wrong on any of the three asks, reopen and remove `wontfix` — nothing is destroyed and no code changed. Per the triage skill, an already-implemented outcome does **not** get an `.out-of-scope/` entry (that KB is for rejected requests; this one was built).
matou-build-agent 2026-08-25 19:14:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#57
No description provided.