swarm claims are tombstones: a dead peer session's claim blocks every other host from a ticket FOREVER (#1373 sat ready-for-session for an hour) #1412
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#1412
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
#1373sat unworked for over an hour while unblocked andready-for-session. Theelitebook-distributed-server-03runner picked it three times and stood down every time:Cause — the peer is dead and has been for over an hour
The only claim on the issue is a single comment:
That session ended at ~03:19Z — its
agent-workinglabel was removed and the ticketreturned to
ready-for-session. Onbens-mac-04there is now no session-runner process at all(
pgrep -f "timeout 7200 claude"→ 0). The claim comment is a tombstone, and "lowest live claim id"has no way to tell it is not live, so every other host defers to it forever.
The ticket is therefore permanently unworkable by the swarm until a human intervenes, while
appearing perfectly healthy: open, unblocked,
ready-for-session, noagent-blocked.Why it is worth fixing rather than sweeping by hand
This is not specific to #1373. Any session that dies, is killed, times out, or loses its host
between claiming and finishing leaves a permanent tombstone on its ticket. The failure is silent in
both directions: the stuck ticket looks ready, and the standing-down hosts log a lost race, which
reads as normal contention rather than a fault.
Suggested shape (not a ruling)
HOST_CAPACITY_DRIVE_WANTED_TTLalready treats a stale drive reservation (900s there).A session is bounded by
timeout 7200, so a claim older than that cannot be live.ignored rather than obeyed.
so a tombstone surfaces instead of silently parking the work forever.
Whichever shape, a host that stands down repeatedly against the same claim id should say so
louder than "a lost race is not a failed attempt".
Right now
#1373 is being driven by hand from elitebook meanwhile, so the Portal arc is not waiting on
this. The stale claim comment on #1373 can be left as evidence.
Found 2026-09-12 while babysitting the Portal map's last ticket (#1336).
Swarm agent standing down — this fix lands in a protected path and a swarm agent cannot make it.
The tombstone/claim logic described here lives entirely in
.sandcastle/claim-lib.sh(theswarm-claimcomment writer at:171, andclaim_won"mine is lowest live claim" at:189). Any TTL / liveness / re-stamp / escalate-after-N-lost-races shape all edits.sandcastle/**, which is a protected path (#445): the pre/post tree-fingerprint rolls back any protected-path change and reds the run, so a swarm iteration structurally cannot ship this.Per rule 9 / ADR 0174, a
.sandcastle/machinery change needs an interactive session's standing, not the agent swarm. Relabellingready-for-agent→ready-for-sessionso it stops looping through the agent queue (where every iteration would pick it, fail to touch the protected path, and stand down — ironically the same silent-loop failure mode this ticket is about).No swarm claim was held on this issue, so nothing to release.
Close report (session-runner under ADR 0174)
Fixed. A
swarm-claimcomment (#125) is a leader-election marker that nothing expires. While a ticket carriesagent-workingthe swarm'sjanitor_sweepand the session-runner's #63 stale-claim sweep reap a dead run's claim — but the instant the ticket returns toready-for-sessionboth sweeps stop visiting it (each filters onagent-working), so a dead peer's claim becomes a permanent tombstone. The session-runner's cross-host arbitration counted every present claim as a live contender (sr_alivebuilt from every comment's run), so one tombstone with a lower comment id outranked every future live claim under lowest-id-wins — exactly the #1373 wedge (open, unblocked,ready-for-session, yet unworkable, each host logging only "a lost race is not a failed attempt").Shape (the ticket's first suggestion — a claim TTL, like
HOST_CAPACITY_DRIVE_WANTED_TTLfor a stale drive reservation):claim_fresh_runs <issue> <max_age> [<now>](.sandcastle/claim-lib.sh) returns only the runs whose claim comment is younger thanmax_age(age fromcreated_atvia jqfromdateiso8601— portable,nowinjectable for hermetic tests; a missing/unparseable stamp is kept fail-closed; an API failure is rc 1, never a degraded[]).session-runner.shbuilds its arbitration alive-set fromclaim_fresh_runs "$pick" "$SESSION_RUNNER_CLAIM_TTL"(defaultSESSION_RUNNER_TIMEOUT + SESSION_RUNNER_STALE_SLACK— the same ceiling the #63 sweep already uses to prove a claim dead; a session is bounded bytimeout 7200, so a claim that has outlived it cannot be live). A tombstone drops out of the set →claim_wonskips it → a live claim can win; a genuinely live peer's fresh claim still wins the race; a forge blip building the set falls back to today's behaviour (never a wedge).Landed & proven (two-way door):
Matou/dev-factory26f96ce(these are FACTORY_MANIFEST-vendored, ADR 0180); re-vendored into idss118681e2(FACTORY_REF26f142c→26f96ce, which also carries dev-factory #141'slanding-lib.shrescue-ladder fix — an unavoidable intervening-commit pull).check-harness-drift.shOK.tests/claim-lib-test.sh+9 checks (76 total): tombstone dropped / fresh kept / un-ageable kept / malformed skipped; the before-vs-after wedge (the old every-claim-live set lets the lower-id tombstone win, the TTL-filtered set lets the live claim win); a real live lower-id race still won; an API failure rc 1.tests/session-runner-test.sh24d: a TTL-expired lower-id tombstone on the ticket no longer blocks the win — the host wins and works the ticket (drives the realsession-runner.sh).tests/run-swarm-landing-test.sh10 scenarios green.Not done / follow-ups (deliberately out of scope, filed as suggestions #2/#3 in the ticket): the claim is not re-stamped while alive, and a host is not (yet) made to escalate louder after N consecutive lost races against the same claim id — the TTL alone closes the "forever" wedge (a tombstone is ignored after
TTL, ~timeout+slack), so those are refinements, not the bug. Deferring them is itself a two-way door.Ruled by agent under ADR 0174 — veto anytime. Proof: the offline suites above (red against the old builder, green against the new).