Skip to content

opencode-claimant(poll): repo-queue list emits a table, not JSON — every queue read fails and candidate discovery is blind fleet-wide #7325

Closed

Description

@dezren39

Symptom

Every fire of pm-stack/opencode-claimant/poll.py prints, for all four queues:

Warning: Could not poll queue repo-health-code-pilot: Expecting value: line 1 column 1 (char 0)
Warning: Could not poll queue repo-health-opencode-pilot: Expecting value: line 1 column 1 (char 0)
Warning: Could not poll queue repo-health-openchamber-pilot: Expecting value: line 1 column 1 (char 0)
Warning: Could not poll queue repo-health-nix-pilot: Expecting value: line 1 column 1 (char 0)

and reports candidates: [], stuck_bound: [] for every queue.

Cause

fetch_claimed_rows() (poll.py:288) runs:

repo-queue list --queue <queue> --status claimed

and then json.loads(result.stdout). But ~/fleet-brokers/bin/repo-queue list emits a human-readable table, not JSON. There is no JSON mode in the CLI either:

$ repo-queue list --queue repo-health-code-pilot --status claimed --json
repo-queue: unrecognized argument: --json
$ ... --format json   -> unrecognized argument
$ ... --output json   -> unrecognized argument

So json.loads always raises and every queue contributes zero rows.

Impact

