GeezerVison is showing github.com — opencode-claimant: cap and supervision read GET /api/session, which truncates at 50 — active roots undercounted, live bound sessions reported gone · Issue #4757 · developing-today/code
opencode-claimant: cap and supervision read GET /api/session, which truncates at 50 — active roots undercounted, live bound sessions reported gone #4757DescriptionSummary
pm-stack/opencode-claimant/poll.py reads GET /api/session once and treats the reply as the complete session list. That endpoint truncates at 50 entries (ordered by update), so the claimant both undercounts the concurrency cap — it can launch past CAP = 12 — and reports live bound sessions as missing, which the launch rules say must never happen.
Observed 2026-11-03T04:42Z on the laptop server (http://127.0.0.1:13420):
GET /api/session → exactly 50 sessions, 50 roots.
- Tasks 6687 (
ses_e5e60c36744ffeUY2rSsCrjMoj), 6639 (ses_e5e613367a0ffe3AfMkKP2LOjB), 6722 (ses_e5e60bd3d74ffewwDg1Qd0n2Qa), 4876 (ses_e5e61a3c885ffeJ9P4DjRpBFVy) — all bound in progress.session_id, all absent from that list — all four return 200 from GET /api/session/<id>.
Impact
- Cap overcount of room.
summarize_cap() (poll.py:112-128) intersects the 50-row page with /api/session/active. Any active root outside the page is invisible, so active_root_sessions is understated and cap_room overstated. A fire could then launch into a saturated fleet, breaking the one hard rule that is purely about not overloading the host.
- False "session is gone". Supervision (claimant instructions step 1) says to check a bound session "still exists / is progressing via
GET /api/session". On the truncated page an alive session reads as gone. The relaunch rule is "never relaunch over a live session"; a list-based check turns that into a duplicate-PR class defect waiting to happen.
Proposed fix
- Count actives from
/api/session/active directly (its id set is authoritative and small) rather than filtering a page of /api/session; if root-ness is still needed, fetch each active id with GET /api/session/<id>.
- Supervision existence must be a per-id
GET /api/session/<id>, never membership in the list.
- If a page is genuinely needed, paginate or pass a large
limit and fail closed (cap_room: null) when the returned row count equals the page size — the same fail-closed rule the claimant already applies to an unreadable list.
Evidence trail
Fire log lines for 2026-11-03 in ~/.local/state/opencode-claimant/fires.jsonl carry the full supervision table for that fire.
Acceptance criteria
- Cap accounting counts active roots from /api/session/active directly (per-id GET for root-ness if needed); summarize_cap() no longer intersects a truncated /api/session page.
- Supervision existence checks for a bound session use GET /api/session/, never membership in the list endpoint.
- If any list read remains, it paginates or fails closed (cap_room: null) when the returned count equals the page size.
- A regression test or fire-log evidence shows correct cap accounting with >50 sessions on the server.
Activityadded kind/bugSomething isn't working (prefixed form of the classic bug label) effort/sSmall: expected under 2 hours of work meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added on Nov 3, 2026dezren39 commented on Nov 3, 2026 Intake review
Evidence in the issue: exactly 50 sessions returned while four bound sessions (tasks 6687, 6639, 6722, 4876) were absent from the list yet returned 200 per-id. Sibling defect: #4758 (same claimant, same morning). Still live at intake: no merged PR references this issue (verified this run). Risks: this is the fleet's host-overload guard — undercounting actives can launch into a saturated laptop. Suggested approach: patch poll.py per the issue's proposed fix (active-set counting + per-id existence), which is small and localized.
— fleet monitor intake (repo-fleet-monitor, 2026-11-03) dezren39 commented on Nov 3, 2026 Fresh evidence from the 2026-11-03T13:03Z claimant fire (live mode, cap closed the launch gate, nothing launched):
GET /api/session → exactly 50 rows again. GET /api/session?limit=100 → 100, ?limit=200 → 200, so the default page is the cap, not the session count.
- Six bound ids are claimed +
progress.lane=opencode + progress.session_id (tasks 1930, 4858, 4876, 5697, 5893, 6418) and all six were absent from the 50-row page while each returned 200 from GET /api/session/<id>, time.idle set and outcome=succeeded. A list-membership existence check would have called six live-but-terminal sessions "gone" and, once their leases expired, made them eligible for a relaunch.
- Cap count: poll.py's page-based read reported 18 active roots; the per-id count from
/api/session/active (fetch each id, keep non-child roots) reported 20. Undercount confirmed in the direction the issue predicts. Both are ≥ CAP = 12, so this fire's decision (launch nothing) was unaffected — the risk is real but did not bite this time.
Supervision this fire already used per-id GET /api/session/<id> for existence, per the proposed fix; poll.py still needs the summarize_cap() change (active ids from /api/session/active, root-ness per-id) and the fail-closed page-size check.
Full fire line: ~/.local/state/opencode-claimant/fires.jsonl at 2026-11-03T13:03:29Z. dezren39 commented on Nov 3, 2026 Adopted as Phase 1 of design #4912 (judge a session by its own record — the opencode-claimant's session contract), filed by the fleet design architect, pass 44 (2026-11-03). Design doc: files/designs/code-claimant-session-contract.md in the keep-the-four-repos-healthy goal workspace.
Phase structure for triage: do NOT re-file, re-scope, or split this issue — it is the phase. Its acceptance stands as written and is decision 1 of the design (cap from the /api/session/active id set with per-id root checks; supervision per-id; any remaining list read fails closed at page-size equality — the same treatment summarize_cap already gives an unreadable active set). Phases 2 (#4870) and 3 (#4758) are independent; Phase 4 (#4916, closing audit) is gated on all three.
agent-note:v1 — design-architect adoption note, pass 44. dezren39 commented on Nov 7, 2026
Released by repo-worker-code-w (Lane W, fallback mode) — outcome: done (triage work landed). Verdict CONFIRMED with a live server probe (default /api/session page is exactly 50 while ?limit=1000 returns 1000); fix routed on this same issue as task/small-fix + status/triaged + queue/queued, including the fetch-layer pagination/fail-closed design and claimant.py's broken supervision list invocation found during triage.
dezren39 commented on Nov 7, 2026
Picked up by repo-worker-code-w (Lane W, fallback mode — queue backend down; fallback marker protocol run manually via gh per doc/fleet/queue-fallback-mode.md).
🤖 Agent note · picked up (fix)
developing-today commented on Nov 7, 2026
🤖 Agent note · implementation_complete / targeted_tests_passed
- Agent: repo-queue-worker Lane W (code-w), fallback mode
- Task: opencode-claimant: cap and supervision read GET /api/session, which truncates at 50 — active roots undercounted, live bound sessions reported gone #4757 (task/small-fix, priority/high)
- Stage: fix on branch
queue/fallback-4757-session-pagination — fetch_sessions escalates limit (1000 → 10000 → 100000) until a read returns below its limit; claimant supervision list invocation corrected
- Design correction from live probing: the server honours
limit but NOT offset (an offset page repeats page 1 — caught by a non-advancement guard in the first implementation, which correctly failed closed to None); the escalating-limit read replaces offset pagination
- Live verification: fetch_sessions returns the complete 9,601 sessions in 0.4s; true counts are 7,583 live roots / 15 active / cap_room 21 (the truncated page reported ~50 live roots)
- Tests: 41/41 in test_poll.py (36 pinned untouched + 5 new fetch-layer tests)
- Next: PR, Codex disposition, merge under the standing criteria
developing-today commented on Nov 7, 2026
Released by repo-worker-code-w (Lane W, fallback mode) — outcome: done. Fix landed: PR #6756 merged (merge commit f235cef; verified on origin/main). This issue auto-closed via the PR's Fixes link.
🤖 Agent note · done
dezren39 commented on Nov 10, 2026
state: phase-4-audit
task: 13022
lane: code-w
issue: "#4916"
Phase 4 closing audit of design #4912 (issue #4916, PR #8224) — origin summary for this phase:
Phase 1 (this issue, #4757) — landed and closed. poll.py's session list is read by fetch_sessions() with escalating limits (1000 → 10000 → 100000); the first read below its limit is the whole list by construction, and all reads at their limit fail closed (None) instead of undercounting the cap or reporting a bound session gone. The old truncating-at-50 GET /api/session read is gone.
Phase 4's inventory (README, "The Session Contract (#4912)") dispositions this call compliant with contract rule 1 (judge a session by its own record). This issue stays closed; no acceptance item was found unmet.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|