run-swarm: stand down clean on a failed ready-list read, and name the stage on the task log (#157) #158

Merged
ben merged 1 commit from fix/157-ready-list-standdown into main 2026-09-21 04:31:43 +00:00
Owner

Closes #157. Brings home the patch parked on Matou/matou-app #442 since 2026-09-06, which could not land there because run-swarm.sh is vendored.

The defect

A failed schedule_list_ready_or_verdict ended the run with a bare exit 1. The cause landed in the verdict, the runlog and swarm.db — all host-side — while the actions_log an operator reads off a red tick showed nothing between the policy: line and RUN exit status 1. The healer keyed that empty log to one signature and silenced it, which also silences any genuine red that later collapses onto the same blank-log signature. ~2% of matou-app's swarm ticks, signature 7f647f2d78ed.

#142 improved the wording inside the verdict; it touched neither the blank log nor the red.

What changed

  • on_exit prints one stderr line on a non-zero exit: run-swarm: RUN FAILED — exit <ec> in stage '<stage>' (reason=<reason>)[ — <captured error>].
  • The ready-list call site stands down clean on a failed read — stderr line carrying the cause schedule_list_ready_or_verdict already captured, SWARM_EXIT_REASON=list-ready-transient, exit 0.

The judgement call

Half two converts one class of red into a clean no-op tick, which is the part worth a second opinion. The case for it: the run genuinely had no work and no fault of its own — the same posture as the existing zero-ready-tasks path, and the same shape as #1424's notify guard. The case against: a forge outage stops showing up in the red/green signal. That is exactly why half one lands with it rather than instead of it — a persistent outage now idles every tick loudly in the task log.

If you'd rather keep the red, half one alone still fixes the blank log; say so and I'll drop half two.

Verified

  • tests/run-swarm-stages-test.sh +2 groups (12 total). Red before green: with the fix reverted, "a red run must name its stage + reason on stderr" fails.
  • Full offline suite (tests/*.sh + onboarding/tests/*.sh): no failures, including swarm-db-test.sh, which flaked under contention on an earlier run and is green here.
  • bash -n clean.

Blast radius

Vendored file — every consumer picks this up at its next FACTORY_REF bump. matou-app#442 closes on its bump, which is queued as matou-app#580 along with the #156 prompt re-render.

🤖 Generated with Claude Code

Closes #157. Brings home the patch parked on `Matou/matou-app` #442 since 2026-09-06, which could not land there because `run-swarm.sh` is vendored. ## The defect A failed `schedule_list_ready_or_verdict` ended the run with a bare `exit 1`. The cause landed in the verdict, the runlog and swarm.db — all host-side — while the `actions_log` an operator reads off a red tick showed nothing between the `policy:` line and `RUN exit status 1`. The healer keyed that empty log to one signature and silenced it, which also silences any genuine red that later collapses onto the same blank-log signature. ~2% of matou-app's swarm ticks, signature `7f647f2d78ed`. #142 improved the wording *inside* the verdict; it touched neither the blank log nor the red. ## What changed - **`on_exit`** prints one stderr line on a non-zero exit: `run-swarm: RUN FAILED — exit <ec> in stage '<stage>' (reason=<reason>)[ — <captured error>]`. - **The ready-list call site** stands down clean on a failed read — stderr line carrying the cause `schedule_list_ready_or_verdict` already captured, `SWARM_EXIT_REASON=list-ready-transient`, `exit 0`. ## The judgement call Half two converts one class of red into a clean no-op tick, which is the part worth a second opinion. The case for it: the run genuinely had no work and no fault of its own — the same posture as the existing zero-ready-tasks path, and the same shape as #1424's notify guard. The case against: a forge outage stops showing up in the red/green signal. That is exactly why half one lands with it rather than instead of it — a persistent outage now idles every tick **loudly** in the task log. If you'd rather keep the red, half one alone still fixes the blank log; say so and I'll drop half two. ## Verified - `tests/run-swarm-stages-test.sh` +2 groups (12 total). Red before green: with the fix reverted, "a red run must name its stage + reason on stderr" fails. - Full offline suite (`tests/*.sh` + `onboarding/tests/*.sh`): **no failures**, including `swarm-db-test.sh`, which flaked under contention on an earlier run and is green here. - `bash -n` clean. ## Blast radius Vendored file — every consumer picks this up at its next `FACTORY_REF` bump. matou-app#442 closes on its bump, which is queued as matou-app#580 along with the #156 prompt re-render. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A failed schedule_list_ready_or_verdict ended the run with a bare `exit 1`. The
cause landed in the verdict, the runlog and swarm.db — all host-side — while the
actions_log an operator reads off a red tick showed nothing between the policy
line and `RUN exit status 1`. The healer keyed that empty log to one signature
and silenced it, taking with it any genuine red that later collapsed onto the
same blank-log signature.

#142 fixed the wording inside the verdict. It touched neither the blank log nor
the red, so both halves land here:

(a) on_exit prints one stderr line on a non-zero exit, naming the stage, the
    reason and the captured error, so the cause is legible off the task log.
(b) the ready-list call site stands down CLEAN — stderr line, reason
    list-ready-transient, exit 0 — instead of the silent exit 1. A transient
    forge blip is not work this host can do and the cron backstops it, the same
    posture as the existing zero-ready-tasks path. A persistent outage now idles
    every tick loudly rather than reddening silently.

tests/run-swarm-stages-test.sh +2 groups (12 total): a red preflight must name
its stage and reason on stderr; a lister that exits 22 after its own retries
must exit 0, say "standing down clean", key reason=list-ready-transient with
exit=0 in the runlog, print no RUN FAILED line, and never be reported as an
empty ready set. Red before green against the pre-fix file.

Reported from the consumer side as matou-app#442 (~2% of swarm ticks, signature
7f647f2d78ed), where the patch was parked since 2026-09-06 because the file is
vendored.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ben merged commit 45813e18f7 into main 2026-09-21 04:31:43 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory!158
No description provided.