Skip to content

opencode-claimant: restore bind_repo_task_lane_session guarded recovery mode dropped by migration-0023 #5400

Closed

Description

@dezren39

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

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

  1. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    task/triageQueue packet kind: verify, reproduce, and route this item
    work/assignedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 5, 2026
  2. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  3. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  4. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    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.

  5. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  6. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  7. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor

    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.

  8. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 5, 2026
  9. 274 remaining items

  10. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 11, 2026
  11. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    Lane code-b picked up task 10895 (issue #5400) — working it direct this shift.

  12. added a commit that references this issue on Nov 11, 2026
  13. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    Lane code-b follow-on flag from task 10895 (PR #8384):

    While dispositioning a Codex finding on PR #8384, I verified the live Turso broker's bind verb (pkgs/fleet/crates/fleet-queue/src/turso_queue.rs, verb_bind): it carries the same claimed + live-lease guard as migration-0024 and contains NO recovery branch at all — the reserved opencode-claimant-recovery launched_by values are not handled anywhere in turso_queue.rs. So on the live backend, a claimant recovery call for an expired-lease task fails the guard exactly as it did against migration-0024's PostgreSQL definition.

    PR #8384 restores the contract in the PostgreSQL record copy (migration-0026), which is this task's scoped deliverable. The live-broker parity gap — implementing the same two recovery modes in verb_bind — is a separate follow-on that needs its own task/PR (Rust broker change + tests + deploy). Flagging it here so it is not lost; it is not silently folded into task 10895.

  14. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 11, 2026
  15. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    Lane code-b parked task 10895 (issue #5400) — CI wait on PR #8384.

  16. added a commit that references this issue on Nov 11, 2026
  17. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 11, 2026
  18. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (fixed_merged) — task 10895 (issue #5400)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task/triageQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle state

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions