factory: session-runner/healer join the host capacity semaphore (needs dev-factory edit + re-pin) #605
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#605
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?
Follow-up from #577 (host capacity semaphore)
#577 (
docs/adr/0184-*.md) replaced/tmp/matou-swarm.lockwith a 2-slotpooled host capacity semaphore (
scripts/lib/host-capacity-lib.sh) and madethe rehearsal drive exclude everything heavy host-wide — but session-runner
and the healer only got EXCLUDED by the drive (their existing single-instance
locks are grabbed from the outside); neither became a participant in the
2-slot pool against swarm/triage. A live session-runner session and a live
swarm worker can still both run concurrently today, exactly as before #577.
Why this is separate
.sandcastle/session-runner.shand.sandcastle/heal.share vendoredbyte-identical from
Matou/dev-factory(ADR 0180,FACTORY_MANIFEST).Making either draw from
HOST_CAPACITY_SLOTSmeans editing them inMatou/dev-factoryitself and re-vendoring via aFACTORY_REFbump — adistinct two-way door from #577's per-repo workflow/script changes, and
touches a second repo's checkout. Scoped out of #577 to keep that ticket's
blast radius to files this checkout could safely edit and prove in one
session.
Suggested shape (not binding — re-derive from the code at pickup time)
scripts/lib/host-capacity-lib.sh's two primitives (or equivalent)into
Matou/dev-factory, sinceswarm-identity.shis the only file ADR0180 keeps deliberately per-repo — this lib is generic.
session-runner.sh: acquire a heavy slot (host_capacity_acquire_heavy)around the same span its own
SESSION_RUNNER_LOCKalready covers; yield(existing "tick absorbed" path) on exhaustion.
heal.sh: decide deliberately whether the healer should become pool-awareat all — today it's bounded (one Claude call per incident signature,
hourly watchdog cadence, its own per-repo mutex already) and #577's ADR
reasoned that folding it in was a bigger change for uncertain benefit.
Re-litigate with fresh evidence rather than assuming yes.
FACTORY_REF+ re-runcheck-harness-drift.shin ourcloud (andmatou-app, once #572 lands) after the factory-side change merges.
Needs Ben: none identified yet — likely a two-way door under ADR 0174
once scoped, same as #577 was. Flag if the factory-repo edit surfaces a real
judgment call.
Ruled by agent under ADR 0174 — veto anytime.
Ruling:
ready-for-session, notready-for-agentorready-for-human.Context checks first:
scripts/lib/host-capacity-lib.shanddocs/adr/0184-host-capacity-is-a-two-slot-pool-not-a-single-lock.mdlanded via #577 (
9c235a0)..sandcastle/session-runner.shand.sandcastle/heal.shdo not referenceHOST_CAPACITY_SLOTSorhost_capacity_acquire_*anywhere — the gap this ticket describes isreal, not already closed.
.out-of-scope/directory exists in this repoyet, so nothing to match against.
Routing:
Matou/dev-factorydirectly (porting the twocapacity primitives, editing the vendored
session-runner.sh/heal.shthere, bumping
FACTORY_REF) — a second repo's checkout, the samecategory of cross-repo work #572 hit. Verified live just now:
swarm-bot's Forgejo token is stillpush:falseonMatou/dev-factory(
GET /repos/Matou/dev-factory→permissions.push: false), the samewall #572's close-report recorded (AGit PR was the only path in). A
swarm
ready-for-agentworker operates only within this repo's owncheckout/branch/PR flow and has no standing to clone, branch, and open an
AGit PR against a second repo; an interactive session does — #572's PR #5
and #577 itself (this ticket's parent) both did exactly this kind of
cross-repo/session work.
ready-for-human: no step here is Ben's-hands, Ben's-eyes, or aone-way-door ruling (personal credentials / security-posture widening /
member-facing trust accept / data destruction / non-routine spend — none
apply), and the ticket's own "Needs Ben: none identified yet" holds. The
one open design question it flags — whether the healer should become
pool-aware at all — is a two-way-door design call a session can make and
record (bounded, single-purpose healer with its own mutex already;
reversible by a later commit either way), not a Ben judgment call.
Two-way door: the label is revertible (a relabel costs nothing), and the
routing is provable by the precedent already on the tracker —
push:falseconfirmed live above, AGit PR the working path (#572 PR #5).
Category:
enhancement— extends #577's concurrency-safety coverage tothe two vendored files it deliberately scoped out; nothing is broken today
that wasn't already excluded by design.
Ruled by agent under ADR 0174 — veto anytime
Two-way door: revertible (the
FACTORY_REFbump + vendored-file changeshere, and the
Matou/dev-factorycommit itself, both plain commits), andprovable — offline tests plus
check-harness-drift.sh.session-runner.sh joins the pool. Ported
host-capacity-lib.sh(thepooled-slot/exclusive-acquire primitives from #577/ADR 0184) into
Matou/dev-factoryas a generic, byte-identical vendored file (no reposlug — any consumer's heavy host-side loop can source it, not just
workflow-triggered ones).
session-runner.shnow callshost_capacity_acquire_heavyimmediately after its ownSESSION_RUNNER_LOCKacquire and yields ("host capacity pool exhausted —tick absorbed") on exhaustion, exactly like its existing single-instance-
lock yield path — both fds release on process exit, no explicit teardown
needed. This closes the gap this ticket named: a live session-runner
session and a live swarm/triage worker could previously both run
unbounded at once.
heal.sh deliberately does not join this round. Re-litigated per the
ticket's ask rather than assuming yes: checked
docs/GOTCHAS.mdand thisrepo's own healer history in
STATUS.mdfor anything since #577 landed(2026-08-19) — no contention evidence exists. The original bounded-
workload reasoning from ADR 0184 point 6 still holds: one Claude call per
incident signature, hourly watchdog cadence, its own per-repo mutex, and
it's already excluded from drives via
host_capacity_acquire_exclusivegrabbing its lock from the outside. If a real session-runner/swarm-vs-
healer collision surfaces later, that's fresh evidence for a future
ticket to re-open this — not assumed here.
Proof:
Matou/dev-factory@e9aa0bd—host-capacity-lib.sh+tests/host-capacity-lib-test.sh(6 groups, ported fromscripts/tests/host-capacity-lib-test.shhere) +session-runner.shwiring + 1 new
tests/session-runner-test.shcase (pool-exhaustionabsorbs the tick before any API call). Full suite: 38/38 offline tests
green standalone, no product checkout on
PATH.FACTORY_REFbumped toe9aa0bd,host-capacity-lib.sh+its test added to
FACTORY_MANIFEST,session-runner.sh+tests/session-runner-test.shre-vendored byte-identical.bash .sandcastle/check-harness-drift.sh→ OK. Every.sandcastle/tests/*.shand
scripts/tests/*.shgreen.Matou/dev-factorye9aa0bd;Matou/ourcloudf48ff68+0db069b(mode-bit tidy).No one-way door surfaced — nothing here touches personal credentials,
widens security posture, or is a member-facing trust accept. Advances
#605, #577.
Close report
What landed: session-runner and swarm/triage now draw from the same
2-slot host capacity pool; healer stays out (deliberate, re-litigated, see
the ruling comment above).
Commits:
Matou/dev-factory@e9aa0bd—host-capacity-lib.shported (generic),session-runner.shwired tohost_capacity_acquire_heavy, tests added.Matou/ourcloud@f48ff68—FACTORY_REFbump + re-vendor(
host-capacity-lib.sh,session-runner.sh, both tests,FACTORY_MANIFEST),STATUS.md.Matou/ourcloud@0db069b— vendored-file mode-bit tidy (content wasalready byte-identical; only the executable bit differed).
Proof:
bash .sandcastle/check-harness-drift.sh→OK — every vendored factory file matches https://git.matou.nz/Matou/dev-factory.git@e9aa0bd....Matou/dev-factory: 38/38 offline tests green standalone(
for t in tests/*.sh; do ...; done).Matou/ourcloud: every.sandcastle/tests/*.shandscripts/tests/*.shgreen, including the new
host-capacity-lib-test.sh(6 groups) and thenew pool-exhaustion case in
session-runner-test.sh(group 8: bothslots pre-held → runner reports "host capacity pool exhausted — tick
absorbed" before any API call).
Not done, on purpose:
heal.shdoes not join the pool — see theruling comment for the re-litigated reasoning.
Closing — advances #605 (and the #577/ADR 0184 point 6 follow-up).