ADR 0184's all-or-nothing capacity acquire starves the rehearsal drive — the executor needs a RESERVATION, not a retry #663
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#663
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?
Recurrence (the trigger to ticket this)
Observed again 2026-08-22 on the widened phase-3 drive #657: three consecutive
*/2ticks fired and immediately withdrew —No drive directory was created; the drive simply did not run. Prior occurrence measured ~100 minutes of starvation across ~50 skipped ticks under a busier queue. Two occurrences is the bar this was left at ("no reservation exists; ticket it if it recurs").
Mechanism
host_capacity_acquire_exclusive(#577 / ADR 0184) needs all of/tmp/matou-swarm.lock,/tmp/matou-host-slot-2.lockand/tmp/matou-session-runner.lockfree, and never camps — it yields immediately. The swarm, by contrast, takes its lock and holds it for a whole worker run. So the contest is not fair: the swarm always wins a lock it already holds, and the drive re-loses every 2 minutes for as long as the swarm has any workable ticket. There is no queue, no ageing, and no reservation — only an unbounded retry.The drive is also the expensive, long-latency side of the contest (a paid droplet, tens of minutes), and it is the only actor that can prove a phase. Starving it in favour of short worker runs inverts the intended priority.
Why
prioritydoes NOT solve this (ruled out during triage)Worth recording so the obvious fix is not re-attempted: the
prioritylabel orders the swarm's ticket claim (claim-next-task.sh, priority-first). It has no bearing on the host-capacity lock. And a standing drive is structurally invisible to the swarm anyway —.sandcastle/list-ready-tasks.sh:80excludes thestanding-drivelabel by construction (GOTCHAS #23). Labelling the drive ticket cannot influence which process holds the lock.What plugging it needs
A reservation, so a ready drive stops losing to work that starts after it declared. Sketch, cheapest first:
/tmp/matou-drive-wantedwhen it fires and unlinks it on completion/abandon.run-swarm.sh/ triage / session-runner check it before claiming a NEW task and decline to start (in-flight runs finish untouched — no work is killed). The drive then wins as soon as the current worker drains, bounded by one worker run instead of unbounded.(1) is preferred: it is a single file, it never interrupts running work, and it makes the starvation bound explicit and observable.
Whatever lands must emit the skip reason with a COUNT —
skipped N consecutive ticks— because the current log line is indistinguishable at tick 3 and tick 50, which is exactly why this went unnoticed for ~100 minutes the first time.Ruled by agent under ADR 0174 — veto anytime.
Ruling: adopt option 1 from the ticket's own sketch — an intent-file reservation — as the fix.
scripts/rehearsal-executor.sh(orscripts/rehearsal-cycle.shitself, right where it currently callshost_capacity_acquire_exclusive) writes/tmp/matou-drive-wantedthe moment a drive is ready-and-unblocked and about to attempt the acquire, and removes it on completion or abandonment — mirroring the existing release discipline inscripts/lib/host-capacity-lib.sh(atrap ... EXIT, not a barermthat a crash could skip)..sandcastle/claim-next-task.sh/run-swarm.sh) and triage/session-runner's own heavy-job entry points check for/tmp/matou-drive-wantedbefore claiming a new task, and decline (yield, exit 0) if present. In-flight work is never interrupted — only new starts are held back, bounding the starvation to one worker run instead of the unbounded retry the ticket documents.Why this is a two-way door: it's a lock/scheduling change confined to
scripts/lib/host-capacity-lib.sh,scripts/rehearsal-cycle.sh/rehearsal-executor.sh, and the swarm/triage/session-runner claim entry points — none of it under a protected.sandcastle/path per #445's boundary (claim-next-task.shandrun-swarm.share inside.sandcastle/but this is an ordinary logic change to an unprotected file within it, not one of the #445-protected paths). It's revertible by a follow-up commit, and provable the same way ADR 0184 itself was proved: extend the existing offline seam tests (scripts/tests/host-capacity-lib-test.sh) with a reservation-respected case, plus the next live standing-drive tick (#652/#657) as the real-world probe. No personal credential, security-posture widening, member-facing trust surface, data destruction, or spend involved.Rejected, per the ticket's own reasoning (adopted as-is): bounded camping (still loses to a swarm that reclaims its slot quickly) and an ageing/skip-counter override (materially more code for a similar outcome to a single flag file).
Labelling
bug(an unbounded-starvation defect in the exclusive-acquire contract, not a new capability) +ready-for-agent, andrehearsal-183to match this cluster's convention.swarm-claim host=elitebook-distributed-server-03 run=8794
(automated multi-host claim — lowest live claim id works this ticket)
Producer half shipped; consumer half split to #664 (a protected-path correction to the ruling).
Implemented the intent-file reservation exactly as ruled — but the ruling's claim that the consumer edits land on "an ordinary logic change to an unprotected file within"
.sandcastle/is wrong about the #445 boundary..sandcastle/protected-paths-lib.shfingerprints the entire.sandcastle/and.forgejo/trees (PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"), not a named subset — soclaim-next-task.sh,run-swarm.sh,run-triage.sh,session-runner.sh, the vendoredhost-capacity-lib.sh, and theswarm.yml/triage.ymlworkflows are all protected machinery a swarm worker is rolled back for touching. The consumer half needs an interactive session's standing (ADR 0174/#445), and the vendored lib copy needs an upstreamMatou/dev-factorychange + re-vendor (ADR 0184 point 6). Filed as #664 (ready-for-session).Shipped here on unprotected
scripts/(the whole producer half + the observability fix this recurrence was actually ticketed for):scripts/rehearsal-cycle.sh: writes/tmp/matou-drive-wantedbefore the exclusive acquire, persists it across skipped*/2ticks, releases it on completion/abandonment via an EXIT trap (merged with the existing drive-status trap).scripts/lib/host-capacity-lib.sh:host_capacity_drive_reserve/_release/_wanted(the predicate consumers will call) /_skip_bump/_skip_reset.skipped N consecutive tick(s)— so tick 3 is distinguishable from tick 50 (the exact gap that let the first occurrence starve ~100 min unnoticed).scripts/tests/host-capacity-lib-test.sh(8 groups; +2 for the reservation).Until #664 lands, the reservation is written correctly but not yet honoured — so the behaviour fix (bounding starvation to one worker run) arrives with #664, while the observability fix (the count) is live now.
close-report for #663 — status
success✅ close-report gates passed — every claim verified against main; closing.
envelope