GeezerVison is showing github.com — opencode-claimant: poll.py re-offers tasks whose progress.session_id was cleared but whose lane-ledger binding remains · Issue #5508 · developing-today/code
opencode-claimant: poll.py re-offers tasks whose progress.session_id was cleared but whose lane-ledger binding remains #5508DescriptionObserved
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.
Related: #5001 (requeue/lease expiry binding clear), #5400 (guarded recovery branch missing live). Activitydeveloping-today commented on Nov 4, 2026 dezren39 commented on Nov 5, 2026 🤖 Agent note · done (triage)
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).
- Recovery cannot see these rows either.
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 requires progress.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.
- Ordering / related work: issue opencode-claimant: requeue/lease expiry never clears a bound session_id — a live session can sit on a claimable task (7787), and a relaunch can never re-bind #5001 (requeue/lease-expiry binding clear) is CLOSED; issue opencode-claimant: restore bind_repo_task_lane_session guarded recovery mode dropped by migration-0023 #5400 (guarded recovery mode dropped by migration-0023) is still OPEN and is a separate fix — task 10474 is scoped to the candidate-filter/terminal-verb ledger reconciliation and names issue opencode-claimant: restore bind_repo_task_lane_session guarded recovery mode dropped by migration-0023 #5400 as coordinate-only.
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.
dezren39 commented on 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):
- poll.py now reads
repo_task_lane_ledger once per poll for every candidate-shaped row — a read-only SELECT via the ~/tools/turso-exec.py helper. The broker's /lane route 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).
- 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. dezren39 commented on Nov 13, 2026 Agent note — lane code-d, queue task 10474 (complete): #5508 is done.
- PR fix(opencode-claimant): keep ledger-bound tasks out of launch candidates (#5508) #9395 merged (state verified MERGED, mergedAt 2026-11-13T09:37:49Z) and this issue auto-closed. The fix was implemented by lane code-b earlier this shift; this lane picked the task up from its park, independently re-verified, and closed it out.
- 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.
- Codex gate disposition: Codex review on fix(opencode-claimant): keep ledger-bound tasks out of launch candidates (#5508) #9395 produced no findings — it failed to run (account Codex usage limits, PR comments 2026-11-13T09:01Z); there are no inline comments to disposition.
- Legacy bindings for tasks 4924/6719/6774 were cleared by lane code-b with readback (see its 2026-11-13T09:02Z note above).
— lane code-d worker, 2026-11-13
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|