sandcastle: schedule-backstop.sh's swarm in-flight check has the same matrix-suffix name-match blind spot as #541 #588
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#588
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?
Symptom (follow-up from #541)
While fixing #541 (the multi-host swarm-claim mechanism's
claim_alive_runs()in
.sandcastle/claim-lib.shnever matched a live run, because it exact-matchedjob name
"swarm"whileswarm.yml's 2-wide worker matrix(
strategy.matrix.worker:[1,2], landed44fe333) makes Forgejo name eachmatrix job
"swarm (1)"/"swarm (2)", never bare"swarm"— live-probed2026-08-15 against the real
/actions/tasksresponse), I found the identicalexact-match pattern in
.sandcastle/schedule-backstop.sh's in-flight check:schedule-backstop.sh swarm.yml <window>setsname="swarm"— the samestring that never matches a real matrix-suffixed task. The crontab install
(
docs/agents/swarm-atlas.md) runs this backstop forswarm.yml, so inproduction it can never see a swarm run as "in flight" and may pile on
redundant
swarm.ymldispatches within its window even while matrix workersare already running — a plausible amplifier of #541's race (more concurrent
swarm runs racing the same ready-ticket list).
Likely cause
Same drift as #541: the exact-match filter predates the matrix
(
schedule-backstop.sh'sselect(.name == $n)is unchanged since before44fe333);schedule-backstop-test.shonly exercises bare"swarm"tasknames, so the suite stayed green through the drift.
Suggested direction
Generalize the match the same way #541 fixed
claim-lib.sh:select(.name == $n or (.name | test("^" + $n + " \\("))), plus a test case asserting amatrix-suffixed in-flight run suppresses a redundant dispatch. Left unfixed
in #541 to keep that diff scoped to the reported/proven duplicate-work bug;
this ticket is the tracked follow-up.
Filed by agent session under ADR 0174 while working #541 (ready-for-agent —
mechanical, revertible, provable by an added test case; no one-way door).
This ticket cannot be worked by a Sandcastle swarm agent: both files it changes —
.sandcastle/schedule-backstop.shand.sandcastle/tests/schedule-backstop-test.sh— sit directly under.sandcastle/, a fingerprinted protected directory (PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"in.sandcastle/protected-paths-lib.sh; not exempt — only*matou-heal-*is). Per #445 / ADR 0174 the swarm worker's before/after tree-fingerprint would roll back any edit here and fail the run loud. A protected.sandcastle/path needs an interactive session's standing, not a swarm agent.The bug itself is confirmed real and the ticket's suggested direction is correct:
schedule-backstop.sh:70filtersselect(.name == $n)— exact-match, blind toswarm.yml's matrix-suffixed job names ("swarm (1)"/"swarm (2)"), the same drift #541 fixed inclaim-lib.sh..sandcastle/tests/schedule-backstop-test.shhas no matrix-suffixed in-flight case, so the drift stayed green.select(.name == $n or (.name | test("^" + $n + " \\("))), plus a test asserting a matrix-suffixed in-flight run suppresses a redundant dispatch.Re-arm: this is the same class as its sibling #541 (which is correctly
ready-for-session). I am removingready-for-agentand addingready-for-sessionso an interactive session picks it up. No human decision is pending — just the session's standing to edit the machinery.(swarm run 6859, blocked per ADR 0174 escape path while claimed from the ready-for-agent queue)
Ruled by agent under ADR 0174 — veto anytime. This is a two-way door: a mechanical jq-filter fix mirroring #541's already-accepted
claim-lib.shpattern, revertible by a single commit revert, and provable by an added offline test case (no credentials, no security-posture change, no member-facing trust accept, no data destruction, no non-routine spend).Close report
Fixed:
.sandcastle/schedule-backstop.sh's in-flight check exact-matchedselect(.name == $n)againstname="swarm", so it could never see a real swarm run (Forgejo names matrix jobs"swarm (1)"/"swarm (2)"since44fe333) as in-flight — a redundantswarm.ymldispatch could pile onto an already-running matrix, a plausible amplifier of #541's race.Fix: generalized the match the same way #541 fixed
claim_alive_runs():select(.name == $n or (.name | test("^" + $n + " \\("))).Proof: added a case to
.sandcastle/tests/schedule-backstop-test.shasserting a"swarm (1)"running run suppresses dispatch — reproduced red against the pre-fix filter (viagit stash), then green after. Full.sandcastle/tests/*.shsweep: all 34 suites green.Commit:
b741af8391(pushed tomain)STATUS.md: updated in the same commit.
advances #588