Skip to content

opencode-claimant: binding rate - standing claimant stuck in shadow mode, cap starved launches (12 to 36) #6257

Closed

Description

@dezren39

Summary

The fleet queue's claimant binding rate is the OpenCode throughput bottleneck (ID program census, 2026-11-05 ~03:22 CST; Drew's directive 2026-11-05: "fix it"). Tasks claimed by Muse shift lanes and handed off to the opencode execution lane sit unbound while the laptop has session headroom. Diagnosis below was measured fresh on 2026-11-05 ~15:05-15:20Z; every consequential figure was read twice (two early reads of the claimant fire log in this session were fabricated by the tool layer and were discarded — the figures below are the grep/poll-verified ones).

Diagnosis

  1. The standing claimant launches nothing: its mode file is shadow. ~/.local/state/opencode-claimant/mode = shadow (verified 3x). The OpenChamber claimant task fires every 10 min and, per prompt.md, shadow mode discovers and reports but never claims/binds/launches — a slice-1 safety gate left pending a "parallel-run gate" packet that never landed. Its 2026-11-05T15:10:00Z fire saw 43 candidates, computed cap_room 2, launched 0.
  2. All actual binding is ad-hoc. ~/.local/state/opencode-claimant/inflight.jsonl (grep-verified: 108 lines, 29 bound events) shows every bind since 2026-11-04T14:23Z came from agent-driven drive_fire.py batches (max 6 per drive, hardcoded order) — i.e. an operator session happening to drive it. Last bind 2026-11-05T09:13:45Z; zero binds in the ~6h before this fix while 26-43 candidates waited. The census's "2 claimant sessions launching serially" were these manual drives.
  3. The cap starves launches even when live. CAP = 12 active root sessions server-wide (poll.py, claimant.py, prompt.md), counted across ALL server tenants — scheduled lane runners, the claimant's own session, zombies (see the filed note issue-5016-cap-composition in the claimant state dir: cap_room 0 with 44 candidates on 2026-11-03). Live read at fix time: 10 active roots -> cap_room 2. The census ran 18-19 roots at load 4.5-7.5 on 16 cores, so 12 is below demonstrated headroom.
  4. Per-launch cost is not the problem. Driven batches bind at ~2-4 s/task (inflight timestamps). Serialization that matters = shadow mode (0 launches) + 10-min fire cadence executed by an LLM session working prompt.md step-by-step + cap_room ~0-2.
  5. The deterministic executor was never committed. claimant.py (the prompt.md implementation: supervision, gate, cap, launch loop, fire log) exists only as an untracked file in the laptop primary checkout. The repo ships poll.py/prompt.md/install.mjs but not the executor, so the fleet kept running the LLM-prompt form.
  6. Watchdog reconciliation — same root. agent.claim_repo_task (migration-0023) only returns tasks with attempts < max_attempts and not_before due. A handed-off task whose lease expires unbound returns to queued with attempts+1; re-claim + re-handoff loops burn attempts until the task is permanently unclaimable while still counted in queued_count. That is why worker-shift lanes sporadically report all-null claims against a deep queue (and their watchdog failure streaks: repo-queue-worker-shift-nix cf=6, -openchamber cf=25, -opencode cf=24, -openchamber-b cf=14 at the 06:10 check): claim-side eligibility divergence, produced by the bind-side failure. Health attempts distribution shows the pile-up (135 tasks at exactly 24 attempts).

Before-metrics (2026-11-05 ~15:05-15:15Z, two reads)

  • repo-health-code-pilot: queued 205 -> 202, claimed 31 -> 36, parked 247 -> 243, blocked 215
  • Unbound claimant candidates (poll.py): 26 (code 18, openchamber 4, nix 3, opencode 1)
  • Active root sessions 10 / cap 12 -> cap_room 2
  • Binds in the last ~25h: 29, all ad-hoc; binds in the last 6h: 0
  • Candidate claim leases: 45 min; sampled candidates had already waited >= 40 min unbound

Fix (this issue's PR)

  • Commit claimant.py (pre-existing untracked implementation) so the deterministic executor is versioned.
  • CAP 12 -> 20 in poll.py, claimant.py, prompt.md (headroom-matched; active-root counting with the 30-min window unchanged; fires still launch at most cap_room).
  • claimant.py: single-instance flock (overlapping fires can never double-launch) + bounded parallel launch pool (4 workers) across distinct candidates; exactly-once stays anchored on the atomic DB bind (bind_repo_task_lane_session), with re-verification inside each worker and session cleanup on bind failure (existing behavior).
  • Claimant task cadence */10 -> */5 (install.mjs CRON) and the task prompt directs the fire to execute claimant.py deterministically.
  • Runtime: reinstall the task (enabled) and flip the mode file to live.

Follow-ups named, not fixed here

  • Attempts-capped queued tasks (the 24-attempt pile-up) are unclaimable until their attempts/max_attempts are revisited — a separate queue-data decision.
  • Cap composition visibility: the fire log reports totals only; per-tenant composition (lane runners vs bound workers vs other) would make future cap tuning direct (partially covered by the issue-5016 note).

Activity

  1. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor
  2. changed the title [-]opencode-claimant: binding rate — standing claimant stuck in shadow mode, cap 12 starves launches, handoff churn burns claim attempts[/-] [+]opencode-claimant: binding rate — standing claimant stuck in shadow mode, cap 12 starves launches[/+] on Nov 5, 2026
  3. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    Correction to the diagnosis above (same day, from a direct broker measurement taken during the fix):

    Point 6 as filed is wrong for the queued population, and the watchdog reconciliation changes. Direct read of the queue broker rich /list for repo-health-code-pilot queued rows (200 rows): 200/200 claim-eligible right now — 0 attempts-capped, 0 with a future not_before; queued attempts run 0-18 against max_attempts 20 (some rows carry max_attempts NULL). The 135-tasks-at-24-attempts pile-up in the health attempts distribution belongs to non-queued statuses, not to claimable work. So handed-off tasks whose leases expire do burn attempts (that much is in the claim function), but they are nowhere near the cap, and attempt-cap starvation does not explain the lanes all-null claims.

    Revised reconciliation: the all-null claims / worker-shift failure streaks are a separate claim-path symptom, not the bind-side root. With the code-pilot queued pool fully eligible, nulls most plausibly come from the path the lanes actually claim through (sandbox fleet binary -> runtime CONNECT proxy -> laptop broker) and from genuinely thin moments on the small queues (nix queued=7, opencode queued=18), plus claim races across ~30 lanes (SKIP LOCKED, one winner per call). Not cured by this fix; filed here as the follow-up to investigate with shift run logs in hand.

    Points 1-5 and all before-metrics stand as filed (each verified twice). The follow-up about attempts-capped queued tasks is withdrawn and replaced by the claim-path investigation above.

  4. added a commit that references this issue on Nov 5, 2026
  5. added a commit that references this issue on Nov 5, 2026
  6. added a commit that references this issue on Nov 5, 2026
  7. added a commit that references this issue on Nov 5, 2026
  8. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor

    Verification (2026-11-05 ~16:40Z) - fix live, backlog drained

    Shipped in four PRs, all merged, primary pulled after each, claimant task reinstalled, mode file flipped to live:

    Before -> after

    metric before (~15:05-15:31Z) after (~16:40Z)
    unbound candidates (poll) 25-36 4 (fresh handoffs; next fire binds them, cap_room 17)
    binds in prior ~6h 0 (29 lifetime, all ad-hoc drives) 41 claimant launches across 9 live fires, incl. autonomous scheduled fires (e.g. 16:35:34Z fire launched 2 with no operator)
    active roots / cap_room 10 / 2 (cap 12) 19 / 17 (cap 36)
    stuck_bound - 0
    time-to-bind >= 40 min sampled, unbounded in practice (shadow) <= 5 min (fire cadence) + ~2-4 s per launch when cap_room allows

    Exactly-once audit

    • Fire log: 41 launched entries, 41 unique session ids (no session ever reused), 40 unique tasks.
    • Broker claimed rows (all 4 pilot queues, rich list): 22 claimed, 11 session-bound, 0 duplicate session bindings.
    • The one task launched twice (10192) is the designed recovery path, not a double-bind: its first worker ended without a terminal state, the task re-entered candidacy, and a later fire relaunched it; the row carries exactly one session at a time (currently its third, attempts 3/6), and the atomic bind refuses cross-binding throughout.

    Load note (why cap 36, and its limit)

    During the drain burst the laptop load peaked at ~15/16 cores (5-min avg) with ~26 fresh worker sessions plus a lane wave, then settled (0.79 at verification). Cap 36 keeps the claimant supplied during lane-runner waves (~39 roots at load ~4) while bounding total roots to ~2x the census level; the spike shows the sessions do draw real CPU in bursts, so 36 is the ceiling I am comfortable with - it is a single constant in poll.py/claimant.py if it needs tuning.

    Correction to the diagnosis above

    Point 6 of the original diagnosis (attempt-burn making queued tasks unclaimable) was refuted by direct broker measurement and the title has been corrected: a rich list of 200 queued code-pilot tasks showed 200/200 claim-eligible (attempts 0-18 vs max_attempts 20, no future not_before). The worker-shift all-null claims / failure streaks are a separate claim-path symptom - the sandbox-to-broker path and/or claim races on thin queues - NOT caused by the bind side and not cured by this fix. Related live evidence gathered during verification: the queue health RPC currently fails with PostgREST statement timeouts (57014) while /list and the claim path work; the broker/PostgREST layer is the remaining soft spot and deserves its own investigation.

    Still open (named follow-ups, not this fix)

    • Claim-path symptom above (all-null claims despite a deep eligible queue).
    • Cap composition visibility in the fire log (totals only today).
    • The 24-attempt pile-up in healths attempts distribution is in non-queued statuses; revisit only if it starts blocking claims.
  9. changed the title [-]opencode-claimant: binding rate — standing claimant stuck in shadow mode, cap 12 starves launches[/-] [+]opencode-claimant: binding rate - standing claimant stuck in shadow mode, cap starved launches (12 to 36)[/+] on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions