backstop: guard on runs?status=waiting too — a queued run has no task row (#289, GOTCHAS 78) #290

Merged
ben merged 1 commit from backstop-waiting-runs into main 2026-10-21 04:51:47 +00:00
Owner

Fixes the dispatch flood in #289 (GOTCHAS 78).

What: schedule-backstop.sh adds a second, fail-closed read of runs?status=waiting&limit=50&page=1 and skips the dispatch when a run of the same workflow file (.workflow_id) is queued. The existing actions/tasks guard (#238) stays — it covers running and recently-started jobs — but a task row exists only once a runner has picked the job, so a queued run never appears there. That is why on 2026-10-15, with one pool runner silently stalled, the guard dispatched on every tick (101 / 15 in the 04Z hour vs the normal 24 / 92) and Forgejo's single oldest-first queue lagged 1h45m for every repo.

Why keyed on the workflow file, not the job name: a run queues as a whole; an unpicked per-host leg says the pool cannot take more right now, and adding a run only queues another leg. The GOTCHAS 62 per-host discrimination still applies to the tasks view (a running other-host leg does not silence this host).

Ratchet: the new read carries status=waiting and page= and goes through the timed api(), so tests/actions-endpoint-test.sh passes unchanged; its exemption comment now names the backstop as the second reader of that view.

Tests: four new scenarios in tests/schedule-backstop-test.sh (22 total), watched red first on the queued-run case. Full offline suite (tests/*.sh + onboarding/tests/*.sh) green, docs-budget-test green.

Docs: GOTCHAS 78 body + index row, journal 2026-10-20-289.md, STATUS hosts row notes the matou-workstation stall.

Rollout note: consumers get this at their next FACTORY_REF bump + re-vendor, and the host tick (backstop-tick.sh) calls each repo's vendored copy under ~/swarm/Matou/<repo>/.sandcastle/, so those checkouts must pull it. The ignition (a runner that stops fetching without dying) is out of scope here.

🤖 Generated with Claude Code

Fixes the dispatch flood in #289 (GOTCHAS 78). **What:** `schedule-backstop.sh` adds a second, fail-closed read of `runs?status=waiting&limit=50&page=1` and skips the dispatch when a run of the same workflow file (`.workflow_id`) is queued. The existing `actions/tasks` guard (#238) stays — it covers running and recently-started jobs — but a task row exists only once a runner has picked the job, so a queued run never appears there. That is why on 2026-10-15, with one pool runner silently stalled, the guard dispatched on every tick (101 / 15 in the 04Z hour vs the normal 24 / 92) and Forgejo's single oldest-first queue lagged 1h45m for every repo. **Why keyed on the workflow file, not the job name:** a run queues as a whole; an unpicked per-host leg says the pool cannot take more right now, and adding a run only queues another leg. The GOTCHAS 62 per-host discrimination still applies to the tasks view (a *running* other-host leg does not silence this host). **Ratchet:** the new read carries `status=waiting` and `page=` and goes through the timed `api()`, so `tests/actions-endpoint-test.sh` passes unchanged; its exemption comment now names the backstop as the second reader of that view. **Tests:** four new scenarios in `tests/schedule-backstop-test.sh` (22 total), watched red first on the queued-run case. Full offline suite (`tests/*.sh` + `onboarding/tests/*.sh`) green, `docs-budget-test` green. **Docs:** GOTCHAS 78 body + index row, journal `2026-10-20-289.md`, STATUS hosts row notes the matou-workstation stall. **Rollout note:** consumers get this at their next `FACTORY_REF` bump + re-vendor, and the host tick (`backstop-tick.sh`) calls each repo's vendored copy under `~/swarm/Matou/<repo>/.sandcastle/`, so those checkouts must pull it. The ignition (a runner that stops fetching without dying) is out of scope here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
backstop: guard on runs?status=waiting too — a queued run has no task row, so a stalled runner made the tasks-only guard flood 4x (#289, GOTCHAS 78)
All checks were successful
ci / static (pull_request) Successful in 2m33s
ci / test (pull_request) Successful in 5m22s
8b009b6d81
2026-10-15 03:24Z–05:38Z the matou-workstation runner silently fetched nothing.
schedule-backstop.sh's #238 in-flight guard reads actions/tasks, and the forge
mints a task row only when a runner PICKS the job — a run still queued behind
a stalled or saturated runner is not in that view at all. So the guard read
"idle" exactly when the queue was deepest and dispatched on every tick:
backstop.log 04Z = 101 dispatches / 15 skips against the normal 24 / 92, ~4x
the run rate across every repo the host tick serves. Forgejo 15 serves ALL
repos from one oldest-first job queue, so that became a 1h45m lag for
everything (a Matou/coa-builds release build waited in it).

A second, fail-closed read of runs?status=waiting&limit=50&page=1 — the one
runs read the endpoint ratchet admits, the canary's saturation view — now
suppresses the dispatch when a run of THIS workflow file (.workflow_id) is
queued. Keyed on the workflow file, not the job name: a run queues as a whole
and an unpicked per-host leg says the pool cannot take more right now.

Tests: four scenarios in tests/schedule-backstop-test.sh (a queued run
suppresses even with an idle tasks view; another workflow's queued run does
not; .workflow_id keying for resume-asks.yml; a failed read skips the tick).
The test header and the ratchet's exemption comment say why the tasks view
cannot carry this guard. GOTCHAS 78 (body + index row), journal 2026-10-20-289,
STATUS hosts row notes the matou-workstation stall (no liveness restart yet).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ben merged commit a2dc3535f8 into main 2026-10-21 04:51:47 +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!290
No description provided.