swarm: head-of-line blocking — one long ticket holds the repo's workflow-level concurrency group, so a newly readied ticket waits hours while idle swarm hosts get no job #1732
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1732
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What Ben saw (2026-09-22 ~15:10Z)
Factory machines idle while an unblocked
ready-for-agentticket (#1729) sat unclaimed.Evidence (read on the three hosts)
sandcastle-25615e1e…, up ~1.5 h).schedule_drive_yieldfound/tmp/matou-drive-wanted(an IDIP drive is running there; yield counter at 5) and exited 0 before the trace — so it leaves no verdict line at all.swarm.ymlholds a workflow-levelconcurrency: group: swarm-${{ github.repository }}(cancel-in-progress false). Forgejo keeps ONE run running + ONE pending per group, cancelling the older pending run each time a newer one queues — the workstation runner log shows exactly that: task 119960 picked up 15:14:16Z,RESULT_CANCELLED15:18:42Z. No new swarm run for idss can start until run 30128 ends (timeout 180 min).swarmlabel, runner up, load 0.15, zero idss tasks since 13:00. matou-dev-server-01's second slot is held by a CI session; elitebook-03 is in a drive. So the one host with capacity is the one that can never receive a job while the group is held.maxIterations: 3and re-lists after each task, so it will claim #1729 when #1725 finishes — but only on the busy host, only after #1725, and only because it happens to have iterations left.Why it is shaped this way
The workflow-level group (#705 / dev-factory#26) was the fix for the 2026-08-26 storm (hundreds of queued no-op runs). It collapses bursts correctly — and, as a side effect, serialises whole RUNS per repo, so the matrix width (2) and the host pool size (3) buy nothing once one worker is inside a long ticket.
Proposed fix (ADR 0174 two-way door — factory config; protected path, hence session)
Keep storm protection, remove the head-of-line block:
schedule_debounce_decide), per-ticket claiming, and the host-capacity slots. Replace the workflow-level group with a group keyed on the ready-set hash (a cheap pre-step computes it), or drop it and add a per-host guard: a run that finds no claimable ticket exits in <10 s, which is the cost the group was protecting against.reason=yielded-to-drive) in the verdict log; today it is invisible, which made this hard to diagnose.scripts/tests/workflow-concurrency-test.sh(it currently pins the workflow-level group — update it to pin the new shape) and a storm regression test (N identicalclosedevents ⇒ ≤ 1 worker per ready ticket).Upstream: the same
swarm.ymlshape lives in Matou/dev-factory (FACTORY_REF) — fix there and bump, or fix here and upstream.Why session, not agent
.forgejo/workflows/and.sandcastle/are protected paths workers never edit (#445).Ruled by agent under ADR 0174 — veto anytime.
Ruling
The workflow-level per-repo concurrency group (
swarm-${{ github.repository }}, #705) was the head-of-line block: keyed on the repo alone, it serialised every swarm run for the repo, so a worker inside a long ticket held the group and every later run — the :15/:45 cron and the D5 self-rearm dispatch, the two paths that reach an idle host with a newly readied ticket — queued behind it and was cancelled one-by-one.Of the proposal's four parts:
swarm.ymlnow keys concurrency per run (swarm-${{ github.repository }}-${{ github.run_number }}), so runs never serialise and a newly readied ticket reaches an idle host at once.report_self_rearm→rearm_dispatch); its effectiveness is restored by #1, since the dispatch (workflow_dispatch) no longer queues behind a long run.run-swarm.sh/schedule-lib.sh, so it needs the dev-factory upstream + re-vendor door), along with propagating the shape to the dev-factory template.Why it is a two-way door
Revertible config (one workflow-file line + two test files, all non-vendored — not in
FACTORY_MANIFEST, so no drift-gate impact). Proven at the same offline-test bar #705 itself was. Storm protection is preserved by guards that were absent in the 2026-08-26 storm and are now load-bearing: thelabeledtrigger (the storm's real multiplier) is gone (closedonly); the host-capacity slot flocks yield a slot-less run in seconds before any sandbox; the ready-set-hash debounce + per-ticket claim collapse duplicate work. Worst-case degradation (an emptyrun_number) is re-serialisation — the status quo, never a storm.Close-report
a075fb26(onmain)..forgejo/workflows/swarm.ymlconcurrency group → per-run;scripts/tests/workflow-concurrency-test.shrewritten to reject the serialising per-repo shape and require a per-run key + the host-capacity yield guard's presence; newscripts/tests/swarm-storm-regression-test.sh(N identicalclosedevents ⇒ ≤1 run; a changed ready set runs; the debounce window expires);STATUS.md.workflow-concurrency-test.sh8 checks green (and verified it FAILS on the oldswarm-${{ github.repository }}shape);swarm-storm-regression-test.sh4 checks green;swarm.ymlparses; the swarm.yml-line-extractingdrive-reservation-guard-test.shstill green; drift gate green (no vendored file touched). The runtime effect (Forgejo no longer serialising runs) is inherent to the documented per-group semantics — same bar #705 was accepted at.Closing as done.