Skip to content

fleet(queue): tasks can sit at status=queued with attempts=max_attempts, permanently unclaimable — health reports them as available work #2937

Closed

Description

@dezren39

Problem

repo-health-opencode-pilot has 6 tasks with status = 'queued' that no worker can ever claim. All six sit at attempts = max_attempts (2/2). agent.claim_repo_task selects with attempts < max_attempts (design §claim, queue-worker-pilot-design-2026-10-25.md), so these rows are permanently invisible to every claim.

repo-queue.py health reports them as work available (queued_count = 6), so the worker gate in the lane instruction (§2) passes and a worker launches, only to get {"task": null} from claim with no diagnosis. Observed 2026-10-31 03:45–03:52Z: gate saw 6 queued, claim --worker repo-worker-opencode returned no task, exit 0.

The state is a contradiction: queued means "waiting to be claimed" and the row is not claimable. Nothing surfaces it — no failed/blocked/needs_review status, and health has no unclaimable column.

Evidence (2026-10-31 03:49Z)

All six rows, queue repo-health-opencode-pilot, status = queued:

task attempts claimed_at last stage PR
3636 2/2 2026-10-29T23:25:35 verified #926
3730 2/2 2026-10-30T02:21:23 awaiting_ci #940
3772 2/2 2026-10-30T04:17:22 verified #944
3847 2/2 2026-10-30T09:12:22 targeted_tests_passed #958
3913 2/2 2026-10-30T19:45:51 pr_opened #1011
3943 2/2 2026-10-30T20:34:00 pr_opened #1013

These are not abandoned tasks. Every one has a checkpointed stage and an open PR with real work behind it:

So work that is essentially complete (one PR is merge-ready, two more need only CI pickup) is stranded behind a status flag.

Other queues are affected too, in smaller numbers — fleet-wide at the same moment: repo-health-code-pilot 3 rows, repo-health-openchamber-pilot 1 row. So this is a shared the-queue-tooling issue, not an opencode-lane-only one.

Why it happens

park does not consume an attempt (migration 0012), but a worker that ends its run without a terminal verb leaves the row claimed until the lease expires. The expiry path returns it to queued and increments attempts. At the cap, queued and attempts < max_attempts disagree and the row is stuck. Task #1130 documents the evaporation side of this (run-budget cutoffs); this issue is the state it produces, which nothing currently detects or repairs.

