Repository navigation
Description
Problem
Tasks in agent.tasks can die silently at their attempt cap: they sit in queued forever, unclaimable, invisible to terminal-state counts, with no failed event. Measured 2026-11-06 (dead-at-cap evaluation): in queue repo-health-code-pilot, 142 of 172 queued tasks have attempts >= max_attempts and can never be claimed again. Only 2 tasks in the whole queue are in terminal failed.
Root cause (in the queue's own SQL, pm-stack/opencode-claimant/migration-0023.sql)
claim_repo_taskincrementsattemptsat claim time and only selectsqueuedrows withattempts < max_attempts.fail_repo_taskis the only path that marks a taskfailedat cap — but it only runs when a worker actively calls fail.expire_leases()returns a claimed task toqueuedwhen its lease lapses without checking attempts. So every claim that evaporates (bound session never launches, lane dies, backend flaps, quota wall kills the session) burns exactly one attempt and, at the cap, parks the task inqueuedpermanently: never claimable, never failed, no terminal event.
Worked example: task 9553 (triage for #5459) burned 24/24 attempts on documented claim→handoff→evaporation cycles (agent notes on #5459, 2026-11-05 17:43Z → 2026-11-06 02:31Z) without the work ever being attempted.
Fix shapes (either or both)
expire_leases: when the expiring claim's task is already atattempts >= max_attempts, transition it tofailed(with alease_expired_at_capevent) instead ofqueued— mirrorfail_repo_task's terminal branch.- A reaper in the fleet monitor's dead-in-queue pass that terminally dispositions
queuedrows at cap (it already detects them — it currently only raises caps, which feeds the same burn loop when the underlying launch failure persists).
Also worth deciding while here: whether claim-time attempts increment is the right accounting for claims that never bind a session (a bind that never happens arguably shouldn't consume the budget the cap is meant to enforce).
Evidence
- Census (Management API SQL, 2026-11-06): queued at-cap 142/172 · parked at-cap 29/163 (parked is not attempt-gated) · blocked at-cap 17/231 · failed total 2.
- Full evaluation: dead-at-cap report, 2026-11-06 (scratch/dead-at-cap-evaluation-2026-11-06/report.md in the ops workspace).
- Related: main-broken: developing-today/code id @455f3bb — basic: nix flake check (biome-check) #5459 (task 9553), clippy-lint gate red since 2026-11-02: 571 deny-level sites in pkgs/id (campaign) #6462 (the clippy campaign that sat untouched behind this).
Acceptance criteria
- expire_leases (or an equivalent reaper) transitions a queued task whose expiring claim is already at attempts >= max_attempts to a terminal failed state with a lease_expired_at_cap event, instead of returning it to queued.
- The claim-accounting question is decided and recorded on this issue: whether a claim that never binds a session should consume attempt budget.
- A regression test or migration-level verification covers the at-cap expiry path, and the 142 silent zombies in repo-health-code-pilot are dispositioned (failed, requeued with a fresh packet, or explicitly kept) with the count recorded.
Activity
developing-today commentedon Nov 6, 2026
CODE-1945
dezren39 commentedon Nov 6, 2026
Intake review
Related: Worked example: issue #5459 / task 9553 (task 9553 was cancelled by this monitor run — its issue had closed — so it is no longer the live example; the census stands). Outage that compounded it: issue #6464. The fleet monitor's interim cap-raising rule (Duty 1 addendum, 2026-11-03) is the stopgap this issue critiques.
Notes: Evidence-complete filing: root cause is named in the queue's own SQL (migration-0023) with a measured census (142/172 queued at cap, 2 failed total). This run's digest independently counted 146 dead-in-queue in code (135 of them already at the 24 self-repair ceiling) — consistent with the filing. Verified still live: no merged PR touches expire_leases semantics. Risks: making expiry terminal could fail tasks whose work actually landed via a PR during the lease window — the disposition pass should join open PRs first (the monitor's Duty 1B data is the join). Suggested approach: fix shape 1 (expire_leases terminal branch) plus the one-time zombie disposition; shape 2 (monitor reaper) only if shape 1 cannot ship promptly.
— fleet monitor intake (protocol §5), 2026-11-06.
105 remaining items
dezren39 commentedon Nov 10, 2026
agent-note: task 14617 parked by lane code-h — PR #8157 still awaiting CI.
dezren39 commentedon Nov 10, 2026
agent-note:v1
task: 14617
issue: #6463
lane: code-k
stage: parked
reason: CI pending on PR #8157 — 7 basic checks still QUEUED after a fresh 5-minute poll (17:17-17:21Z, runner backlog); 1 check skipping (CodeRabbit).
state: PR #8157 OPEN, MERGEABLE, branch queue/14617-6463-expire-at-cap; targeted tests previously passed (cargo test -p fleet-queue --lib --all-features: 136 passed incl. expiry_disposition_fails_only_at_cap). Codex review failed on usage limits with no findings or review comments posted — dispositioned.
resume: merge PR #8157 when its basic checks go green, then complete task 14617.
dezren39 commentedon Nov 10, 2026
agent-note:v1 — state: parked (task 14617, lane code-y)
fix(queue): expire_leases fails at-cap tasks instead of stranding the…
Merge pull request #8157 from developing-today/queue/14617-6463-expir…
dezren39 commentedon Nov 11, 2026
Agent note — task 14617 done: PR #8157 merged (lane code-w)
expire_leasesin the Turso queue backend now fails at-cap claimed tasks terminally (failed+last_error+lease_expired_at_capevent) instead of returning them to aqueuedstate the claim query can never select.queued, soexpire_leasesnever sees them; they need a separate operational step (per-task revive, or a bulk fail with the count recorded). This is a fleet-owner operational decision, not part of this fix.