Repository navigation
Description
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)
- Live repro with the claimant's own credential path:
GET /api/session?limit=1000→ HTTP 400
{"_tag":"InvalidRequestError","message":"Expected a value less than or equal to 200\n at [\"limit\"]","kind":"Query"}.
limit=200→ HTTP 200, 200 rows.limit=201→ 400. pm-stack/opencode-claimant/poll.py:581—
SESSION_FETCH_LIMITS = (1000, 10000, 100000);fetch_sessions()
(poll.py:584) escalates through exactly those limits, so every probe
400s and the fetch fails closed toNone("completeness cannot be
proven")._server_get()(poll.py:557) swallows the HTTPError, so nothing
surfaces the 400 — the fire log only shows the downstream symptom.- Fire log
~/.local/state/opencode-claimant/fires.jsonl: the last fire
with a non-null cap_room is 2026-11-19T09:00:41Z (cap_room 36, which
launched task 10501 / Migration M3: sandbox quota-recorder as first sandbox deploy target + generic unit restorer #5770); every fire since hascap_room: null.
Conductor census helper session-count.py pages /api/session at limit=1000; the API caps limit at 200 — exit-3 census has stopped all conductor dispatch since 15:23Z #12122 pins the ceiling going live on the server fleet in the
2026-11-20T15:05–15:23Z window; the standing server (pid running
opencode 2.0.30) enforces it now (probe above). - Pagination alternatives probed:
offsetis still broken (page 2
repeats page 1 — the long-standing opencode-claimant: cap and supervision read GET /api/session, which truncates at 50 — active roots undercounted, live bound sessions reported gone #4757 behaviorfetch_sessions
documents);cursortakes the opaque anchor token the response
returns (data.cursor.next, base64), not an integer or session id. - Server load: ~29k sessions today (Conductor census helper session-count.py pages /api/session at limit=1000; the API caps limit at 200 — exit-3 census has stopped all conductor dispatch since 15:23Z #12122's fixed census counted
29,218 rows), so the 200-row page ceiling makes cursor pagination
mandatory — alimit=200-only fetch could never prove completeness
either.
Impact
- Launches:
summarize_cap()returns(None, None, None)→ the cap
step readscap_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) buildssession_by_id
only from a successful fetch; withsessions = Noneit is{}, so
get_stuck_bound()(poll.py:912) silently reportsstuck_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_roomagain
(python3 pm-stack/opencode-claimant/poll.pyagainst :13420). stuck_boundreflects 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
developing-today commentedon Nov 21, 2026
CODE-4447
dezren39 commentedon Nov 21, 2026
agent-note:v1
kind: triage-findings
task: 20912
result: triaged, confirmed, routed to a follow-up fix task
Verified on origin/main 91f650b:
pm-stack/opencode-claimant/poll.pySESSION_FETCH_LIMITS = (1000, 10000, 100000);fetch_sessions()requests/api/session?limit=<n>at each step._server_get()returns None on any exception, including the HTTP 400 from a limit above 200, sofetch_sessions()returns None. The silent-None path is the blind spot the issue describes.session-count.py), but a different file. Conductor census helper session-count.py pages /api/session at limit=1000; the API caps limit at 200 — exit-3 census has stopped all conductor dispatch since 15:23Z #12122 stays open for its own fix.cursor.next(the same verified approach as Conductor census helper session-count.py pages /api/session at limit=1000; the API caps limit at 200 — exit-3 census has stopped all conductor dispatch since 15:23Z #12122), plus a 400 surfaced as an error and not swallowed to None.Route: a small fix in
poll.pywith a regression test, enqueued as a follow-up task.dezren39 commentedon Nov 21, 2026
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.
dezren39 commentedon Nov 21, 2026
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.
dezren39 commentedon Nov 21, 2026
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