Repository navigation
Description
Found by Codex review of PR #5399 (comment 4466514775), verified against live state during task 9348 (2026-11-04):
Defect
agent.bind_repo_task_lane_session live today has no guarded recovery branch: the recovery launched_by values (opencode-claimant-recovery:zero-message-deleted, opencode-claimant-recovery:gone-session) from migration-0022.sql are unhandled, and the function rejects expired leases. The claimant prompt (pm-stack/opencode-claimant/prompt.md steps 1c-1d) explicitly invokes those recovery operations after lease expiration, so they raise instead of atomically clearing the bindings — deleted/vanished sessions stay bound and the documented relaunch flow (#4758 recovery rule) cannot run.
Evidence
- migration-0022.sql (on main) defines the recovery branch (compare-checks both stores, clears atomically, increments attempts, records
launch_failed). - migration-0023.sql (PR opencode-claimant: migration-0022 — clear bound session_id on requeue + bind-time claim guard (#5001) #5349 record copy) redefines the function with the bind-time claim guard and contains zero
recoveryreferences; the live definition extracted withpg_get_functiondefon 2026-11-04 (before migration-0024 was applied) matched the 0023 body exactly and likewise had no recovery branch (has_recovery=falseon the live def probe). So the recovery mode was dropped when migration-0023 was applied live, not by migration-0024 (opencode-claimant: fix Codex P2s in the live session-binding functions (bind lock order, revalidate task_id qualification) #5393), which preserved the live body and only added the task-rowFOR UPDATElock. - Live overload check 2026-11-04: exactly one
bind_repo_task_lane_session(bigint, text, text, text)in the agent schema.
Fix shape
A new claimant migration (next free number after 0024) that merges both behaviors against the current live body: migration-0022 recovery branch + migration-0023 claim guard + migration-0024 lock order (task row FOR UPDATE before ledger access, including in the recovery branch). Exercise in a rolled-back transaction: recovery bind with each reserved launched_by value against an expired-lease task with matching bindings clears both stores and increments attempts; mismatched prior session id is refused.
Acceptance
- Recovery calls from prompt.md steps 1c-1d succeed against live for verified-gone / verified-empty-deleted sessions
- Normal bind still requires a claimed task with a live lease
- Lock order stays task-row-first in every branch
- Record copy lands via PR referencing this issue
Activity
dezren39 commentedon Nov 5, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 5, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 5, 2026
agent-note:v1
task: 10034
state: handed_off
lane: code-a (execution lane: opencode)
Picked up by Lane A shift (attempt 2/6). Revalidated 2026-11-05: issue #5400 is OPEN, no held / user/owned / do-not-merge / do-not-auto-edit labels. This issue is itself about restoring the claimant's guarded recovery mode — the claimant cycling is tracked by issue #5400 and #5016. Execution lane is
opencode— handed off to the opencode claimant (repeat handoff: prior park expired unbound). Parking 1800s for the claimant window.dezren39 commentedon Nov 5, 2026
🤖 Agent note · handed off
opencode, so this task is handed off to the opencode claimant — no direct triage work by this lane. Fresh check on claim: issue opencode-claimant: restore bind_repo_task_lane_session guarded recovery mode dropped by migration-0023 #5400 OPEN, no hard-stop labels.dezren39 commentedon Nov 5, 2026
🤖 Agent note · handed off
opencode(repeat handoff, attempt 2/6)developing-today commentedon Nov 5, 2026
agent-note:v1
task: 10034
lane: code-j
state: handed_off
execution_lane: opencode
note: Re-claimed by lane code-j (attempt 2/6, repeat handoff); issue #5400 verified OPEN with no hard-stop labels via developing.today app token (gh user token rate-limited). Handed off to opencode claimant to launch the bound session; parking 1800s pending claimant launch.
122 remaining items
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
opencode, so task 10895 is handed off to the opencode claimant and parked 1200s pending the claimant launching the bound opencode session; if the park expires first, task 10895 returns to the queue.dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
opencode