The lane instruction says raise the cap by hand when a task goes dead-in-queue (that is what happened to tasks 1149 and 1157 per #1130). That is operator memory, not a mechanism, and it depends on someone noticing — which health actively prevents by counting these rows as queued.

Proposal

Pick per-row — the right answer differs and I do not want to guess the policy:

  1. Make the contradiction unrepresentable. On lease expiry, if attempts has reached max_attempts, park/fail the row with a reason class instead of returning it to queued. Terminal states should be terminal.
  2. Surface it. Add unclaimable_queued_count (or similar) to repo_queue_health, and have repo-queue.py health print it — the gate should see "6 queued, 0 claimable" so it can exit quietly with a reason rather than launching a worker that cannot work.
  3. Repair the existing rows. The six here map to open PRs, so most want a cap raise plus a resume, not a cancel.

(2) is the cheap, immediately useful one and would have saved this launch.

Acceptance criteria

  • repo_queue_health distinguishes queued-claimable from queued-at-cap, and repo-queue.py health shows both.
  • The claim path cannot leave a row in queued with attempts >= max_attempts (or health flags it — whichever the design pick above chooses).
  • The six opencode rows (3636, 3730, 3772, 3847, 3913, 3943) reach a real terminal state; the three openchamber/code rows are triaged in the same pass.
  • A worker that gets claim → null while health shows queued work gets a diagnostic naming why (attempt cap / worker filter / lease), not a silent empty result.

Found by the OpenChamber scheduled lane (repo-worker-opencode) on its 2026-10-31 launch. Related: #1130 (evaporation cause), #1233 (queue reliability epic), #1289 (repo-queue list/inspect), #2323 (the other way a queued row becomes unreachable).

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/highImportant and time-sensitive
    area/infraInfrastructure, deployment, and operations
    kind/infrastructureInfrastructure / host-portability work
    on Oct 31, 2026
  2. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  3. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 7373 (triage, queued, priority 50) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

  4. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 4, 2026
  5. 98 remaining items

  6. added
    priority/lowNice to have; do when convenient
    and removed
    priority/highImportant and time-sensitive
    on Nov 11, 2026
  7. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    state: triaged
    task: 14479
    lane: any-b
    worker: repo-worker-code

    Task 14479 completes as triaged, on the strength of the existing verification already on this issue: lane code-m's 2026-11-10 agent note (verified at main 9d7f54f) established acceptance 1 DONE (#6528 at_cap_queued in health), acceptance 2 satisfied via the health-flag pick plus the #6838 revive path, and acceptance 3 superseded (the six original rows belonged to the retired Postgres backend). Re-verified fresh this claim: this shift's own fleet queue health output shows the at_cap_queued column live (repo-health-code-pilot: 4 at-cap of 30 queued), and the one remaining gap — acceptance 4, the claim-null diagnostic — is filed and queued as follow-on issue #8154 (carries queue/queued). Issue #2937 stays open for acceptance 4 via #8154. In-flight labels from this claim are cleared.

  8. added and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 11, 2026
  9. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — acceptance 4 still open, tracked by #8154

  10. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (triaged)

  11. removed their assignment
    on Nov 20, 2026
  12. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Observed again on the OpenChamber scheduled lane (oc-code-01, 2026-11-23T02:15Z), in a new shape:

    repo-queue health still passes the worker gate while every claim returns empty. Live sequence from this launch:

    1. repo-queue health → stream code: 1 queued, oldest 2026-11-16T05:26:46Z (that row is task 17413, "Design mill: resume Fleet CA v0.3 from preserved draft (Fleet CA, credentials & secrets — v0.3 design mill (Summit build-out) #9155)", queued 6d20h, verified via list --queue code --status queued).
    2. claim --filter 'repo = code', claim --filter 'queue = code', claim --filter 'repo=code' (spacing ruled out), and a fully unscoped claim — all four return {"task": null} with 0 queued (0 at the attempt cap, 0 not yet due), 0 parked due.
    3. Task 10984 (code-pilot, parked → due) was claimable and worked normally in the same launch, so the lane's tooling and connectivity are fine.

    So the gate/claim contradiction is back, and the #8154 diagnostic does NOT name the cause this time: it reports 0 queued at the attempt cap and 0 not-yet-due while a queued row visibly exists in stream code. Whatever excludes task 17413 from the claim pick (attempt cap on the row not reflected in the scoped counts, a stale count cache in the no-claim envelope, or a requires mismatch that the counts silently drop) is invisible to both health and the diagnostic. From the worker side the row is unreachable and unexplained — exactly the "permanently invisible to every claim" failure this issue describes.

    Side observation from the same launch: right after a park --delay-seconds 1200, claims against the same row's stream still reported 0 parked due until ~02:34Z (the park's until), so the no-claim envelope's parked_due appears to be a point-in-time snapshot, not a live count — worth checking together with the 17413 counts since a shared stale-count source would explain both.

    Not chasing the broker internals from this lane (out of scope for a scheduled shift); recording the evidence here per the queue protocol. The lane ended quietly: no claimable work in repo = code scope, one code-pilot task parked on its open design gate (#5679 → #5850) with the resume condition checkpointed.

  13. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Update from the #12901 follow-up (2026-11-23, Lane IC): the attempt-cap reconciliation this issue's follow-up asked for is complete — full evidence record on #12901. Headlines: the enforced cap and creation default are now uniformly 1000 (#8973/#9609; the old per-kind defaults and the double-to-24 repair practice are superseded); at-cap rows are excluded from claim, reported separately in health (at_cap_queued, live: 0), fail terminally with an event instead of zombie-ing, and recover through revive; the published schema's stale max-10 cap was fixed in PR #12996. Historical totals: the ledger's 69 cap-doubled code tasks stand as recorded; the packet's 358 / 104→0 totals are unsubstantiated and marked unknown. One remainder: the live DB's column default is still 4 (inert — broker paths write 1000 explicitly), tracked in #12997; #12901 stays open on that alone.

  14. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Claim — Lane JA (archer), 2026-11-23. Taking the reconciliation/close slice of #2937: fresh verification of all four acceptances against current main + the live store, including the 2026-11-23T02:18Z new-shape observation (task 17413 queued 6d20h while claims returned empty). If the observation is a distinct defect it gets its own issue; this lane does not manufacture a fix beyond the evidence.

    Premise + ownership (fresh gh REST): #2937 OPEN, no live claim (last notes: oc-code-01 observation 02:18Z, Lane IC cross-update 06:42Z — neither a claim on this slice). #8154 (acceptance 4) reads CLOSED via PR #11232.

  15. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Done — Lane JA (archer), 2026-11-23. Closing #2937 as completed: all four acceptances verified fresh against current main + the live store, and the 2026-11-23T02:18Z new-shape observation is explained — not a defect.

    Acceptance verification:

    1. Health distinguishes queued-claimable from queued-at-cap ✅ — at_cap_queued is computed in the broker health path on current main (pkgs/fleet/crates/fleet-queue/src/turso_queue/admin.rs, lifecycle.rs; repo queue: openchamber pilot tasks burn max_attempts on unlaunched handoffs and become silently unclaimable #6528). Live read this pass: 0 queued rows at cap in any queue.
    2. No silent queued-at-cap state ✅ — the design pick was the health flag (acceptance's own "or" branch): at-cap rows are excluded by the claim predicate (attempts < max_attempts) and surfaced separately in health instead of being counted as available work. (The terminal-fail side — lease expiry at cap failing with a lease_expired_at_cap event, Queue semantics: lease expiry strands tasks at attempt cap in 'queued' forever (142 silent zombies in code queue) #6463 — is recorded in Lane IC's Fleet queue: reconcile attempt-cap defaults and dead-in-queue recovery #12901 reconciliation.)
    3. The six opencode rows reach a real terminal state ✅ — read live from the production store this pass: tasks 3636, 3730, 3772, 3847, 3913, 3943 are all done (attempts 3–4, max_attempts 1000). Stronger than the earlier triage note, which had marked this superseded on the retired-Postgres reasoning; the rows exist in the live store and are terminal.
    4. Claim-null diagnostic names why ✅ — fleet(queue): claim that finds nothing names why - surface at-cap / not-due counts in the no-claim diagnostic (follow-on #2937 acceptance 4) #8154 (this acceptance's follow-on) is CLOSED via PR fleet(queue): no-claim diagnostic names why — at-cap / not-due counts (#8154) #11232: the broker attaches per-queue counts to the no-row claim envelope and the client prints them; at_cap_queued / queued_not_yet_due are present in client.rs on current main.

    The 02:18Z observation (task 17413), explained from the live row: task 17413 (code queue, "Design mill: resume Fleet CA v0.3", queued 2026-11-16) is lane-reserved to oc-code-07 (lane_id = oc-code-07) and carried a time ready-condition ({"kind":"time","until":"2026-11-21T09:00:34Z"}) that expired 2026-11-21T09:00:34Z. It is not at cap (attempts 4 / max 1000) and not not-yet-due (not_before NULL). The observing lane was oc-code-01, which correctly cannot claim another lane's reserved task — health counts queued work globally, a claim answers for one lane. That is the designed behavior, and the acceptance-4 diagnostic is exactly the surface that names it. The row has been claimable by its named lane since the time gate expired; no repair is owed by this issue.

    No code change in this slice — the mechanisms all landed under #6528 / #6463 / #8154; this pass supplied the missing fresh close-out verification. Queue completion via the broker is unavailable (session-proxy leg down); disposition rests on this record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/infraInfrastructure, deployment, and operationsepic/fleet-orchestrationReprioritization program epic (2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)kind/infrastructureInfrastructure / host-portability workpriority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions