Skip to content

opencode-claimant starved: poll.py latency (~60-100s) exceeds claimant's 30s gate timeout, every fire ends gate_unknown with zero launches #13112

Closed

Description

@dezren39

Symptom

The standing opencode-claimant (live mode) has stopped launching entirely. Last 40 fire-log lines in ~/.local/state/opencode-claimant/fires.jsonl (as of 2026-11-23T08:06Z):

  • 21x gate_unknown (poll.py exceeded claimant.py's internal 30s gate timeout)
  • 10x sink_claim_failed
  • 7x already_running
  • 0 sessions launched across all 40 fires

Evidence

  • python3 pm-stack/opencode-claimant/poll.py run by hand succeeds (exit 0) but takes 55s–100s wall with only ~2s CPU — the time is waits (turso ledger reads / broker queries), not compute.
  • claimant.py's gate runs poll.py with timeout=30, so every fire fails closed at the gate: candidate discovery unknown. Exiting.
  • A manual poll that completed showed a real waiting candidate: task 20708 (repo-health-code-pilot, handed_off, issue impl(aggregator): source coverage and gap-aware activity ingestion #3321, lane opencode, unbound), cap_room=36, stuck_bound=[]. Work is queued and cap is free; only the gate timeout blocks it.
  • Queue backend is healthy (repo-queue health --worker opencode-claimant exit 0) and the OpenCode server answers GET /api/session in ~0.1s — this is not the backend-outage fallback case, it is poll latency vs gate timeout.

Filing note (one-queue rule: file + enqueue in same pass)

The triage packet for this issue is enqueued in the same pass via repo-queue enqueue --queue repo-health-code-pilot (dedupe repo-health:v1:triage:developing-today/code:issue:<N>).

Acceptance

  • A live claimant fire passes the gate and launches the waiting unbound opencode-lane candidate(s), or
  • The gate timeout is raised / poll.py is sped up so p99 poll latency fits inside it with margin, with a regression note on which side moved.

Tests

  • Five consecutive live fires each log a gate pass (or a non-gate skip with a reason) instead of gate_unknown.
  • poll.py timed over 10 runs: p99 wall time < gate timeout.

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Triage verdict (oc-code-04, 2026-11-23): confirmed. Reproduced python3 -I pm-stack/opencode-claimant/poll.py at 73.8s wall / 1.7s CPU; it exited 0, all four queue reads were healthy, ledger_readable=true, and cap_room=36. claimant.py:383-397 wraps this poll in subprocess.run(... timeout=30), which is below observed latency and explains gate_unknown. This is latency from sequential external reads rather than local computation. Triage-only disposition: fix the gate/poll path, not queue health or cap accounting. A timeout-only bump needs to cover the full caller budget and retain fail-closed behavior; preferable is parallelizing independent queue/status reads and bounding slow external reads, then measure p99 over 10 runs and verify five consecutive live fires pass (or skip with an explicit non-gate reason). No claimant code changed in this triage packet; acceptance execution/implementation remains follow-up.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Claimed by Lane OI (sandbox fix lane, queue task 21304) for the implementation follow-on: triage verdict already confirmed by oc-code-04 (poll 73.8s wall vs the 30s gate timeout in claimant.py). Working the acceptance: raise the gate timeout / speed up poll so p99 fits with margin, verify with timed poll runs and live fires. A parked unpushed commit on the laptop (parked/opencode-claimant-poll-timeout-20261122, 8e47216) carries a 30s -> 300s bump for this same gate; I will verify the caller budget first-hand before adopting or superseding it.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Lane OI — implementation follow-on done (queue task 21304); live-fire leg pending on a named primary blockage.

    Fix landed: PR #13134 merged 2026-11-23T08:57:48Z (merge 69e86afcdc14, head d257d3e5a57 SHA-guarded): run_poll()'s gate timeout in pm-stack/opencode-claimant/claimant.py raised 30s -> 300s. Cherry-picked from the parked never-pushed commit 8e472164d4cf (branch parked/opencode-claimant-poll-timeout-20261122), with the commit message amended to carry the regression note.

    Which side moved (acceptance leg 2): the timeout side. 300s covers the aggregate of poll.py's per-call timeouts (15s server GET, 30s broker POSTs) plus session-store growth. Fail-closed behavior unchanged (a >300s or non-zero poll still ends the fire gate_unknown); the single-instance lock means a slow poll only delays a fire. Poll.py's own latency reduction is filed separately as #13135.

    Verification:

    • Hermetic suite (run_hermetic_tests.py): 217 tests, 215 pass, 2 errors — byte-identical result at base SHA 3a941eff430; both errors are pre-existing environment failures in the TestCodeSourceFireLog._make_clone git-init helper, untouched by this change.
    • poll.py timed over 10 runs on the laptop (2026-11-23, against the live backends): all exit 0; walls (s): 74.2, 43.5, 24.1, 24.2, 45.5, 35.2, 27.3, 29.1, 35.7, 37.6 — max/p99 74.2s, ~4x margin inside the new 300s budget; 8 of the 10 runs would still have failed the old 30s gate, which confirms the starvation mechanism.

    Still open — live fires: the claimant executes from the laptop primary ~/git/code, which is frozen at d3bec26356c4: pm-git-sync has failed since 2026-11-23 02:34:20 CST on an uncommitted edit to doc/fleet-schedule-registry.md in the primary (not this lane's dirt — named and left per the primary rule, filed as #13137). Fires at 08:17Z / 08:35Z / 08:50Z still logged gate_unknown on the old code, as expected pre-sync. Once #13137 clears and the primary pulls past 69e86afcdc14, the remaining acceptance evidence is five consecutive fires with a gate pass (or a non-gate skip with a reason) instead of gate_unknown; queue task 21304 is parked with that exact resume condition.

  5. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Builder's Advocate live-fleet follow-up — 2026-11-23 03:05 CST:

    The scheduled claimant session �ses_e5df85931b4ffejL0meRZ1r0LH� launched �python3 pm-stack/opencode-claimant/claimant.py� at 03:05 with a 120-second shell timeout; at 03:11 it was still reported running. This is after the 300s gate fix PR #13134 merged, so it is not evidence that the old 30s gate remains. I sent the session a correction to abandon the invocation, skip this fire, and avoid starting a duplicate claimant. Follow-up needed: establish why the full claimant process exceeded its 120s wrapper bound and verify the live-fire acceptance (five consecutive fires pass or skip with an explicit non-gate reason).

  6. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Claimant fire observation (2026-11-23 03:05–03:11 CST): the python3 pm-stack/opencode-claimant/claimant.py invocation exceeded the 120s tool bound reported to the caller; it had not returned by ~03:11. Per the safe-fire instruction, no duplicate fire was started. A process check at ~03:12 found no remaining claimant process, so this fire is now finished. Its fire-log row (2026-11-23T09:11:32Z) records live mode, one candidate, cap_room=36, zero sessions launched, zero supervision actions, and one sink_claim_failed skip (task 20708). The claimant tool itself had returned “Fire complete” but with latency inconsistent with its tool bound; treat this as a slow fire, not evidence of a successful launch. No task was bound or launched.

  7. added a commit that references this issue on Nov 23, 2026
  8. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Triage follow-up verdict (lane any-n, 2026-11-23 ~09:25Z, queue task 21304):

    Gate leg: FIXED and verified live. PR #13134 merged 2026-11-23T08:57:48Z (merge 69e86af); HEAD d220c7b contains it and claimant.py run_poll now uses timeout=300 (was 30). The prior blockage #13137 (frozen primary) is CLOSED, and the primary has pulled past the fix.

    Live-fire evidence (fires.jsonl, 3624 ok rows): five consecutive fires with non-gate outcomes, zero gate_unknown:

    Remaining leg is a different failure mode, already tracked: launches still do not resume because the broker handoff-sink claim returns nothing claimable for task 20708, so every post-gate fire ends sink_claim_failed. That is the handed-off-never-launched phenomenon tracked by #6533, not the gate-timeout starvation this issue covers. Prior timed evidence stands: poll.py 10 runs all exit 0, max 74.2s wall, inside the 300s ceiling with margin.

    Disposition: this issue's acceptance leg (timeout raised, p99 inside it, gate passing in live fires) is met. Closing; launch-resumption work continues under #6533.

  9. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Closed as implemented.

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