Session-runner fairness: one host-global lock lets one enrolled repo starve another #35
Closed
opened 2026-08-23 15:25:30 +00:00 by matou-build-agent
·
7 comments
No Branch/Tag specified
main
sandcastle/rescue-20261120-212246
sandcastle/rescue-20261120-202650
sandcastle/rescue-20261120-202316
sandcastle/worker/20261120192753-1909682
sandcastle/rescue-20261120-191443
sandcastle/rescue-20261120-195103
sandcastle/rescue-20261120-201254
sandcastle/rescue-20261120-201438
sandcastle/rescue-20261120-144756
sandcastle/rescue-20261120-184843
sandcastle/rescue-20261120-190817
sandcastle/rescue-20261120-045815
sandcastle/rescue-20261120-143144
sandcastle/rescue-20261120-144025
sandcastle/worker/20261120032838-3834852
sandcastle/worker/20261120034547-1076409
sandcastle/rescue-20261120-031041
sandcastle/rescue-20261120-035031
sandcastle/rescue-20261120-041046
sandcastle/rescue-20261120-041556
sandcastle/rescue-20261120-042712
sandcastle/rescue-20261120-044145
sandcastle/rescue-20261120-044401
sandcastle/worker/20261120020735-3225234
sandcastle/rescue-20261120-025017
sandcastle/worker/20261120012937-3577764
sandcastle/rescue-20261120-024432
sandcastle/rescue-20261120-012510
sandcastle/rescue-20261120-020027
sandcastle/rescue-20261120-022005
sandcastle/rescue-20261120-023040
sandcastle/rescue-20261120-023059
sandcastle/rescue-20261120-023617
sandcastle/rescue-20261120-023726
sandcastle/rescue-20261120-024624
sandcastle/rescue-20261120-030108
sandcastle/rescue-20261120-011059
sandcastle/rescue-20261119-235227
sandcastle/rescue-20261119-220002
sandcastle/rescue-20261119-234418
sandcastle/worker/20261119210537-2901903
sandcastle/rescue-20261119-215319
sandcastle/worker/20261119210832-2140478
sandcastle/rescue-20261119-205729
sandcastle/worker/20261119195637-2051281
sandcastle/rescue-20261119-203604
sandcastle/rescue-20261119-212545
sandcastle/rescue-20261119-213258
sandcastle/rescue-20261119-214233
sandcastle/rescue-20261119-215039
sandcastle/rescue-20261119-200052
sandcastle/rescue-20261119-202558
sandcastle/rescue-20261119-202859
sandcastle/rescue-20261119-204522
sandcastle/rescue-20261119-202901
sandcastle/worker/20261119192821-2242548
sandcastle/rescue-20261119-201432
sandcastle/worker/20261119185826-1049892
sandcastle/rescue-20261119-192442
sandcastle/rescue-20261119-194543
sandcastle/rescue-20261119-195715
sandcastle/rescue-20261119-195042
sandcastle/rescue-20261119-194153
sandcastle/rescue-20261119-193223
sandcastle/rescue-20261119-181821
sandcastle/rescue-20261119-182031
sandcastle/rescue-20261119-191400
sandcastle/rescue-20261119-184524
sandcastle/rescue-20261119-185251
sandcastle/rescue-20261119-190111
sandcastle/rescue-20261119-171507
sandcastle/rescue-20261119-172406
sandcastle/rescue-20261119-180227
sandcastle/rescue-20261119-181611
sandcastle/rescue-20261119-183926
sandcastle/rescue-20261119-165410
sandcastle/rescue-20261119-181300
sandcastle/worker/20261119152654-1251003
sandcastle/rescue-20261119-175608
sandcastle/rescue-20261119-153212
sandcastle/rescue-20261119-155612
sandcastle/rescue-20261119-161612
sandcastle/rescue-20261119-162645
sandcastle/rescue-20261119-151259
sandcastle/worker/20261119-091545-699963
sandcastle/rescue-20261119-152400
sandcastle/rescue-20261119-150650
sandcastle/rescue-20261119-151018
sandcastle/rescue-20261119-145753
sandcastle/rescue-20261119-144640
sandcastle/worker/20261119-141805-b375a7
sandcastle/rescue-20261119-143616
sandcastle/rescue-20261119-142315
sandcastle/rescue-20261119-143536
sandcastle/rescue-20261119-144907
sandcastle/rescue-20261119-150929
sandcastle/rescue-20261119-140252
sandcastle/rescue-20261119-132837
sandcastle/rescue-20261119-140917
sandcastle/rescue-20261118-232015
sandcastle/rescue-20261118-224358
sandcastle/rescue-20261118-231012
sandcastle/rescue-20261118-221954
sandcastle/rescue-20261118-223235
sandcastle/rescue-20261118-215029
sandcastle/rescue-20261118-220457
sandcastle/rescue-20261118-213647
sandcastle/rescue-20261118-213651
sandcastle/rescue-20261118-203142
sandcastle/rescue-20261118-201242
sandcastle/rescue-20261118-160449
sandcastle/worker/20261118-151037-fa1423
sandcastle/rescue-20261118-141033
sandcastle/rescue-20261118-153435
sandcastle/rescue-20261118-155226
sandcastle/rescue-20261118-140135
sandcastle/rescue-20261118-072336
sandcastle/rescue-20261118-071306
sandcastle/rescue-20261118-065902
sandcastle/rescue-20261118-070925
sandcastle/rescue-20261118-064628
sandcastle/rescue-20261118-060611
sandcastle/rescue-20261118-063652
sandcastle/rescue-20261118-065117
sandcastle/rescue-20261118-065556
sandcastle/rescue-20261118-055026
sandcastle/worker/20261118-000033-5f0b74
sandcastle/rescue-20261118-054929
sandcastle/rescue-20261118-053613
sandcastle/worker/20261118-050837-870db6
sandcastle/rescue-20261118-051315
sandcastle/rescue-20261118-052156
sandcastle/rescue-20261118-053056
sandcastle/rescue-20261118-042651
sandcastle/rescue-20261118-050517
sandcastle/rescue-20261118-052017
sandcastle/rescue-20261118-052046
sandcastle/rescue-20261118-053617
sandcastle/rescue-20261118-040341
sandcastle/rescue-20261118-035452
sandcastle/rescue-20261117-180034
sandcastle/worker/20261117-173516-cca624
backport/idss-2068-2111-2114
sandcastle/rescue-20261117-123242
sandcastle/rescue-20261117-124231
backport/idss-2057
sandcastle/rescue-20261116-154411
sandcastle/rescue-20261117-175037
sandcastle/rescue-20261116-153352
sandcastle/rescue-20261107-062749
session-runner-land-mode-recheck-2181
sandcastle/rescue-20261107-061316
fp/idss-2180
sandcastle/rescue-20261107-060212
forward-port/provision-disk-guard
sandcastle/rescue-20261107-060021
sandcastle/rescue-20261107-054649
sandcastle/worker/20261107-043349-cf0d7e
backport/idss-2177
sandcastle/rescue-20261116-175301
sandcastle/rescue-20261116-175950
backport/idss-2176
sandcastle/rescue-20261106-135208
sandcastle/rescue-20261107-045600
sandcastle/rescue-20261107-051315
sandcastle/rescue-20261107-053423
sandcastle/worker/20261106-111451-8c1ff0
sandcastle/rescue-20261106-023514
sandcastle/rescue-20261106-113455
sandcastle/rescue-20261106-115043
sandcastle/rescue-20261106-121303
sandcastle/rescue-20261106-134211
sandcastle/worker/20261106-013937-c15abc
fix/336-job-locality-runner-uuid
sandcastle/rescue-20261106-000320
sandcastle/rescue-20261105-113317
sandcastle/rescue-20261105-235352
sandcastle/rescue-20261106-020541
sandcastle/rescue-20261106-022516
sandcastle/rescue-20261106-024735
sandcastle/rescue-20261106-024744
sandcastle/rescue-20261106-024751
sandcastle/worker/20261105-104416-4319e1
sandcastle/rescue-20261105-111401
sandcastle/worker/20261105-054650-133b83
sandcastle/rescue-20261105-104304
sandcastle/rescue-20261105-110432
sandcastle/rescue-20261105-110637
sandcastle/rescue-20261105-112240
sandcastle/rescue-20261105-102818
sandcastle/worker/20261105-090131-e38a52
sandcastle/rescue-20261105-101105
sandcastle/rescue-20261105-094209
sandcastle/rescue-20261105-095705
sandcastle/rescue-20261105-091351
sandcastle/rescue-20261105-092126
sandcastle/rescue-20261105-093755
sandcastle/rescue-20261105-095339
sandcastle/rescue-20261105-101509
sandcastle/worker/20261105-033507-997386
sandcastle/worker/20261105-072852-43a339
sandcastle/rescue-20261105-085215
sandcastle/rescue-20261105-090546
sandcastle/rescue-20261105-090731
sandcastle/rescue-20261105-091600
sandcastle/worker/20261105-073544-9e3e7b
sandcastle/rescue-20261105-085541
sandcastle/worker/20261105-030149-b06fe6
sandcastle/rescue-20261105-075223
sandcastle/rescue-20261105-080157
sandcastle/rescue-20261105-081231
sandcastle/rescue-20261105-081252
sandcastle/rescue-20261105-081916
sandcastle/rescue-20261105-082029
sandcastle/rescue-20261105-082600
sandcastle/rescue-20261105-082859
sandcastle/rescue-20261105-083557
sandcastle/rescue-20261105-084327
sandcastle/rescue-20261105-090802
sandcastle/rescue-20261105-092213
sandcastle/worker/20261105-004228-d59980
sandcastle/worker/20261104-200255-c897e8
sandcastle/rescue-20261105-021604
sandcastle/rescue-20261105-062428
sandcastle/rescue-20261105-064420
sandcastle/worker/20261104-185608-12e745
sandcastle/rescue-20261105-011719
sandcastle/rescue-20261104-221030
sandcastle/rescue-20261105-003304
sandcastle/rescue-20261105-005511
sandcastle/rescue-20261105-013351
sandcastle/rescue-20261105-015246
sandcastle/worker/20261104-204335-4df59d
sandcastle/worker/20261104-144451-39719f
sandcastle/rescue-20261104-210849
sandcastle/rescue-20261104-211127
sandcastle/rescue-20261104-212722
sandcastle/worker/20261104-194113-a58f71
sandcastle/rescue-20261104-193329
sandcastle/rescue-20261104-200835
sandcastle/rescue-20261104-201057
sandcastle/rescue-20261104-202237
sandcastle/rescue-20261104-204239
sandcastle/rescue-20261104-185105
sandcastle/rescue-20261104-185510
sandcastle/rescue-20261104-192703
sandcastle/rescue-20261104-184907
sandcastle/rescue-20261104-183301
sandcastle/rescue-20261104-183354
backport/idss-2161
backport/idss-2155
fp/idss-2147
backport/idss-2145
backport/idss-2134
backport/idss-2119
sandcastle/worker/20261030-141035-c3d689
sandcastle/worker/20261030-125730-11b08b
sandcastle/worker/20261030-172321-20db0e
backport/idss-2114
backport/idss-2112
forward-port/idss-2111
forward-port/idss-2068
backport/idss-2111
backport/idss-2110
backport/idss-2106
backport/idss-2068
backport/idss-2104
sandcastle/rescue-20261030-110900
sandcastle/worker/20261029-055633-763b74
sandcastle/worker/20261029-000831-e4c652
sandcastle/worker/20261028-162655-0e8071
sandcastle/rescue-20261030-110112
sandcastle/rescue-20261030-110131
sandcastle/rescue-20261030-110135
sandcastle/rescue-20261030-110153
sandcastle/rescue-20261030-110156
sandcastle/rescue-20261030-110200
sandcastle/rescue-20261030-110220
backport/idss-1913
agent/issue-306
runner-busy-not-stalled
sandcastle/worker/20261024-045639-da1b9a
sandcastle/worker/20261023-060833-778cbe
fleet-queue-watcher-301-proposal
floor-vue
sandcastle/worker/20261021-191646-b93327
sandcastle/worker/20261021-233637-f21837
sandcastle/worker/20261021-233255-c766f7
sandcastle/worker/20261021-040000-b7a28d
backport/idss-2050
backport/idss-2050-session-pr-landing
sandcastle/worker/20261020-221737-cc96f3
backport/idss-2052
agent/issue-289
backstop-waiting-runs
sandcastle/worker/20261017-204619-942ae4
sandcastle/worker/20261017-204620-aa17c2
sandcastle/worker/20261017-144914-3ec608
sandcastle/worker/20261017-063336-7f5d31
sandcastle/rescue-20261017-062529
sandcastle/worker/20261017-010124-c49097
sandcastle/worker/20261017-003840-0c4ab1
sandcastle/rescue-20261017-054742
sandcastle/worker/20261017-053155-61c4c7
sandcastle/worker/20261017-050606-f20d66
sandcastle/rescue-20261017-052443
sandcastle/worker/20261017-050839-ec5b54
sandcastle/rescue-20261017-052212
sandcastle/worker/20261017-050442-495e4b
sandcastle/rescue-20261017-051857
sandcastle/worker/20261017-000426-34fa18
agent/issue-272
agent/issue-273
agent/issue-244
agent/issue-269
sandcastle/rescue-20261016-184726
sandcastle/rescue-20261016-184906
sandcastle/rescue-20261016-185533
sandcastle/rescue-20261016-191907
sandcastle/rescue-20261016-192219
sandcastle/worker/20261016-155725-c51ed1
agent/issue-195
agent/issue-196
agent/issue-197
agent/issue-198
agent/issue-200
agent/issue-203
agent/issue-205
agent/issue-206
agent/issue-207
agent/issue-209
agent/issue-213
agent/issue-216
agent/issue-217
agent/issue-218
agent/issue-222
agent/issue-238
agent/issue-208
sandcastle/worker/20261016-155833-1b8f77
agent/issue-241
agent/issue-230
agent/issue-239
land/issue-193
forward-port/idss-2048
backport/idss-2048
agent/issue-237
agent/issue-225
agent/issue-193
agent/issue-176
backport/1717-unclaimed-commit-gate
backport/1733-drive-yield-runlog
fix/159-rehearsal-report-token-leak
fix/157-ready-list-standdown
fix/154-verdict-no-match-trap
factory-floor-visual-rework
landing-shell-guard
No results found.
Labels
Clear labels
agent-blocked
Sandcastle hit a blocker — human resolves it, then re-adds ready-for-agent
agent-working
Claimed by a live swarm run — other hosts skip it
bug
Something is broken
deferred
Ruled defer-with-criteria: parked until a revisit criterion in the issue body fires
enhancement
New feature or improvement
landing-pr
Additive: this ticket lands ONLY by a PR with screenshots (or a waiver) that a human merges — ADR 0265. Only a human removes it.
model-haiku
Per-ticket model override (additive): run this ticket on the cheap/fast model
model-opus
Per-ticket model override (additive): run this ticket on the top-tier model
model-sonnet
Per-ticket model override (additive): run this ticket on the mid-tier model
needs-info
Waiting on reporter for more information
needs-triage
Maintainer needs to evaluate this issue
no-triage
Escape hatch: triage automation must skip this issue
priority
Additive urgency marker — the swarm queue works these first
ready-for-agent
Fully specified, ready for an AFK agent
ready-for-human
Needs the human's hands, eyes, or a one-way-door ruling (ADR 0174)
ready-for-session
Needs an interactive agent session (host creds/protected paths/live doors), not the human (ADR 0174)
wontfix
Will not be actioned
No labels
agent-blocked
agent-working
bug
deferred
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-info
needs-triage
no-triage
priority
ready-for-agent
ready-for-human
ready-for-session
wontfix
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
Matou/dev-factory#35
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 #3 (host state is factory-owned, ADR 0004) — Ben's observation on that ticket:
#3 gave this question a home and deliberately did not answer it: the ownership move renders today's cadences unchanged so it stays behaviour-preserving. ADR 0004 point 6 records the lock namespace as host state owned by
host-capacity-lib.sh, and the host registry (~/swarm/host-registry.conf) now declares which repos are enrolled and which of them run a session-runner — the input an arbiter needs.What's needed
host_capacity_acquire_heavyshape), or a round-robin/oldest-waiting pick across the registry's enrolled repos.host-capacity-lib.sh's header rule: yield, exit 0, next tick re-fires).onboarding/host-state-lib.shis factory-only (vendor-excluded), so a vendored consumer'ssession-runner.shcannot source it today. Either lift a registry READER into a root vendored lib (ADR 0004's "Alternatives considered" names this as the expected first reason to), or have the rendered cron line pass the fairness inputs in.SESSION_RUNNER=on|offpolicy (#6's ruling) deciding who is in the rotation, and withMatou/idss#577's host-scheduling design.Same shape as the swarm's capacity question (idss #577 / ADR 0184) — the lock is a host resource, not a repo's.
Ruled by agent under ADR 0174 — veto anytime
This ticket asks for a mechanism choice ("pooled slot count, or round-robin across the registry's enrolled repos") and for where an arbiter reads the enrolled set from. Both are two-way doors, so triage rules rather than parks.
The ruling
Neither. Repo-scope session-runner's host-global state, and let the existing 2-slot host capacity pool remain the sole host-wide arbiter. No fairness arbiter, no registry reader, no new mechanism.
The reasoning is in the code.
session-runner.sh:93-94takes/tmp/matou-session-runner.lock— one path for the whole host — and only then, atsession-runner.sh:105-116, joins the shared 2-slot pool viahost_capacity_acquire_heavy. So the host-wide arbitration already exists and is already correct; the starvation Ben observed comes entirely from the extra host-global lock taken in front of it. Making that lock repo-scoped (/tmp/matou-session-runner-<repo-slug>.lock) preserves its actual intent — one session per repo — and hands host-wide contention to the pool that was built for exactly this (host-capacity-lib.sh:1-26, sized at 2 by the #577 / ADR 0184 ruling).This answers all three bullets of "What's needed":
flock -nthenexit 0atsession-runner.sh:94and:116.onboarding/host-state-lib.shinto a vendored root lib, and this ticket therefore does not block on #3.Two same-commit siblings, same root cause
Repo-scoping the lock alone would leave two more host-global stores keyed per-repo, and one of them is an outright bug:
SESSION_RUNNER_STATE(session-runner.sh:47,$HOME/.local/state/matou-session-runner) is host-global, but its fail counters are keyed by issue number alone —fail-$n/attempt-$n(:163,:169,:258-259). Issue numbers are per-repo. So on a two-repo host, repo A's issue 3 failing twice escalates repo B's issue 3 toagent-blocked(:266) with a Mattermost alarm naming a ticket nobody touched. Same defect class as #36, different store. The rate-limit stamps (alarm-$sig,:71) collide the same way: repo B's dead-tick alarm is suppressed by repo A's stamp.SESSION_RUNNER_DRIVE_DEFER_COUNT(:112) is one host-global path, so the "skipped N consecutive tick(s)" streak that #664 exists to make legible counts two repos' ticks as one repo's.Fix all three in one commit. Splitting them means two tickets editing the same defaults block.
Why this is a two-way door
Three default values in one
: "${VAR:=…}"block, revertible by a one-line commit. Nothing on the one-way-door list: no credentials, no security-posture widening, no member-facing trust accept, no data destruction, no spend. Total host heavy-concurrency is unchanged — still capped at 2 by the pool, because the pool's slot paths are stable and pin-independent.What proves it
tests/session-runner-test.sh— new case: twoREPO_SLUGs resolve to two distinct lock paths and both ticks reach the pool; a second tick of the same repo is still absorbed.tests/host-capacity-lib-test.sh— already proves the 2-slot cap and no-camp yield (host-capacity-lib-test.sh:32-67); unchanged and must stay green.tests/swarm-lock-yield-test.sh— unchanged.Residual, stated honestly
With more session-runner repos than pool slots, contention moves to the pool, which is first-fit with no rotation — so cross-repo waiting is not eliminated in general. What it stops is the specific failure reported: one repo monopolising a host-global lock for a whole
SESSION_RUNNER_TIMEOUT(2 h) while the pool sits half free. Rotation across all heavy consumers isMatou/idss#577's host-scheduling design, not session-runner's private lock, and it should not be reinvented here.Agent brief
Goal. No repo's session-runner can starve another's, and no repo's state can be attributed to another's issue numbers.
Change (
session-runner.sh, root — not.sandcastle/)::50— defaultSESSION_RUNNER_LOCKto a repo-scoped path derived fromREPO_SLUG(already sourced at:45). Sanitise the slug:/cannot appear in a filename.:47— same forSESSION_RUNNER_STATE, sofail-$n/attempt-$n/alarm-$sigare per-repo.:112— same forSESSION_RUNNER_DRIVE_DEFER_COUNT.:20— the example cron line in the header comment names/home/dev/swarm/rehearsal-env.shandMatou/idss. Per CLAUDE.md's blast-radius rule no harness file carries a repo name or a host path, even illustratively. Generalise it. (The env path itself is #37's subject; only the comment is in scope here.)${VAR:=…}override form — a caller pinning the old path must still win.Constraints.
swarm-identity.shis sourced at:45, soREPO_SLUGis available before:47and:50. Do not move the identity source, and do not add a new symbol to the consumer-owned identity file — GOTCHAS 12 is exactly that hazard (identity_requireat:85-90is the guard).fail-*/attempt-*under the old dir; after the change those are simply orphaned, which is the correct outcome (they carry no repo attribution). Say so in the commit message — do not write a migration..sandcastle/session-runner.sh.Acceptance. The tests above, plus the full offline suite:
for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; doneSTATUS.mdupdated in the same commit (CLAUDE.md).Ben — if you want the round-robin arbiter instead, or want the state-dir sibling split into its own ticket, say so and this reverts to
needs-triage.Ruled by agent under ADR 0174 — veto anytime.
Ruling: DEFERRED. The ticket cites "ADR 0004 point 6" as an already-settled
ruling and assumes
onboarding/host-state-lib.shand a~/swarm/host-registry.confreader already exist. Neither is present inthis repo yet —
docs/adr/stops at 0003,onboarding/host-state-lib.shdoesn't exist, and no tracked file references
host-registry.conf. Theprerequisite work is #3 (host-state ownership move — still open,
ready-for-session) and #6 (host registry + enrolment — still open,ready-for-session). This ticket's own "decide the mechanism" and "wherethe arbiter reads from" questions can't be answered against infrastructure
that doesn't exist yet, so an agent picking this up today would be building
against a fiction.
Why two-way door: purely a sequencing call, reversible the moment #3/#6
land — re-triage picks it back up, nothing is committed now.
What proves it:
grep -rl host-registry.conf .andls onboarding/host-state-lib.shboth come up empty in this repo today; eitherlanding (the file appearing, or
docs/adr/0004-*.mdexisting) is therevisit trigger.
Ruled: DEFERRED
Revisit when:
onboarding/host-state-lib.sh(or an equivalentregistry-reader lib) exists AND
~/swarm/host-registry.conf's format iscommitted to this repo (via #6), OR
docs/adr/0004-*.mdlands (via #3) —whichever first gives this ticket a real registry to read.
Ruled by: agent, under ADR 0174, during headless
/triage, 2026-08-23.Note for whoever revisits: once unblocked, the mechanism choice
(pooled-slot vs. round-robin) and the registry-reader placement are
themselves two-way-door calls the assigned agent can rule under ADR 0174
when picking this up — mirroring how #25 ruled ADR 0003 for the analogous
per-host
DRIVE_EXCLUSIVEquestion. This looks code-shaped (ahost-capacity-lib.sh-style arbiter, offline-testable) rather thansession-shaped, unlike #3/#6/#37.
Marked as blocked by #3 and #6 via Forgejo's issue dependencies.
Agent Brief
Category: enhancement
Summary: The session-runner's host-global lock lets one enrolled repo's in-flight session starve every other repo's ticks.
Current behavior:
SESSION_RUNNER_LOCKdefaults to a single host-global path (/tmp/matou-session-runner.lock). Every enrolled repo'ssession-runner.shtick takes the same lock non-blocking (flock -n) and exits immediately ("session in flight — tick absorbed") when it's held. With two or more repos' session-runners on one host, whichever repo's session is in flight blocks every other repo's tick for up to a wholeSESSION_RUNNER_TIMEOUT(2h), with no rotation — confirmed live on matou-workstation (ADR 0004 point 6, and the observation quoted on #3).Desired behavior: No single enrolled repo can indefinitely starve another's session-runner. Either a pooled slot count for session-runners (same shape as
host_capacity_acquire_heavyinhost-capacity-lib.sh) or a round-robin/oldest-waiting pick across the host's enrolled repos — implementer's choice; both satisfy the fairness goal and either is a revertible two-way door. Whichever mechanism is chosen, a repo that loses the arbitration must still never camp: it yields and exits 0, and the same or next tick re-fires, perhost-capacity-lib.sh's existing yield contract.Key interfaces:
session-runner.sh's lock acquisition (SESSION_RUNNER_LOCK/flock) — needs to become fairness-aware instead of a single first-come host-global mutex.host-registry.confand parsed byonboarding/host-state-lib.sh(ADR 0004), which is factory-only/vendor-excluded, so a vendored consumer'ssession-runner.shcannot source it directly today. Per ADR 0004's "Alternatives considered", this ticket is the expected first case for lifting a registry READER into a root vendored lib — or, alternatively, have the rendered cron line pass the fairness inputs (enrolled repo list / slot count) in as arguments or env.SESSION_RUNNER=on|offkill switch (#6), which decides who is in the rotation; this ticket decides how the repos that are in share the lock.Acceptance criteria:
SESSION_RUNNER_TIMEOUT— it gets a fair turn within a bounded time (implementer documents the bound chosen).tests/session-runner-test.shor a new test) exercises the multi-repo fairness case.Out of scope:
SESSION_RUNNER=on|offenrollment policy itself (#6).Matou/idss#577's broader host-scheduling/capacity design — scoped here to the session-runner lock specifically (ADR 0004 point 6)./tmp/matou-swarm.lock(the worker pool lock) — this ticket is about the session-runner lock only.Verification: Confirmed by reading
session-runner.shdirectly:SESSION_RUNNER_LOCKdefaults to the single path/tmp/matou-session-runner.lock, taken via non-blockingflock, no repo-fairness logic present. ADR 0004 (landed closing #3 immediately prior to this triage pass) confirms this was deliberately left unruled as policy rather than ownership, and names this ticket as the follow-up and the likely first vendored reader of the new host registry.Correction — my "DEFERRED" ruling above is withdrawn
A second
/triagepass ran concurrently with this one and reached theissue first with a materially better ruling — I'm retracting mine in its
favour rather than leaving both standing.
My deferred ruling assumed a fairness arbiter needed a registry reader that
doesn't exist. The correct ruling (posted earlier in this thread) sidesteps
that entirely: the starvation is caused by
session-runner.sh'shost-global lock taken in front of the existing 2-slot host capacity
pool, not by a missing arbiter. Repo-scoping that lock (and its
SESSION_RUNNER_STATE/defer-count siblings, same root cause) fixes itusing infrastructure that already exists — no registry, no dependency on
#3/#6 at all.
I've also independently confirmed #3 landed (
docs/adr/0004-*.md,onboarding/host-state-lib.shnow onorigin/main) partway through thistriage run, which is a second, independent reason my "ADR 0004 doesn't
exist yet" premise no longer held even on its own terms.
Removed the
deferredlabel and the#3/#6dependency links I'd added.The correct state is the one already on the issue:
ready-for-agent, perthe earlier ruling and agent brief in this thread.
swarm-claim host=elitebook-distributed-server-03 run=237
(automated multi-host claim — lowest live claim id works this ticket)
Correction: the "blocked by #6" dependency is wrong
This ticket carries a native Forgejo dependency on #6 ("onboard-host:
host registry + idempotent machine enrolment"), added by a concurrent
triage pass that conflated two different registries.
#6's own body describes a different registry — the worker-pool
capacity/scheduling registry (
hosts/<name>.conf) feedingMatou/ourcloud#577's semaphore — and explicitly excludes host-stateownership: "Moving existing hosts' state wholesale — that's #3; this
ticket must not fight it, only converge." The registry this ticket (#35)
actually needs for its fairness arbiter — the enrolled-repo/session set —
is the one #3 already shipped (
host-registry.conf'srepo/sessiondirectives, parsed by
onboarding/host-state-lib.sh, ADR 0004, landed onmain). #6 is unrelated to what #35 needs.(Separately, the earlier comment on this ticket proposing to repo-scope
the session-runner's lock rather than build a registry-reading arbiter at
all — sidestepping the registry question entirely — looks like the
stronger fix; worth the assigned agent weighing both options against each
other rather than this comment picking a winner.)
Net effect: #35 is not blocked by #6. Its closed dependency on #3 is
harmless (closed dependencies don't block the picker). The
ready-for-agentlabel already on this ticket is correct and unblocked today.
Attempted fix, didn't land: tried removing the #6 dependency via
Forgejo's
DELETE /issues/{index}/dependenciesAPI (the documentedIssueMeta{index,owner,repo}body). It 500s with an empty message on thisinstance (gitea 1.22.0-based) — reproduced on a control case with the same
failure, so this is a platform bug, not a payload mistake.
What this means operationally:
list-ready-tasks.shandsession-runner.shboth skip a ticket with an open dependency, so untilthis stray edge is removed, #35 will not actually surface to the swarm
despite carrying the correct
ready-for-agentlabel.Ben — this needs your hands only because the tooling to fix it via API is
broken, not because of any judgement call; the correction itself (#35 is
not blocked by #6) stands under ADR 0174 as a two-way door, proven by #6's
own "explicitly out of scope" section and #3's already-landed ADR 0004.
close-report for #35 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope
rehearsal-env.sh(idss #719) #44