This is not a transient outage — the claimed set is large. At fire time 2026-11-08T05:45Z the four queues held 37 claimed tasks (code 20+, opencode 7, openchamber 3, nix 6). The claimant cannot see any of them, so:

  • Candidate discovery is blind fleet-wide. Any claimed, lane-opencode, unbound task at a recorded yield stage is invisible and never launched. The fire ends "No unbound opencode-lane candidates found" and looks healthy.
  • Supervision is blind. stuck_bound (the opencode-claimant: bound session that never received its prompt (task 6722) has no recovery path — stuck claimed forever #4758 zero-message / gone-session recovery set) is derived from the same claimed rows, so bound-but-dead sessions are never reported or recovered.
  • The fire log under-reports.```cap_roomis recorded as 0 withskips: [{reason: no_candidates}]` even when a direct poll shows room (23 at the time of this report). A saturated-cap reading and an unreadable-queue reading are indistinguishable in the log.

This is the "standing claimant never went live" failure mode in a new form: the process runs, exits 0, and reports nothing to do.

Proposed fix

Either:

  1. Give repo-queue list a JSON output mode (--json) that serialises the broker rows including progress, and have fetch_claimed_rows() use it; or
  2. Have poll.py reach the queue-broker HTTP API directly (the same route the CLI uses) and parse the rows there.

Option 1 is smaller and keeps poll.py's "read-only by construction" property anchored on the CLI. Whichever is chosen, poll.py should also distinguish "queue unreadable" from "queue empty" in its output and in the claimant fire log, so a broken read can never be reported as no_candidates.

Verification

$ repo-queue list --queue repo-health-opencode-pilot --status claimed

returns a table with 7 claimed rows; python3 pm-stack/opencode-claimant/poll.py should then report those rows (filtered by lane/stage) instead of [].

Related: #6865 (claimant.py imports), #6868 (poll.py crash on malformed session time), #4758 (recovery rule), #3026 (slice 1).

Acceptance criteria

  • The problem described above is confirmed against current main (reproduced or traced to the named code path), or the issue is closed with that evidence.
  • A fix/implementation addressing the described behaviour is merged via PR referencing this issue, with tests naming their oracle where the change has meaningful invariants.
  • Related step/sibling issues from the same filing batch are cross-linked and any dependency is recorded as a native blocked-by relation.

Activity

  1. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Reproduced on the 2026-11-08 opencode-claimant fire (shadow mode, laptop primary).

    poll.py emitted the four Expecting value: line 1 column 1 warnings and returned candidates: [], stuck_bound: []. Direct CLI reads at the same moment show 36 claimed tasks across the four queues (code 20, opencode 7, openchamber 5, nix 2) — all invisible to the claimant.

    Two aggravating details found in the same fire:

    1. The fire log actively misreports. claimant.py recorded cap_room: 0 with skips: [{reason: no_candidates}], while a direct poll.py read reported active_root_sessions: 10 and cap_room: 26 of 36. So a broken queue read is logged as a saturated cap and as no work — exactly the indistinguishable-from-healthy failure the issue predicts. (claimant.py's cap_step() also subtracts poll.py's already-computed cap_room from 36 a second time, which would under-report room even with a working poll.)
    2. Supervision is blind too, not just launch: stuck_bound derives from the same claimed rows, so opencode-claimant: bound session that never received its prompt (task 6722) has no recovery path — stuck claimed forever #4758 zero-message / gone-session recovery cannot fire while this is open.

    Also filed #7349: repo-queue list and health reject --worker, which the packet mandates on every verb — relevant to whichever fix route is taken here, since option 1 (a --json mode) will be touched alongside it.

  3. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Additional facet found on the 2026-11-08T06:25Z shadow fire (laptop primary, main @9615ae1e11):

    repo-queue list does not only emit a table — it caps its output at 20 rows, with no pagination or offset flag. So option 1 (a --json mode for list) would not be sufficient for the claimed set as it stands:

    $ repo-queue list --queue repo-health-code-pilot --status claimed | tail -n +3 | grep -c "^task "
    20
    $ repo-queue health          # authoritative counts, same moment
    repo-health-code-pilot          ... claimed 181 ...
    repo-health-openchamber-pilot   ... claimed   5 ...
    repo-health-opencode-pilot      ... claimed   2 ...
    repo-health-nix-pilot           ... claimed   2 ...
    

    list with --offset, --page, --after, --all, --limit all fail as unrecognized argument (the same class as the --json/--format rejections in the body). The three queues below 20 rows match health exactly; code-pilot is capped.

    Consequence: at 06:26Z the four queues held 190 currently-claimed tasks (code 181, openchamber 5, opencode 2, nix 2) and poll.py saw none — and even a JSON-shaped list would still return at most 20 rows for code-pilot. This points at option 2 (poll.py reads the broker HTTP API directly and requests the full claimed set) rather than adding --json to a verb that is itself truncated.

    Supervision was clean this fire: the 6 lane-ledger-bound opencode sessions all exist, are terminal (time.idle + outcome: succeeded) and carry messages, so none satisfy the #4758 stuck_bound rule. Related: #7349 (--worker rejected), #6868, #6865.

  4. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Claimant fire 2026-11-08T06:3xZ — reproduction confirmed, plus two sharpening details

    Shadow fire on the laptop (mode file absent → shadow, so no claim/bind/launch):

    • all four queues reproduce the warning exactly as filed (Expecting value: line 1 column 1);
    • poll.py therefore reports candidates: [], stuck_bound: [], and cap_room from summarize_cap only.

    Two facts that narrow the fix:

    1. Switching to the canonical fleet binary does not help. The deployed client
    ~/fleet-brokers/bin/repo-queue is the pre-fleet rollback build (fleet-brokers/SUPERSEDED.md);
    poll.py points at it via REPO_QUEUE_CMD. The canonical fleet queue
    (~/.local/bin/fleet, source rev 48cd308ac5b9, pkgs/fleet/crates/fleet-queue/src/client.rs)
    has the same defect: cmd_list hard-codes the six-column table and parse_args accepts only
    queue/status/limit/not-before, so --json, --rich, --format are all
    unrecognized argument. The fix has to land in the client (or in poll.py), not in the binary choice.

    2. A JSON mode alone is still insufficient unless it also carries the rich columns and a usable limit.
    The broker /list verb already supports both — rich: true returns
    worker_id, lease_until, lane_id, attempts, max_attempts, progress on top of the table columns
    (turso_queue.rs:2368), and limit is validated 1..=500. The client sends neither
    (rich is never set; limit defaults to LIST_LIMIT_DEFAULT = 20). Twenty rows is below the
    current claimed set in every queue (191 / 2 / 6 / 1 at fire time), so a thin --json would still
    have hidden ~170 claimed rows and every progress-bearing field the classifiers read.

    Verified working read path (used to produce this fire's shadow report, no code change):
    POST /list {"queue": q, "status": "claimed", "limit": 500, "rich": true} through the same
    ~/.config/repo-queue/broker-url + ~/.config/queue-broker/token route the CLI uses. That yields
    189 claimed rows across the four queues and 14 real is_candidate() hits at fire time
    (5 × priority 15, 9 × priority 30 in repo-health-code-pilot; the other three queues have none),
    all stage: handed_off, all unbound, none carrying a hard-stop label.

    Supervision is genuinely empty, not merely unread: zero claimed rows carry
    progress.session_id in any queue. (85 bound sessions exist fleet-wide, all on
    blocked/failed/done rows, which supervision does not cover.) So stuck_bound: [] above
    is a true zero once the read is fixed.

    Scope note: even with #7325 fixed, live launch stays inert until #6865 lands — claimant.py
    at HEAD is the shadow-only stub (launch_step fabricates sim- ids) and its own
    test/test_claimant.py errors 4/4 on missing _POLL / _verify_candidate_is_current.
    PRs #6990 and #7290 are the restores. Cap is not the constraint: cap_room 30 vs 14 would-launches.

  5. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Independent confirmation from a shadow fire (2026-11-08T06:35Z)

    Reproduced on the laptop primary clone, mode absent → shadow:

    $ python3 pm-stack/opencode-claimant/poll.py
    Warning: Could not poll queue repo-health-code-pilot: Expecting value: line 1 column 1 (char 0)
    ... (all four queues)
    live_root_sessions: 8752, active_root_sessions: 6, cap: 36, cap_room: 30
    candidates: [], stuck_bound: []          <- false empty
    

    Directly against the same binary, same argv poll.py uses:

    $ repo-queue list --queue repo-health-code-pilot --status claimed
    rc = 0
    first line: "task        priority  status   age       dedupe_key ..."
    data rows: 20
    json.loads(stdout) -> JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    

    So the failure is deterministic and rc == 0, which is why nothing above fetch_claimed_rows notices. Confirmed there is no JSON mode: --json, --format json, --output json are all "unrecognized argument", and strings on the binary shows no such flag.

    Two additions beyond the original report

    1. claimant.py supervision has the same defect, independently. supervision_step() (claimant.py:~188) makes the identical repo-queue list --status claimed call and does json.loads(result.stdout) inside a bare except Exception: continue. In live mode that means step 1 — the supervision the Move opencode executions to laptop-side scheduled tasks — retire the Muse boot handoff #3026 choice puts first — silently supervises nothing. Fixing only poll.py leaves supervision blind. Both call sites need the same treatment.

    2. The test suite cannot catch this. test_poll.py::TestFetchClaimedRows stubs subprocess.run and feeds it json.dumps(payload), so it asserts against a JSON contract the real CLI does not honour. Any fix should add a test that pins the actual CLI output shape (or, if option 1 lands, that --json is passed), otherwise the stub keeps the regression green.

    Fire-log note

    The fire at 06:35Z logged cap_room: 0, skips: [{reason: no_candidates}] — cap_room 0 is also wrong (a direct poll showed 30). I appended a corrected line for that fire recording queue_read_failure_false_empty and cap_room: 30. Agreed with the proposal that the fire log must distinguish "queue unreadable" from "queue empty"; right now a total read failure is indistinguishable from a quiet fleet.

  6. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Second finding after #7290 merged — the gate is now the only thing blocking live launches, and the restored launch path stops at bind

    Re-ran a shadow fire after PR #7290 merged (#6865 closed 06:31:52Z) and the primary fast-forwarded to 9f5a92057d.

    #7325 still reproduces at HEAD. poll.py fetch_claimed_rows() is unchanged since 8e2607a4fe: it shells ~/fleet-brokers/bin/repo-queue list --queue Q --status claimed and json.loads the table, so all four queues warn and candidates is []. claimant.py's gate calls run_poll(), so the restored live path inherits the blindness verbatim.

    Consequence for priority: this is now the single blocker between cap_room: 30 and 13 real would-launches.

    A read-only POST /list {status:"claimed", limit:500, rich:true} returns 170 claimed rows in repo-health-code-pilot, of which 13 pass poll.is_candidate() (5 at priority 15, 8 at priority 30; zero in the other three queues). None carries a hard-stop label. 5 of the 13 are attempts >= max_attempts.

    Two further defects the fixed read exposes in the restored launch_step (HEAD 9f5a92057d, claimant.py:347-509)

    These matter because the moment #7325 lands, live mode stops being a no-op and starts doing them:

    1. Step 4d never sends the prompt. claimant.py:477-489 builds the prompt f-string and then says
      # In a real implementation, this would send the prompt via the session API / For now, we just record the successful launch.
      There is no POST to the session. A live fire would therefore bind a session and never prompt it — creating exactly the zero-message bound state that opencode-claimant: bound session that never received its prompt (task 6722) has no recovery path — stuck claimed forever #4758's recovery rule exists to clean up, on every launch, for every task.
    2. No checkpoint --stage launched (step 4c), no agent-note (4e), no hard-stop label check, no attempts < max_attempts gate. grep for checkpoint, agent-note, and the four hard-stop labels in claimant.py returns zero hits each. Launch order is still create → verify location → bind → drop prompt, which is bind-safe but leaves no launched stage on the task and no issue record.

    So the ordering is right (create → verify location.directory → bind) and the bind failure path deletes the session — that part matches the spec. What's missing is everything after bind.

    Suggested split (both are pre-existing at HEAD, neither is caused by the restore):

    Supervision is genuinely empty right now: zero claimed rows in any of the four queues carry progress.session_id, so stuck_bound: [] is a true zero rather than a read failure.

  7. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Split out as #7356: the restored launch_step binds a session and never sends the prompt (plus missing checkpoint launched, agent-note, hard-stop/attempts gates, and the single-instance lock / bounded pool the task description claims). That is pre-existing at HEAD and independent of this read defect — but it becomes live the moment this lands.

  8. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 8, 2026
  9. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · shadow claimant fire 2026-11-08T13:00Z

    Re-confirmed at HEAD from the OpenChamber scheduled claimant (task f1b4a33b-…, mode file absent → shadow).

    • poll.py reported claimed: 0, candidates: 0, stuck_bound: 0 for all four queues and cap_room: 22.
    • repo-queue health at the same moment: 103 claimed (code 89, opencode 9, openchamber 3, nix 1).
    • repo-queue list --queue <q> --status claimed emits the 6-column table; json.loads raises Expecting value: line 1 column 1 (char 0), fetch_claimed_rows logs to stderr and returns [].

    Second defect on the same path (not yet filed). Even once list emits JSON, poll.is_candidate reads progress.stage, but checkpoints write progress.last_checkpoint.stage. In repo-health-code-pilot, 84 of 86 claimed rows carry only last_checkpoint.stage; 8 carry a top-level stage, and those are non-yield stages (claimed, awaiting_ci, implementation_complete, parked). So the stage fix alone would still hide the recorded yields.

    Worked example, read-only. Reading the broker's rich /list directly and applying poll.is_candidate's filter with the stage read from last_checkpoint.stage yields 70 unbound handed_off candidates (code 64, opencode-pilot 5, nix 1; priorities 1×p20, 65×p30, 1×p40, 3×p50). Against cap_room 22, a live fire would launch 22 and skip 48 for cap saturation.

    Nothing was claimed, bound, launched or mutated. Fire log: ~/.local/state/opencode-claimant/fires.jsonl (last line).

  10. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

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

  11. added
    priority/normalOrdinary priority (the default)
    effort/mMedium: expected under 1 day of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 8, 2026
  12. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 8, 2026
  13. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (already_done)

  14. 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

    effort/mMedium: expected under 1 day of workkind/enhancementmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions