You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode-claimant: poll.py re-offers tasks whose progress.session_id was cleared but whose lane-ledger binding remains #5508
The Nov 4, 2026 claimant fire (14:33Z) re-discovered three tasks as launch candidates, created a session for each, and had bind reject all three because the lane ledger still held an older binding:
task 4924 — already bound to ses_e5e59622aafffeKleYpA1NrmWc
task 6719 — already bound to ses_e5e5961e557ffe77gDqN8yhAC8
task 6774 — already bound to ses_e5e595f0ef9ffe3LOpHRLqutug
All three sessions are absent from GET /api/session. Each task's progress.session_id is null and carries a progress.session_cleared record written by fail_repo_task / park_task on 2026-11-04 around 13:00Z. The previous fire hit the same three conflicts.
Defect
poll.py's candidate filter checks only progress.session_id. The bind guard checks the lane ledger (bind_repo_task_lane_session). When a terminal verb clears progress but leaves the ledger binding, the task is permanently re-offered: every fire creates a session, then deletes it on the bind conflict.
Impact
One wasted session create/delete per affected task per fire.
Candidate counts and cap accounting stay noisy.
The true state (ledger-bound, session gone, progress unbound) matches neither the claimant's launch path nor its recovery rule, because recovery is keyed on progress.session_id.
Fix direction
Reconcile the two stores when a terminal verb clears a session, and make poll.py treat an existing lane-ledger binding as bound (or surface it as a distinct stale-binding row). Ensure the fix also clears ledger bindings for the affected legacy rows.
Triage findings (verified fresh 2026-11-05 at current main):
Confirmed — poll.py has no lane-ledger input at all. In pm-stack/opencode-claimant/poll.py, is_candidate checks only progress.lane == "opencode", progress.session_id empty, progress.stage in (handed_off, launch_failed), and the claiming-lane shape. fetch_claimed returns task rows via the broker /list; nothing in the file reads the lane ledger. A task whose progress.session_id was cleared by a terminal verb while its ledger binding remains is therefore indistinguishable from an unbound candidate and is re-offered every fire — the issue opencode-claimant: poll.py re-offers tasks whose progress.session_id was cleared but whose lane-ledger binding remains #5508 loop (task 4924, task 6719, task 6774).
Disposition: follow-up small_fix task 10474 enqueued (queue repo-health-code-pilot): stop re-offering progress-cleared/ledger-bound tasks (ledger consult in poll.py and/or atomic ledger clearing in the terminal verbs), surface stale bindings distinctly, clear the legacy bindings for task 4924, task 6719 and task 6774 if still present, and add test_poll.py coverage. Issue #5508 stays open for task 10474.
A claimed opencode-lane task whose progress.session_id is clear but whose ledger binding still carries a session_id is not offered as a launch candidate; it is surfaced in the new top-level + per-queue stale_binding output with the ledger session id / updated_at.
An unreadable ledger fails closed: no candidates, candidate-shaped rows reported stale with ledger_readable: false.
is_candidate, the handed_off/launch_failed stage gate, and the OpenChamber UUID-lane exclusion are unchanged.
Acceptance evidence:
python3 -m unittest pm-stack/opencode-claimant/test_poll.py → 81 tests OK, including 13 new TestStaleBinding cases (progress-cleared + ledger-bound not launchable; unbound/no-row rows stay candidates; existing candidate/stuck-bound suites pass).
Live run of the new poll.py on the laptop: exit 0, ledger_readable: true.
Legacy bindings cleared:repo_task_lane_ledger.session_id set NULL for tasks 4924, 6719, 6774 (all terminal — done/cancelled/done; 2026-11-04 bindings; UPDATE affected 3 rows, readback verified). Task 15341's binding was left for its own lane's reconciliation.
Task 10474 is parked pending Codex review of PR #9395; resume = disposition findings, merge, close this issue.
Independent verification (lane code-d): ran python3 -m unittest pm-stack/opencode-claimant/test_poll.py in the PR worktree at head 5ab18e2dab — 81/81 OK; skimmed the poll.py diff: read-only ledger SELECT via ~/tools/turso-exec.py (the broker /lane assign route is never used as a read — the valid Codex P2 on closed fix(opencode-claimant): surface cleared lane bindings #7059 is addressed), stale-binding rows surfaced separately, unreadable ledger fails closed.
Activity
developing-today commentedon Nov 4, 2026
CODE-1345
dezren39 commentedon Nov 5, 2026
🤖 Agent note · done (triage)
Triage findings (verified fresh 2026-11-05 at current main):
poll.pyhas no lane-ledger input at all. Inpm-stack/opencode-claimant/poll.py,is_candidatechecks onlyprogress.lane == "opencode",progress.session_idempty,progress.stagein (handed_off,launch_failed), and the claiming-lane shape.fetch_claimedreturns task rows via the broker/list; nothing in the file reads the lane ledger. A task whoseprogress.session_idwas cleared by a terminal verb while its ledger binding remains is therefore indistinguishable from an unbound candidate and is re-offered every fire — the issue opencode-claimant: poll.py re-offers tasks whose progress.session_id was cleared but whose lane-ledger binding remains #5508 loop (task 4924, task 6719, task 6774).is_stuck_bound(the opencode-claimant: bound session that never received its prompt (task 6722) has no recovery path — stuck claimed forever #4758 classification) also requiresprogress.session_id, so stale-ledger rows match neither the launch path nor the recovery path — exactly the impact stated on issue opencode-claimant: poll.py re-offers tasks whose progress.session_id was cleared but whose lane-ledger binding remains #5508.Disposition: follow-up small_fix task 10474 enqueued (queue repo-health-code-pilot): stop re-offering progress-cleared/ledger-bound tasks (ledger consult in
poll.pyand/or atomic ledger clearing in the terminal verbs), surface stale bindings distinctly, clear the legacy bindings for task 4924, task 6719 and task 6774 if still present, and addtest_poll.pycoverage. Issue #5508 stays open for task 10474.255 remaining items
dezren39 commentedon Nov 13, 2026
Agent note (lane code-b, task 10474): fix implemented; PR open for review.
PR: #9395 (
queue/10474-5508-poll-stale-binding, from current origin/main)What changed (
pm-stack/opencode-claimant/poll.py+test_poll.py):repo_task_lane_ledgeronce per poll for every candidate-shaped row — a read-only SELECT via the~/tools/turso-exec.pyhelper. The broker's/laneroute assigns a lane and is never used as a read (this was the valid, unaddressed Codex finding on the closed PR fix(opencode-claimant): surface cleared lane bindings #7059; this PR supersedes fix(opencode-claimant): surface cleared lane bindings #7059).progress.session_idis clear but whose ledger binding still carries asession_idis not offered as a launch candidate; it is surfaced in the new top-level + per-queuestale_bindingoutput with the ledger session id / updated_at.ledger_readable: false.is_candidate, thehanded_off/launch_failedstage gate, and the OpenChamber UUID-lane exclusion are unchanged.Acceptance evidence:
python3 -m unittest pm-stack/opencode-claimant/test_poll.py→ 81 tests OK, including 13 newTestStaleBindingcases (progress-cleared + ledger-bound not launchable; unbound/no-row rows stay candidates; existing candidate/stuck-bound suites pass).ledger_readable: true.repo_task_lane_ledger.session_idset NULL for tasks 4924, 6719, 6774 (all terminal — done/cancelled/done; 2026-11-04 bindings; UPDATE affected 3 rows, readback verified). Task 15341's binding was left for its own lane's reconciliation.Task 10474 is parked pending Codex review of PR #9395; resume = disposition findings, merge, close this issue.
Merge pull request #9395 from developing-today/queue/10474-5508-poll-…
dezren39 commentedon Nov 13, 2026
Agent note — lane code-d, queue task 10474 (complete): #5508 is done.
python3 -m unittest pm-stack/opencode-claimant/test_poll.pyin the PR worktree at head5ab18e2dab— 81/81 OK; skimmed the poll.py diff: read-only ledger SELECT via~/tools/turso-exec.py(the broker/laneassign route is never used as a read — the valid Codex P2 on closed fix(opencode-claimant): surface cleared lane bindings #7059 is addressed), stale-binding rows surfaced separately, unreadable ledger fails closed.— lane code-d worker, 2026-11-13