A ticket being worked is still listed ready after a refused close — schedulers re-dispatch it every marker TTL #375

Closed
opened 2026-11-19 23:17:57 +00:00 by ben · 1 comment
Owner

What happened

Matou/policy-generators#64 was claimed by bens-mac-04 at 22:03:09Z on 2026-11-19 (swarm-claim host=bens-mac-04 run=760) and worked there for 4497 s, until 23:17Z. For most of that time the ticket was listed as ready fleet-wide while it was being worked:

  • At 22:27Z its labels were enhancement, ready-for-agent — no agent-working — 24 minutes into the run.
  • The run's close was refused three times by the close-report gates (22:35, 22:50, 23:05, reviewer reject/reject/malformed) before passing at 23:15. The same run kept working between refusals.
  • Every scheduler saw it as the fleet head and dispatched it again: elitebook-03's and bens-mac-04's own ticks reached "4 consecutive unclaimed dispatch(es)" on it before 22:44Z, and the live dispatcher dispatched it to bens-mac-04 at 22:45:04, 22:55:06, 23:05:24 and 23:15:37Z — once per 600 s marker TTL, each correctly skipped in between (#365).
  • None of those dispatches could be claimed (run 760 held the lowest live claim). On matou-workstation the backstop legs went further: runs 760/768/778 started a sandbox, found "nothing claimed for me this iteration", and ended after ~2 min each (reason=completed, 108–122 s).

Not established

Which step put ready-for-agent back (or never removed it) while the run still held the ticket. The refused close is the obvious suspect; #113 earlier the same day also showed agent-working and ready-for-agent together.

Why it matters

Under a live dispatcher (fleet-wide since 22:44:53Z, #357) a ticket in this state is re-offered every marker TTL for as long as it is being worked, takes a free slot's offer each pass, and costs a wasted leg per dispatch plus a wasted sandbox start per backstop leg.

Acceptance

  • A ticket that a live run holds (a live swarm-claim, or work in progress after a refused close) is not in the fleet ready list, shown by an offline test over the lister / fleet collect.
  • The cause of the label state is named.
## What happened `Matou/policy-generators#64` was claimed by `bens-mac-04` at 22:03:09Z on 2026-11-19 (`swarm-claim host=bens-mac-04 run=760`) and worked there for 4497 s, until 23:17Z. For most of that time the ticket was listed as **ready** fleet-wide while it was being worked: - At 22:27Z its labels were `enhancement, ready-for-agent` — no `agent-working` — 24 minutes into the run. - The run's close was refused three times by the close-report gates (22:35, 22:50, 23:05, reviewer `reject`/`reject`/`malformed`) before passing at 23:15. The same run kept working between refusals. - Every scheduler saw it as the fleet head and dispatched it again: `elitebook-03`'s and `bens-mac-04`'s own ticks reached "4 consecutive unclaimed dispatch(es)" on it before 22:44Z, and the live dispatcher dispatched it to `bens-mac-04` at 22:45:04, 22:55:06, 23:05:24 and 23:15:37Z — once per 600 s marker TTL, each correctly skipped in between (#365). - None of those dispatches could be claimed (run 760 held the lowest live claim). On `matou-workstation` the backstop legs went further: runs 760/768/778 started a sandbox, found "nothing claimed for me this iteration", and ended after ~2 min each (`reason=completed`, 108–122 s). ## Not established Which step put `ready-for-agent` back (or never removed it) while the run still held the ticket. The refused close is the obvious suspect; `#113` earlier the same day also showed `agent-working` and `ready-for-agent` together. ## Why it matters Under a live dispatcher (fleet-wide since 22:44:53Z, #357) a ticket in this state is re-offered every marker TTL for as long as it is being worked, takes a free slot's offer each pass, and costs a wasted leg per dispatch plus a wasted sandbox start per backstop leg. ## Acceptance - A ticket that a live run holds (a live `swarm-claim`, or work in progress after a refused close) is not in the fleet ready list, shown by an offline test over the lister / fleet collect. - The cause of the label state is named.

close-report (#375) — landed on main as b6e875a (push mode).

What landed

list-ready-tasks.sh’s full-page path — the host-side fleet collect (fleet-queue-lib.sh:fleet_queue_collect), where re-dispatch originates — now drops a candidate a live run holds even when its agent-working label is missing. It reads each unblocked candidate’s comments plus the alive-runs snapshot (claim_alive_runs, sourced from claim-lib.sh) inside the existing 10-wide dependency xargs worker, and excludes a ticket carrying a live swarm-claim: a session claim within its embedded session-ttl (#348), or a swarm claim whose run is in the snapshot (which is also the “work in progress after a refused close” case — the run is still alive). Fail-OPEN throughout (a faulted alive poll ⇒ empty set ⇒ no swarm claim dropped; a faulted comments read ⇒ ticket surfaces), so a tracker blip can only surface work, never starve the queue; the claim walk (claim-next-task.sh) remains the real race-resolver. The single-issue fast path is byte-identical (that run’s one host-picked ticket is settled by the walk), and the alive snapshot is read lazily so an idle repo’s collect pays nothing.

The cause of the label state (acceptance point 2)

The ready list hid a claimed ticket by the agent-working LABEL alone, which is a separate, non-atomic tracker write from the authoritative swarm-claim comment (the real leader-election marker — claim-lib.sh: “the LOWEST claim whose run is still in progress wins”). Three paths open a gap where the comment is live but the label is absent: claim_mark_working is applied with claim-next-task.sh’s claim_mark_working "$num" || true, so a label write that 403s/times out is swallowed while the run keeps the claim and works on; a refused close leaves the labels untouched; and a reopened stranded close can drop it (#366). policy-generators#64 wore ready-for-agent with no agent-working from 24 min in — before the first refused close — while run 760 was demonstrably alive and held the lowest live claim, which fits the swallowed/missing label-write, not the refused close. The lister never consulted the comment, so the queue disagreed with the claim. (The || true is itself correct — a won claim should proceed even if the label blips, because the comment is authoritative — so the fix makes the lister honour the authoritative marker rather than tighten that swallow.)

Proof

  • tests/list-ready-tasks-test.sh — 47 cases green (+7 for #375): a live session claim and a live swarm claim (run in the snapshot) are both hidden; a stale tombstone (dead run, no ttl), an expired session claim, and a no-claim ticket all surface; the fail-open case (ACTIONS_HTTP=000) surfaces the swarm-claimed ticket while the age-based session arm still hides it. The lister is the engine fleet_queue_collect runs per repo, so the fleet-collect path is covered transitively.
  • claim-lib, claim-next-task, fleet-queue-lib, fleet-queue, collector, docs-budget green; full offline suite green (0 fails).

Commits

  • b6e875a sandcastle: #375 — a live-claimed ticket with no agent-working label no longer stays in the fleet ready list

Added GOTCHAS #375 (docs/gotchas/375-…md + index row), docs/journal/2026-11-19-375.md, and a STATUS.md surface row. Owed: a re-vendor (onboarding/onboard.sh vendor .sandcastle <sha>, GOTCHAS 4) to carry the lister change into the running .sandcastle/ copy + consumers — until then this repo’s own collect still keys on the label alone.

Ruled by agent under ADR 0174 — two-way door (a revertible lister change, proven by the offline test), veto anytime.

**close-report (#375)** — landed on `main` as `b6e875a` (push mode). ## What landed `list-ready-tasks.sh`’s full-page path — the host-side fleet collect (`fleet-queue-lib.sh:fleet_queue_collect`), where re-dispatch originates — now drops a candidate a **live run holds** even when its `agent-working` label is missing. It reads each unblocked candidate’s comments plus the alive-runs snapshot (`claim_alive_runs`, sourced from `claim-lib.sh`) inside the existing 10-wide dependency xargs worker, and excludes a ticket carrying a **live `swarm-claim`**: a session claim within its embedded `session-ttl` (#348), or a swarm claim whose run is in the snapshot (**which is also the “work in progress after a refused close” case** — the run is still alive). Fail-OPEN throughout (a faulted alive poll ⇒ empty set ⇒ no swarm claim dropped; a faulted comments read ⇒ ticket surfaces), so a tracker blip can only surface work, never starve the queue; the claim walk (`claim-next-task.sh`) remains the real race-resolver. The single-issue fast path is byte-identical (that run’s one host-picked ticket is settled by the walk), and the alive snapshot is read lazily so an idle repo’s collect pays nothing. ## The cause of the label state (acceptance point 2) The ready list hid a claimed ticket by the **`agent-working` LABEL alone**, which is a **separate, non-atomic tracker write** from the authoritative `swarm-claim` comment (the real leader-election marker — `claim-lib.sh`: “the LOWEST claim whose run is still in progress wins”). Three paths open a gap where the comment is live but the label is absent: `claim_mark_working` is applied with `claim-next-task.sh`’s `claim_mark_working "$num" || true`, so a label write that 403s/times out is swallowed while the run keeps the claim and works on; a refused close leaves the labels untouched; and a reopened stranded close can drop it (#366). `policy-generators#64` wore `ready-for-agent` with **no** `agent-working` from 24 min in — *before* the first refused close — while run 760 was demonstrably alive and held the lowest live claim, which fits the swallowed/missing label-write, not the refused close. The lister never consulted the comment, so the queue disagreed with the claim. (The `|| true` is itself correct — a won claim should proceed even if the label blips, because the comment is authoritative — so the fix makes the lister honour the authoritative marker rather than tighten that swallow.) ## Proof - `tests/list-ready-tasks-test.sh` — **47 cases green** (+7 for #375): a live session claim and a live swarm claim (run in the snapshot) are both hidden; a stale tombstone (dead run, no ttl), an expired session claim, and a no-claim ticket all surface; the fail-open case (`ACTIONS_HTTP=000`) surfaces the swarm-claimed ticket while the age-based session arm still hides it. The lister is the engine `fleet_queue_collect` runs per repo, so the fleet-collect path is covered transitively. - `claim-lib`, `claim-next-task`, `fleet-queue-lib`, `fleet-queue`, `collector`, `docs-budget` green; **full offline suite green (0 fails)**. ## Commits - `b6e875a` sandcastle: #375 — a live-claimed ticket with no agent-working label no longer stays in the fleet ready list Added GOTCHAS #375 (`docs/gotchas/375-…md` + index row), `docs/journal/2026-11-19-375.md`, and a STATUS.md surface row. **Owed: a re-vendor (`onboarding/onboard.sh vendor .sandcastle <sha>`, GOTCHAS 4)** to carry the lister change into the running `.sandcastle/` copy + consumers — until then this repo’s own collect still keys on the label alone. Ruled by agent under ADR 0174 — two-way door (a revertible lister change, proven by the offline test), veto anytime.
matou-build-agent 2026-11-19 23:47:43 +00:00
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/dev-factory#375
No description provided.