Skip to content

opencode-claimant: the 12-session cap is consumed by lane runners, the claimant itself and an 18h zombie session — so 44 eligible candidates never launch #5016

Closed

Description

@dezren39

Summary

The opencode-claimant's 12-session cap is consumed almost entirely by sessions that
are not the work it is trying to launch, so the claimant starves: 44 eligible
unbound opencode-lane candidates existed at the 2026-11-03 10:10 CT fire and the
gate closed with cap_room: 0 for the third fire running (also 15:45Z and 16:03Z).

Measured at 2026-11-03T16:12-16:13Z, via GET /api/session/active + a per-id
GET /api/session/<id> (per-id reads because the list truncates, #4757):

component count note
active root sessions 14 0 children
scheduled lane runners from the 10:00 CT fire 11 titles Queue lane (scheduled) - code/opencode 2026-11-03 10:00
bound task worker sessions 1 task 8067, genuinely running (50 msgs, last message 0.4 min before the check)
the claimant session itself 1 ses_e5e5dd34a9fffehVF6gEz57StG, this fire
unbound orphan session, idle ~18h 1 see below

Cap is 12, so the fire was over by 2 and launched nothing.

Two concrete problems

  1. The claimant counts itself against its own cap. Each fire is a root session,
    so a fire with plenty of capacity still spends one slot on the gatekeeper. At
    the margin that is the difference between launching and not.

  2. A live-looking zombie holds a slot indefinitely. Session
    ses_e5e61b938bfffeywl78cVRVoec, title Queue lane (scheduled) - opencode 2026-11-02 16:00, is in /api/session/active ({"type": "running"}) with
    no outcome and no time.idle, but its last message is
    2026-11-02T22:18:51Z (~17.9 h idle). No task row carries its id in
    progress.session_id (ledger query returns []), i.e. it is not a bound
    task session, so supervision correctly will not touch it and no worker owns
    it. It simply occupies one of the 12 slots.

Secondary

poll.py reported live_root_sessions: 50 — exactly the GET /api/session
page size — so the fleet total is still truncated (#4757). cap_room itself is
computed from /api/session/active, which is unaffected, so the gate is not
wrong here; only the reported total is.

Asks

Evidence

Fire log lines: ~/.local/state/opencode-claimant/fires.jsonl at
2026-11-03T16:12:52Z (fire) and its 16:13Z supplement (cap composition +
stall report). Read-only fire; nothing was claimed, bound, launched or mutated.

Acceptance criteria

  • The claimant's session-cap accounting no longer counts the claimant's own fire session against the cap it enforces (or the cap is explicitly defined to include it and the starvation math is re-derived and documented).
  • Sessions present in /api/session/active with no queue binding, no outcome, and no activity beyond a stated staleness threshold are reaped or explicitly owned, so a zombie cannot hold a cap slot indefinitely.
  • A claimant fire with eligible unbound candidates and real capacity launches work; the cap_room: 0 starvation measurement from 2026-11-03T16:12Z no longer reproduces under the same session mix.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/queue-workerFiled or worked by the queue/worker pilot
    priority/normalOrdinary priority (the default)
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    effort/mMedium: expected under 1 day of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 3, 2026
  2. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 8578 (triage, queued, priority 40) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

  3. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Intake review

    Fleet monitor intake (Duty 2), 2026-11-03. (Posted on a delayed retry: the original comment attempts were rejected by a GitHub secondary rate limit; the label/body enrichment itself landed during the run.)

    • Related: code#5001 (sibling claimant defect filed the same hour — bound-session lifecycle on requeue), code#4757 (per-id session reads; the list truncates).
    • Still live: measured live at filing (2026-11-03T16:12Z, third consecutive starved fire); no fix has landed since.
    • Notes: the filer's session census is the evidence — 11 of 14 root sessions were scheduled lane runners, 1 was the claimant itself, 1 an ~18h unbound zombie. Acceptance criteria appended; effort set to m (claimant accounting + a reaping rule, not a rewrite).
    • Risks: reaping a session that is merely slow would kill real work — the staleness rule needs the same conservatism as the babysitter's (no binding + no activity + no outcome, all three).
    • Suggested approach: fix the self-count first (one-line accounting change, immediately unblocks the marginal slot), then the zombie rule.
  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 3, 2026
  5. 29 remaining items

  6. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Released to the queue under Drew's 2026-11-13 unblock-all order (main chat, 23:53 CT). Task(s) 8578 moved from blocked/parked to queued in the fleet unblock-all pass (worker main-unblock-all-2026-11-13). Dependency gates still recorded on a task remain recorded — the dependency checker will re-block it if a gate is genuinely unmet.

  7. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Agent note — task 8578 blocked, escalated-to-user (lane any-b)

  8. added
    queue/blockedQueue or user escalation state
    status/blockedQueue or user escalation state
    and removed
    work/assignedQueue worker lifecycle state
    on Nov 14, 2026
  9. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    Agent note — task 8578 triaged: cap-semantics ruling RECORDED, escalation closed (lane any-c)

    • state: triaged (ruling applied; fix follow-on enqueued separately)
    • task: 8578
    • issue: opencode-claimant: the 12-session cap is consumed by lane runners, the claimant itself and an 18h zombie session — so 44 eligible candidates never launch #5016
    • kind: triage (opencode-claimant 12-session cap consumed by lane runners / claimant / zombie session)
    • The recorded next step ("block escalated-to-user naming ledger item session-cap-5016") is STALE: ledger item session-cap-5016 was ANSWERED at 2026-11-16T02:00:33-06:00 via orchestrator-audit-2026-11-16 (fleet-decidable under Drew's 2026-11-12 cap doctrine — caps that bind work intake are unwanted). A decision already recorded is never re-asked, so this lane records the ruling here instead of re-escalating.
    • RULING: "The 12-session cap counts claimant (root) sessions; scheduled lane runners are fleet infrastructure outside the cap; claimant headroom is an implementation parameter, initially at current de-facto behavior."
    • What this means for the fix: the claimant's cap accounting (poll.py counts every active root toward the 12) must count only claimant root sessions — lane-runner sessions are excluded from the cap; headroom stays an implementation parameter at current de-facto behavior until tuned. The 18h zombie-session half of this issue remains a real defect for the fix to address (stale sessions must not hold slots).
    • Actions this shift: user/escalated removed (the wait on Drew is over), queue/status blocked labels cleared at task completion, fix follow-on enqueued (dedupe-checked) and named in task 8578's completion result. Issue opencode-claimant: the 12-session cap is consumed by lane runners, the claimant itself and an 18h zombie session — so 44 eligible candidates never launch #5016 stays OPEN for the fix.
  10. added and removed
    status/blockedQueue or user escalation state
    user/escalatedRequires a Drew decision or access
    queue/blockedQueue or user escalation state
    on Nov 16, 2026
  11. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    Conductor dispatch (2026-11-16 12:05Z): task 17428 claimed by worker fleet-conductor, session ses_e5e1bbe701affeocuJpkrCzqna, worktree ~/git/fleet/17428-5016-claimant-cap, branch queue/17428-5016-claimant-cap off origin/main bb57b6f588. Implementing recorded ruling session-cap-5016 (cap counts claimant roots only; lane runners outside). Acceptance: claimant launches up to 12 claimant roots with runners active; zombies expire out of the count; existing claimant tests pass. Sibling note: task 17446 (#3418) is in-flight in the same pm-stack/opencode-claimant area; worker instructed to keep the diff to cap accounting + staleness handling.

  12. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · fix landed · ruling session-cap-5016 (#5016)

    Failing test I started from (TestClaimantCapAccounting in pm-stack/opencode-claimant/test_poll.py, class at test_poll.py:124): the #5016 census oracle — 11 scheduled lane runners + the claimant's own fire session + 1 genuinely running bound work root + the ~18 h unbound zombie — must count 1, not 14. 5 of the 11 tests failed against the old accounting ((live, active, room) came back (3, 3, 33) for a lane-runner + worker mix; the 18 h zombie counted as active through the server's active set).

    Code path changed:

    • pm-stack/opencode-claimant/poll.py:414 is_scheduled_session — oracle metadata.openchamber.kind == "scheduled", stamped by OpenChamber on every scheduled task session (verified live 2026-11-16 across 366 roots); Queue lane (scheduled) / Opencode lane claimant/executor title prefixes as the legacy fallback. Unknown metadata counts, never manufactures room (fail-closed).
    • pm-stack/opencode-claimant/poll.py:439-446 is_claimant_root_session + staleness bound in _active_root_state — a server-active root whose time.updated has not moved for ACTIVE_SET_STALE_MS (= 2 h, poll.py:127) is a zombie and releases its slot.
    • pm-stack/opencode-claimant/poll.py:501 count_active_claimant_roots feeds summarize_cap (poll.py:512) and get_active_root_session_count (poll.py:841); claimant.py:303 delegates to the same function so the two entry points cannot diverge.
    • prompt.md / README.md state the cap as claimant roots only.
    • Cap value unchanged (36; raised 12 → 20 → 36 on 2026-11-05 per prompt.md). No scheduler/cadence changes.

    Staleness bound (2 h) rationale: 4x the 30 min marker window (a resumed session keeps earlier-run markers) and 9x below the observed 18 h zombie; OpenCode refreshes time.updated on every step, so a live session's clock moves far faster. Releasing a slot only changes cap accounting — it never kills a session, so a false positive costs one slot, not lost work. Open question recorded with my default: whether the watchdog should also close zombie sessions (out of scope here) — default: no, accounting-only release is the safe half; termination is a separate watchdog decision.

    Test command + result: cd pm-stack/opencode-claimant && python3 -I run_hermetic_tests.py → Ran 124 tests ... OK. Live read-only server check 2026-11-16: 22 active roots → only 4 claimant roots (old cap_room 14, new cap_room 32).

    Branch/PR: PR #10733, merge-ready on review.

  13. added a commit that references this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/mMedium: expected under 1 day of workepic/opencode-platformReprioritization program epic (2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)queue/queuedHas a queued queue tasksource/queue-workerFiled or worked by the queue/worker pilottask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions