Skip to content

opencode-claimant(poll): candidate filter reads progress.stage, but the checkpoint verb writes progress.last_checkpoint.stage — ~60 recorded yields invisible per fire, stale stages offered unsafely #7706

Closed

Description

@dezren39

Symptom

Two yield encodings disagree, and poll.py reads the one the checkpoint verb does not write:

writer / reader field
repo-queue checkpoint (Turso backend, pkgs/fleet/crates/fleet-queue/src/turso_queue.rs:1759) progress.last_checkpoint.stage
poll.py is_candidate() (pm-stack/opencode-claimant/poll.py:123) progress.stage

verb_checkpoint merges {"last_checkpoint": {"stage": <stage>, "at": <ts>}} into progress; it never writes a top-level progress.stage. Every recorded yield therefore lands in last_checkpoint.stage, while the candidate filter reads a field that holds lane work stages (verified, parked, claimed, awaiting_ci, …) and is absent on most rows.

Measured on the laptop, same snapshot, claimed opencode-lane rows with no progress.session_id:

fire (UTC) progress.stage ∈ {handed_off, launch_failed} last_checkpoint.stage ∈ {handed_off, launch_failed}
2026-11-08T12:55Z 0 78
2026-11-08T13:04Z 1 67
2026-11-08T13:06Z 1 67
2026-11-08T13:36Z 1 57

Across all non-terminal statuses for lane opencode, 541 rows carry last_checkpoint.stage == "handed_off" and 119 of those also carry a top-level progress.stage == "handed_off"; the other 339 have no progress.stage at all.

Two failure directions

  1. Under-offer (the standing symptom). A real recorded yield is invisible unless the lane happened to also write a top-level progress.stage, so the claimant's gate reads 0–1 candidates and ends the fire quietly — on the same snapshot in which ~60–90 tasks are genuinely handed off. This is the mechanism behind opencode-claimant: handed-off tasks are never launched — executed_lane/session_id stay null across repeated claim→handed_off→park cycles #6533.
  2. Unsafe over-offer (the dangerous direction). A stale top-level progress.stage == "handed_off" keeps a task a candidate after its lane has resumed work. Task 8067 on 2026-11-08:
"stage": "handed_off",           // written 2026-11-04T12:39:59Z, never updated
"stage_at": "2026-11-04T12:39:59.900381Z",
"last_checkpoint": {"stage": "verified", "at": "2026-11-08T13:00:32Z"}

The lane verified the task four days later; the strict filter still offers it for launch. Launching into a task whose claiming lane is mid-work is exactly the double-execution defect #4490 hardened against. On the 2026-11-08T13:36Z fire the same shape appears on tasks 10501 (parked_awaiting_prereqs), 10606 (probe_lane_check), 12787 (pr_opened) and 12866 (awaiting_ci).

Why this matters now

poll.py's docstring and prompt.md both describe the yield as progress.stage == handed_off; the database never stores it there. Until the two agree, candidate discovery is either blind (today's steady state) or unsafe (when a lane's old progress.stage is stale). This is independent of, and invisible behind, the repo-queue list table defect (#7325 / #7375): even with the transport fixed (which #7673 partially addresses), the filter compares the wrong field.

Suggested fix (pick one, not both)

  • A. Read the recorded field. is_candidate() accepts the yield from progress.last_checkpoint.stage (and keeps accepting progress.stage for rows written by older paths), then rejects any row whose live progress.stage names a later work stage that is not itself a yield. Update test_poll.py's fixtures to the shape the verb actually writes.
  • B. Also write the top-level field. Have checkpoint_task stamp progress.stage alongside progress.last_checkpoint.stage, so one field is authoritative for both writer and reader. This needs a backfill decision for the ~500 existing rows.

A is contained in the claimant and testable offline; B changes the queue contract for every consumer of progress.stage (the lane prompts already read it for resume), so it is the larger change.

Acceptance

  • A task whose only yield marker is last_checkpoint.stage == "handed_off" is a candidate.
  • A task whose last_checkpoint.stage == "verified" (or any non-yield stage) is not a candidate even when a stale progress.stage == "handed_off" is present.
  • Both directions pinned in pm-stack/opencode-claimant/test_poll.py.

Evidence

Found 2026-11-08 by the opencode-claimant scheduled fire (shadow mode, #3026 slice 1), while reproducing candidate discovery over the queue-broker /list verb. Also recorded as a comment on #6533 at 2026-11-08T13:22Z. Read-only: no task was claimed, bound, launched, prompted or deleted.

Related: #6533 (parent symptom), #7325 / #7375 (transport read), #5508 (stale ledger binding), #4490 (double-execution guard).

Acceptance criteria

  • The claimant poll filter and the checkpoint verb agree on ONE canonical yield encoding (the filter reads the field the verb writes, or the verb writes the field the filter reads — one of the two, documented in code).
  • A regression test built from a checkpoint-written task row proves recorded yields (handed_off / launch_failed) are seen by the candidate filter.
  • No stale stage is offered as fresh: the filter's staleness behaviour for old yield records is explicit and tested.
  • On a live snapshot, the filter's yield count reconciles with the last_checkpoint.stage count (the ~60-per-fire discrepancy in the issue is closed).

Activity

  1. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor
  2. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/highImportant and time-sensitive
    effort/sSmall: expected under 2 hours of work
    source/humanFiled directly by a human
    app/fleetpkgs/fleet multicall binary + platform crates
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 8, 2026
  3. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: sibling claimant defect #6533 (handed-off tasks never launched — different mechanism, same component; check for interaction before closing either); the checkpoint writer is pkgs/fleet/crates/fleet-queue/src/turso_queue.rs, the reader is pm-stack/opencode-claimant/poll.py per the issue's evidence table.
    Live check: search found no merged PR or closed issue fixing the field mismatch; the issue's own measurements are from today (2026-11-08, four fires).
    Notes / risks: highest-leverage small fix in this run's intake set — every invisible yield is a task the claimant re-offers unsafely or never launches. Fix the encoding at one side only and migrate readers; a dual-write without a retirement plan recreates the drift.
    Suggested approach: make poll.py read last_checkpoint.stage (the verb is the fleet-wide writer; many more writers than readers), add the row-shape regression test, then grep for other progress.stage readers and record them on the issue.

    — fleet monitor (repo-fleet-monitor), 2026-11-08 08:12 CST run: acceptance criteria appended to the body, labels normalized, meta/enriched applied.

  4. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · design-architect pass 74 — adopted as a phase of design #7770

  5. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · Phase 4 evidence (design #7770 closing audit, issue #7772, task 14782)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/fleetpkgs/fleet multicall binary + platform crateseffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/highImportant and time-sensitivesource/design-architectFiled by the repo design architect jobsource/humanFiled directly by a humanstatus/needs-triageNot yet triaged; needs a first lookstatus:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions