#663 consumer half: heavy-capacity consumers must honour /tmp/matou-drive-wanted before claiming — a protected .sandcastle/ + .forgejo/ change #664
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#664
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?
Why this is a separate issue
#663 (ADR 0184's all-or-nothing acquire starves the rehearsal drive) was ruled to be fixed by an intent-file reservation (option 1). That fix has two halves:
Producer (shipped in #663's commit, unprotected
scripts/):scripts/rehearsal-cycle.shwrites/tmp/matou-drive-wantedthe moment a ready, unblocked drive is about to acquire host capacity, persists it across skipped*/2ticks, and removes it on completion/abandonment via an EXIT trap. Reservation helpers (host_capacity_drive_reserve/_release/_wanted/_skip_bump/_skip_reset) live inscripts/lib/host-capacity-lib.shwith offline tests inscripts/tests/host-capacity-lib-test.sh. The drive's own skip line now carries a consecutive-tick count (skipped N consecutive tick(s)), closing the observability gap.Consumer (THIS issue): the heavy-capacity consumers must check the reservation before claiming a NEW task and decline (yield, exit 0) if it is present — in-flight work is never interrupted, only new starts held back, bounding starvation to one worker run. Their skip line must ALSO carry the consecutive-tick count.
Why the producer's agent could not do the consumer half
The #663 triage ruling asserted the consumer edits were to "an ordinary logic change to an unprotected file within"
.sandcastle/. That is factually wrong about the #445 boundary..sandcastle/protected-paths-lib.shsetsPP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"— it fingerprints the entire.sandcastle/and.forgejo/trees, not a named subset. Every consumer call site is inside that protected set:.sandcastle/claim-next-task.sh/.sandcastle/claim-lib.sh(the swarm's task claim).sandcastle/run-swarm.sh,.sandcastle/run-triage.sh.sandcastle/session-runner.sh.sandcastle/host-capacity-lib.sh(the vendored dev-factory copy — needs the samehost_capacity_drive_wantedpredicate; note ADR 0184 point 6: this file is vendored byte-identical fromMatou/dev-factoryper ADR 0180, so the predicate belongs upstream and is re-vendored via aFACTORY_REFbump).forgejo/workflows/swarm.yml/triage.yml(inline the pool try-order pre-checkout, ADR 0184 point 1)A swarm worker editing any of these is rolled back and fails the run loud (#445). This needs an interactive session's standing (ADR 0174), and the dev-factory copy needs an upstream change + re-vendor.
What to build
host_capacity_drive_wanted([ -e /tmp/matou-drive-wanted ]) to the dev-factoryhost-capacity-lib.shand re-vendor.sandcastle/host-capacity-lib.sh(mirror the producer copy inscripts/lib/host-capacity-lib.shon idssmain, which already defines it and the reserve/release/skip helpers).host_capacity_drive_wanted, logdeferring to a ready drive — skipped N consecutive tick(s)(persist the count the same way, e.g. a per-consumer/tmp/matou-<consumer>-drive-defer-count) and yield (exit 0). Never interrupt in-flight work — check only at the point of starting NEW work.swarm.yml/triage.ymlinline the same pre-claim check (they cannot source a repo file pre-checkout — mirror ADR 0184 point 1's inline convention).Proof
Offline: extend
.sandcastle/tests/host-capacity-lib-test.sh(or the yield tests) with a reservation-respected case (consumer yields when/tmp/matou-drive-wantedpresent, claims when absent). Live: the next standing-drive tick (#652/#657) under a busy queue — the drive should now win within one worker-run drain, and both sides' logs should show the climbing count.Two-way door
Revertible by removing the pre-claim check; provable by the offline suite + the live tick. No credential, security-posture, member-trust, data-destruction, or spend surface — the machinery-boundary standing (a session per ADR 0174/#445), not a one-way door, is the only reason this is not an ordinary agent ticket.
Filed by the #663 producer-half agent (sandcastle) while working #663.
Close report
Ruled by agent under ADR 0174 — veto anytime.
What landed. The #664 consumer half, done properly this time:
Matou/dev-factory@1b7abc2— ports the full drive-reservation API intohost-capacity-lib.sh(host_capacity_drive_wanted/_reserve/_release/_skip_bump/_skip_reset, TTL-bounded) and addshost_capacity_consumer_defer_bump/_reset(keyed by an explicit counter PATH, not a hard-coded name, so three consumers on three cadences keep independent streaks and tests never touch real host/tmp);session-runner.shchecks it beforehost_capacity_acquire_heavyand logsdeferring to a ready drive — skipped N consecutive tick(s). Tests:tests/host-capacity-lib-test.sh13 groups,tests/session-runner-test.sh9 (new case 9).Matou/dev-factory@ab5bfa6— self-pin bump59c53bd→baa6281→1b7abc2.Matou/idss@90b66e0d— re-vendors.sandcastle/at the new pin (FACTORY_REF/FACTORY_MANIFEST,host-capacity-lib.sh,session-runner.sh, their tests, plusheal.sh's unrelated-but-safe upstream #10 pickup);.forgejo/workflows/swarm.yml/triage.yml(idss-local, not vendored) gain the matching inline consecutive-defer count;scripts/tests/drive-reservation-guard-test.shrewritten to scan for the guard's closingfiinstead of a hard-coded line count, and to assert the count climbs 1→2 and resets on release/expiry (17 checks).Why the fix landed twice. The immediately-prior commit (
b0497958) attempted this ticket but hand-edited.sandcastle/host-capacity-lib.shand.sandcastle/session-runner.shdirectly — both areFACTORY_MANIFESTentries vendored byte-identical fromMatou/dev-factoryper ADR 0180, and editing them here is exactly the ownership-inversion bug class that ADR retired.bash .sandcastle/check-harness-drift.shfailed red on it the moment this session ran it (first action taken on the ticket). That commit was also missing the ticket's explicit ask — "their skip line must ALSO carry the consecutive-tick count" — the consumer yield lines only reported the bare fact of standing down, no count. This session corrected both: landed the fix inMatou/dev-factory(with its own tests) instead of the local checkout, then re-vendored.Scope guard — a ruling under ADR 0174 rule 1. Re-vendoring required
onboard.sh vendor --force(the tool refuses a partial pin bump when ANY vendored file has been hand-edited locally). That force-overwrite would have silently reverted 7 OTHER.sandcastle/files already drifted from the OLD pin before this session touched anything (limit-lib.sh,preflight-swarm.sh,rehearsal-report.sh,run-swarm.sh,sweep-lib.sh, and 2 tests) — genuine local fixes (e.g.run-swarm.sh's Claude-auth-refusal classification) never ported upstream, unrelated to #664. Backed those 7 up before the forced vendor, restored them after — same drift state as before this session, no regression, no scope creep. Filed as a follow-up: #666 (ready-for-session, same protected-path standing this ticket needed).Proof.
bash .sandcastle/check-harness-drift.sh— clean for every file this ticket owns (the 7 pre-existing unrelated files still flagged, unchanged from before this session — see #666). Full green sweep:scripts/tests/host-capacity-lib-test.sh11,scripts/tests/drive-reservation-guard-test.sh17,.sandcastle/tests/host-capacity-lib-test.sh13,.sandcastle/tests/session-runner-test.sh9,.sandcastle/tests/heal-test.sh9,.sandcastle/tests/preflight-swarm-test.sh3,.sandcastle/tests/sweep-lib-test.sh10, plus every other.sandcastle/tests/*.shandscripts/tests/*.shin a full sweep (no regressions).bash -nclean on every touched shell file; both workflow YAMLs parse.Live proof (the next standing-drive tick under a busy queue, per the ticket's own Proof section) is still owed — this session cannot fire a live drive itself (#577/ADR 0184, the same reason #644/#647 session-runner sessions note). The offline suite above is the two-way-door proof; veto anytime.