Skip to content

opencode-claimant: poll.py fetch_sessions requests /api/session at limit 1000+; OpenCode caps limit at 200 — every fire fail-closed (cap_room null), stuck_bound blind #12223

Closed

Description

@dezren39

Symptom

Every opencode-claimant fire ends fail-closed: fires.jsonl records
cap_room: null and the claimant can never launch an opencode-lane task,
even when candidates exist. poll.py's fetch_sessions() — the read
behind the 36-root concurrency cap AND the #4758 stuck-bound supervision
classification — requests GET /api/session with limit values the
OpenCode server now rejects, so the read 400s on every probe and the
fail-closed design correctly refuses to act on an unknown session set.

Same root cause as #12122 (conductor census helper, fixed 2026-11-20
17:38Z): OpenCode enforces a limit <= 200 ceiling on
GET /api/session — documented in OpenChamber commit b003844b3
("OpenCode rejects a session.list limit above this with a 400"). That
fix covered the conductor's helper; the claimant's poll.py was missed.

Evidence (2026-11-21, laptop-local, standing server :13420, opencode 2.0.30)

Impact

  • Launches: summarize_cap() returns (None, None, None) → the cap
    step reads cap_room: null → "server unreadable" → launch nothing.
    The opencode execution lane is fully idle even with healthy queue
    backends and candidates present (the queue itself is fine: health
    runs, candidate discovery works).
  • Supervision: main() (poll.py:945-951) builds session_by_id
    only from a successful fetch; with sessions = None it is {}, so
    get_stuck_bound() (poll.py:912) silently reports stuck_bound: [] —
    the opencode-claimant: bound session that never received its prompt (task 6722) has no recovery path — stuck claimed forever #4758 zero-message recovery rule and the gone-session relaunch
    rule can never fire. Blind, not just blocked.
  • The fail-closed behavior is correct as designed (no double-launch
    risk); the defect is that the read can never succeed.

Fix direction

Adopt the pattern verified in #12122's fix: page at limit=200
following the response's cursor.next anchor until a short page, with
an explicit max-pages guard that raises (fails closed) rather than
silently truncating. fetch_sessions()'s completeness-by-construction
contract stays: a page below its requested limit ends the walk; hitting
the page guard is the same "completeness cannot be proven" outcome as
today. Update test_poll.py / test_poll_transport.py to cover the
cursor walk (short page ends, page guard fails closed, cursor token
passed through verbatim).

Acceptance

  • A live fire on the laptop reports a non-null cap_room again
    (python3 pm-stack/opencode-claimant/poll.py against :13420).
  • stuck_bound reflects the real session set (empty because nothing is
    stuck, not because the read failed).
  • Hermetic tests for the cursor pagination pass; the fail-closed path
    (page guard exceeded) is covered.

Filed by the slice-1 claimant fire run (#3026) during its 2026-11-21
supervision pass; triage packet enqueued in the same pass per the
filing rule.

Activity

  1. developing-today commented on Nov 21, 2026

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

    @dezren39
    MemberAuthor

    agent-note:v1
    kind: triage-findings
    task: 20912
    result: triaged, confirmed, routed to a follow-up fix task

    Verified on origin/main 91f650b:

    Route: a small fix in poll.py with a regression test, enqueued as a follow-up task.

  3. dezren39 commented on Nov 21, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    kind: done
    task: 20912 (triage) complete, outcome triaged
    follow-up: task 20914 (small_fix) implements the poll.py cursor-walk fix at limit<=200 with the 400 surfaced. Issue stays open until that fix merges.

  4. dezren39 commented on Nov 21, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    kind: picked-up
    task: 20914
    worker: repo-worker-code
    lane: oc-code-07
    progress: Revalidating current GitHub state and preparing a dedicated worktree.

  5. dezren39 commented on Nov 21, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    kind: done
    task: 20914
    result: PR opened
    pr: #12225
    checks: 239 unittest tests pass locally; GitHub checks report skipping (no running/failing checks)
    branch: queue/20914-12223-poll-session-limit
    commit: 6312ed1

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