claim-next-task: standing-drive blockers claim before backlog, and the drive-reservation guard admits the worker that would unblock the reserving drive #24

Closed
opened 2026-08-23 03:27:26 +00:00 by matou-build-agent · 2 comments

Symptom (2026-08-22, swarm-gridlock review)

idss #668 — a bug + priority + rehearsal-183 ticket the rehearsal reporter filed as the blocker of standing drive #652 on elitebook-03 — was filed 15:07Z and not claimed until 16:16Z. The fix took 4 minutes (claimed 16:16, close-report 16:19). For those 69 minutes the elitebook executor ticked #652 blocked by 1 open issue(s) — the swarm is plugging 37 times.

Why nobody claimed it:

  • every workstation swarm tick deferred to #657's /tmp/matou-drive-wanted reservation (the shared defer counter reached 25, i.e. the whole 14:38–16:04 window across all three repos);
  • elitebook's single runner slot was on dev-factory backlog (#13 56 min, then #22, #15 until 16:13);
  • claims go "lowest live claim id works this ticket" — a drive blocker competes equally with ordinary backlog.

That is the gridlock shape: drive A's reservation fences the swarm off one host; drive B is blocked on a ticket only the swarm can close.

Ask

Two halves, both in the claim path:

  1. Ordering. list-ready-tasks.sh / claim-next-task.sh put drive-blocker tickets first. Definition of a drive blocker: an open ready-for-agent issue that is a native Forgejo dependency (blocked by) of an open issue labelled standing-drive. Resolve via the dependencies API at list time (one GET per standing drive, not per candidate). Within blockers keep today's ordering; everything else after.

  2. Guard exception. The /tmp/matou-drive-wanted consumer guard (swarm.yml / triage.yml inline, session-runner.sh, and the host_capacity_drive_wanted predicate in host-capacity-lib.sh) currently yields unconditionally. A worker whose next claim would be a blocker of the drive that holds the reservation should be admitted: that work is what the drive is waiting for. Needs the reservation file to carry the reserving drive's issue number (today it is an empty touch-file — make the producer in idss rehearsal-cycle.sh write REHEARSAL_DRIVE_ISSUE into it; an empty file keeps today's unconditional-yield semantics so the change is backward compatible across the pin lag).

Acceptance

  • tests/list-ready-tasks-test.sh: with shimmed curl returning a standing-drive issue blocked by #N and a lower-numbered ordinary ticket, #N is listed first.
  • tests/host-capacity-lib-test.sh: host_capacity_drive_wanted still returns 0 on an empty reservation; new helper returns the reserving issue number when present.
  • tests/session-runner-test.sh case 9 still green (unconditional defer on an empty reservation).
  • Live: a reporter-filed blocker is claimed on the next swarm tick even while a drive reservation stands on that host.

Out of scope

Per-host drive exclusivity (separate ticket) and the concurrency: group on swarm.yml (separate ticket). The swarm.yml/triage.yml inline guards in idss and matou-app are rendered, not vendored — ticket their follow-up in those repos once this lands.

Evidence: swarm-gridlock review artifact (per-machine timeline), idss #652/#668 timelines, workstation /tmp/matou-swarm-drive-defer-count, elitebook ~/swarm/rehearsal-executor.log lines 1186–1222.

## Symptom (2026-08-22, swarm-gridlock review) idss #668 — a `bug` + `priority` + `rehearsal-183` ticket the rehearsal reporter filed as the blocker of standing drive #652 on elitebook-03 — was filed 15:07Z and not claimed until 16:16Z. The fix took **4 minutes** (claimed 16:16, close-report 16:19). For those 69 minutes the elitebook executor ticked `#652 blocked by 1 open issue(s) — the swarm is plugging` 37 times. Why nobody claimed it: - every workstation swarm tick deferred to #657's `/tmp/matou-drive-wanted` reservation (the shared defer counter reached 25, i.e. the whole 14:38–16:04 window across all three repos); - elitebook's single runner slot was on dev-factory backlog (#13 56 min, then #22, #15 until 16:13); - claims go "lowest live claim id works this ticket" — a drive blocker competes equally with ordinary backlog. That is the gridlock shape: drive A's reservation fences the swarm off one host; drive B is blocked on a ticket only the swarm can close. ## Ask Two halves, both in the claim path: 1. **Ordering.** `list-ready-tasks.sh` / `claim-next-task.sh` put drive-blocker tickets first. Definition of a drive blocker: an open `ready-for-agent` issue that is a native Forgejo dependency (`blocked by`) of an open issue labelled `standing-drive`. Resolve via the dependencies API at list time (one GET per standing drive, not per candidate). Within blockers keep today's ordering; everything else after. 2. **Guard exception.** The `/tmp/matou-drive-wanted` consumer guard (swarm.yml / triage.yml inline, `session-runner.sh`, and the `host_capacity_drive_wanted` predicate in `host-capacity-lib.sh`) currently yields unconditionally. A worker whose next claim would be a blocker of *the drive that holds the reservation* should be admitted: that work is what the drive is waiting for. Needs the reservation file to carry the reserving drive's issue number (today it is an empty touch-file — make the producer in idss `rehearsal-cycle.sh` write `REHEARSAL_DRIVE_ISSUE` into it; an empty file keeps today's unconditional-yield semantics so the change is backward compatible across the pin lag). ## Acceptance - `tests/list-ready-tasks-test.sh`: with shimmed curl returning a `standing-drive` issue blocked by #N and a lower-numbered ordinary ticket, #N is listed first. - `tests/host-capacity-lib-test.sh`: `host_capacity_drive_wanted` still returns 0 on an empty reservation; new helper returns the reserving issue number when present. - `tests/session-runner-test.sh` case 9 still green (unconditional defer on an empty reservation). - Live: a reporter-filed blocker is claimed on the next swarm tick even while a drive reservation stands on that host. ## Out of scope Per-host drive exclusivity (separate ticket) and the `concurrency:` group on swarm.yml (separate ticket). The swarm.yml/triage.yml inline guards in idss and matou-app are rendered, not vendored — ticket their follow-up in those repos once this lands. Evidence: swarm-gridlock review artifact (per-machine timeline), idss #652/#668 timelines, workstation `/tmp/matou-swarm-drive-defer-count`, elitebook `~/swarm/rehearsal-executor.log` lines 1186–1222.
Author
Member

swarm-claim host=matou-dev-server-01 run=182
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=182 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #24 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 24,
  "status": "success",
  "commits": [
    "63e200113b699be20423ba627f9d7804b5394b45"
  ],
  "changed_files": [
    "STATUS.md",
    "host-capacity-lib.sh",
    "list-ready-tasks.sh",
    "tests/host-capacity-lib-test.sh",
    "tests/list-ready-tasks-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/list-ready-tasks-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/host-capacity-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/session-runner-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "tests/list-ready-tasks-test.sh: standing-drive issue blocked by #N, lower-numbered ordinary ticket -> #N listed first": "New case 10 in tests/list-ready-tasks-test.sh: drive #950 blocked by #900; order is 900,400,300 (blocker before priority #400 and ordinary #300). Implemented in list-ready-tasks.sh drive-blocker discovery + 4-group emit.",
    "tests/host-capacity-lib-test.sh: host_capacity_drive_wanted still returns 0 on an empty reservation; new helper returns the reserving issue number when present": "New group in tests/host-capacity-lib-test.sh: empty reservation still wanted (rc 0) and carries no number; a '668' reservation -> host_capacity_drive_wanted_issue echoes 668; malformed/absent -> nothing. Helper added to host-capacity-lib.sh.",
    "tests/session-runner-test.sh case 9 still green (unconditional defer on an empty reservation)": "session-runner unchanged; case 9 passes (see tests run). The empty touch-file yields no drive number so the guard's unconditional-yield semantics are preserved.",
    "Live: a reporter-filed blocker is claimed on the next swarm tick even while a drive reservation stands on that host": "Partially delivered: the ordering (core) lands here; the reservation-file-carries-a-number primitive lands here. The consumer admit-exception (rendered swarm.yml/triage.yml guards) and the idss rehearsal-cycle.sh producer are out-of-scope follow-ups per the issue, and the live acceptance depends on them."
  },
  "summary": "list-ready-tasks.sh orders standing-drive blockers ahead of backlog and host-capacity-lib.sh gains host_capacity_drive_wanted_issue so a reservation can name its drive; core halves of #24.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #24 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 24, "status": "success", "commits": [ "63e200113b699be20423ba627f9d7804b5394b45" ], "changed_files": [ "STATUS.md", "host-capacity-lib.sh", "list-ready-tasks.sh", "tests/host-capacity-lib-test.sh", "tests/list-ready-tasks-test.sh" ], "tests": [ { "command": "bash tests/list-ready-tasks-test.sh", "exit_code": 0 }, { "command": "bash tests/host-capacity-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/session-runner-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done", "exit_code": 0 } ], "criteria": { "tests/list-ready-tasks-test.sh: standing-drive issue blocked by #N, lower-numbered ordinary ticket -> #N listed first": "New case 10 in tests/list-ready-tasks-test.sh: drive #950 blocked by #900; order is 900,400,300 (blocker before priority #400 and ordinary #300). Implemented in list-ready-tasks.sh drive-blocker discovery + 4-group emit.", "tests/host-capacity-lib-test.sh: host_capacity_drive_wanted still returns 0 on an empty reservation; new helper returns the reserving issue number when present": "New group in tests/host-capacity-lib-test.sh: empty reservation still wanted (rc 0) and carries no number; a '668' reservation -> host_capacity_drive_wanted_issue echoes 668; malformed/absent -> nothing. Helper added to host-capacity-lib.sh.", "tests/session-runner-test.sh case 9 still green (unconditional defer on an empty reservation)": "session-runner unchanged; case 9 passes (see tests run). The empty touch-file yields no drive number so the guard's unconditional-yield semantics are preserved.", "Live: a reporter-filed blocker is claimed on the next swarm tick even while a drive reservation stands on that host": "Partially delivered: the ordering (core) lands here; the reservation-file-carries-a-number primitive lands here. The consumer admit-exception (rendered swarm.yml/triage.yml guards) and the idss rehearsal-cycle.sh producer are out-of-scope follow-ups per the issue, and the live acceptance depends on them." }, "summary": "list-ready-tasks.sh orders standing-drive blockers ahead of backlog and host-capacity-lib.sh gains host_capacity_drive_wanted_issue so a reservation can name its drive; core halves of #24.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
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#24
No description provided.