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

Closed
opened 2026-09-12 04:46:09 +00:00 by ben · 2 comments
Owner

Symptom

#1373 sat unworked for over an hour while unblocked and ready-for-session. The
elitebook-distributed-server-03 runner picked it three times and stood down every time:

04:29:11Z session-runner: picked #1373 — portal: the whole member journey proven by drive …
04:29:31Z session-runner: #1373 — a peer host's claim outranks ours (#125); standing down before the session (a lost race is not a failed attempt)
04:39:09Z session-runner: picked #1373 …
04:39:15Z session-runner: #1373 — a peer host's claim outranks ours (#125); standing down …

Cause — the peer is dead and has been for over an hour

The only claim on the issue is a single comment:

2026-09-12T02:43Z  swarm-claim host=bens-mac-04 run=1868074
(automated multi-host claim — lowest live claim id works this ticket)

That session ended at ~03:19Z — its agent-working label was removed and the ticket
returned to ready-for-session. On bens-mac-04 there 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, no agent-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)

  • Give a claim a TTL and treat an older one as expired, the way
    HOST_CAPACITY_DRIVE_WANTED_TTL already treats a stale drive reservation (900s there).
    A session is bounded by timeout 7200, so a claim older than that cannot be live.
  • Or make the claim verifiable: the claimant re-stamps it while alive, and a stale stamp is
    ignored rather than obeyed.
  • Or have the standing-down host escalate after N consecutive lost races on the same ticket,
    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).

## Symptom `#1373` sat unworked for over an hour while **unblocked and `ready-for-session`**. The `elitebook-distributed-server-03` runner picked it three times and stood down every time: ``` 04:29:11Z session-runner: picked #1373 — portal: the whole member journey proven by drive … 04:29:31Z session-runner: #1373 — a peer host's claim outranks ours (#125); standing down before the session (a lost race is not a failed attempt) 04:39:09Z session-runner: picked #1373 … 04:39:15Z session-runner: #1373 — a peer host's claim outranks ours (#125); standing down … ``` ## Cause — the peer is dead and has been for over an hour The only claim on the issue is a single comment: ``` 2026-09-12T02:43Z swarm-claim host=bens-mac-04 run=1868074 (automated multi-host claim — lowest live claim id works this ticket) ``` That session **ended at ~03:19Z** — its `agent-working` label was removed and the ticket returned to `ready-for-session`. On `bens-mac-04` there 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`, no `agent-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) - Give a claim a **TTL** and treat an older one as expired, the way `HOST_CAPACITY_DRIVE_WANTED_TTL` already treats a stale drive reservation (900s there). A session is bounded by `timeout 7200`, so a claim older than that cannot be live. - Or make the claim **verifiable**: the claimant re-stamps it while alive, and a stale stamp is ignored rather than obeyed. - Or have the standing-down host **escalate after N consecutive lost races on the same ticket**, 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 (the swarm-claim comment writer at :171, and claim_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. Relabelling ready-for-agent → ready-for-session so 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.

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` (the `swarm-claim` comment writer at `:171`, and `claim_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. Relabelling `ready-for-agent` → `ready-for-session` so 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-claim comment (#125) is a leader-election marker that nothing expires. While a ticket carries agent-working the swarm's janitor_sweep and the session-runner's #63 stale-claim sweep reap a dead run's claim — but the instant the ticket returns to ready-for-session both sweeps stop visiting it (each filters on agent-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_alive built 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_TTL for a stale drive reservation):

  • New claim_fresh_runs <issue> <max_age> [<now>] (.sandcastle/claim-lib.sh) returns only the runs whose claim comment is younger than max_age (age from created_at via jq fromdateiso8601 — portable, now injectable for hermetic tests; a missing/unparseable stamp is kept fail-closed; an API failure is rc 1, never a degraded []).
  • session-runner.sh builds its arbitration alive-set from claim_fresh_runs "$pick" "$SESSION_RUNNER_CLAIM_TTL" (default SESSION_RUNNER_TIMEOUT + SESSION_RUNNER_STALE_SLACK — the same ceiling the #63 sweep already uses to prove a claim dead; a session is bounded by timeout 7200, so a claim that has outlived it cannot be live). A tombstone drops out of the set → claim_won skips 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):

  • Upstream Matou/dev-factory 26f96ce (these are FACTORY_MANIFEST-vendored, ADR 0180); re-vendored into idss 118681e2 (FACTORY_REF 26f142c → 26f96ce, which also carries dev-factory #141's landing-lib.sh rescue-ladder fix — an unavoidable intervening-commit pull). check-harness-drift.sh OK.
  • 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.sh 24d: a TTL-expired lower-id tombstone on the ticket no longer blocks the win — the host wins and works the ticket (drives the real session-runner.sh). tests/run-swarm-landing-test.sh 10 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).

## Close report (session-runner under ADR 0174) **Fixed.** A `swarm-claim` comment (#125) is a leader-election marker that nothing expires. While a ticket carries `agent-working` the swarm's `janitor_sweep` and the session-runner's #63 stale-claim sweep reap a dead run's claim — but the instant the ticket returns to `ready-for-session` **both sweeps stop visiting it** (each filters on `agent-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_alive` built 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_TTL` for a stale drive reservation):** - New `claim_fresh_runs <issue> <max_age> [<now>]` (`.sandcastle/claim-lib.sh`) returns only the runs whose claim comment is **younger** than `max_age` (age from `created_at` via jq `fromdateiso8601` — portable, `now` injectable for hermetic tests; a missing/unparseable stamp is kept **fail-closed**; an API failure is rc 1, never a degraded `[]`). - `session-runner.sh` builds its arbitration alive-set from `claim_fresh_runs "$pick" "$SESSION_RUNNER_CLAIM_TTL"` (default `SESSION_RUNNER_TIMEOUT + SESSION_RUNNER_STALE_SLACK` — the same ceiling the #63 sweep already uses to prove a claim dead; a session is bounded by `timeout 7200`, so a claim that has outlived it cannot be live). A tombstone drops out of the set → `claim_won` skips 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):** - Upstream `Matou/dev-factory` `26f96ce` (these are FACTORY_MANIFEST-vendored, ADR 0180); re-vendored into idss `118681e2` (**FACTORY_REF `26f142c` → `26f96ce`**, which also carries dev-factory #141's `landing-lib.sh` rescue-ladder fix — an unavoidable intervening-commit pull). `check-harness-drift.sh` OK. - `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.sh` **24d**: a TTL-expired lower-id tombstone on the ticket no longer blocks the win — the host wins and works the ticket (drives the real `session-runner.sh`). `tests/run-swarm-landing-test.sh` 10 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).
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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/idss#1412
No description provided.