Repository navigation
Description
Problem
pm-stack/opencode-claimant/claimant.py — the opencode lane claimant/executor — calls two modules it never imports at module level, so in live mode its two active steps can never do their work:
requestsis used at lines 197, 226, 252 (supervision_step: session GET, messages GET, session DELETE) and 392, 407, 432 (launch_step: session POST, cleanup DELETEs) but is never imported (imports at lines 18–24 are onlyjson, os, sys, time, datetime, pathlib, typing).requestsis also not installed on the laptop (python3 -c "import requests"→ModuleNotFoundError), so a bareimport requestswould not fix the deployed environment either; the siblingpoll.pyin the same directory does its HTTP with stdliburllib.request.subprocessis imported only locally insiderun_poll(line 93) but used at module scope insupervision_step(line 172 list, line 259 bind) andlaunch_step(line 418 bind), where the name does not exist.
Every failure is swallowed by the broad except Exception handlers around these steps, so nothing crashes and nothing is logged as an error:
- Supervision: the per-queue
subprocess.runraisesNameError, caught by the outer handler as a generic "Supervision check failed" warning. Even with that fixed alone, the session checkrequests.getraisesNameError, caught by the inner handler whose comment reads "Could not verify session - leave bound" — every bound session is left bound forever, and zero-message/gone-session recovery (the step's whole purpose) never fires. - Launch: the session-create
requests.postraisesNameError, caught per-candidate as alaunch_error: name 'requests' is not definedskip — andlaunch_step'sskipslist is never returned or logged (main()callslog_fire(mode, [], launched, cap_room, [])with an empty skips list), sofires.jsonlrecords only "Launched 0" with no reason. Even past that, the bindsubprocess.runwould raise the same way.
Evidence (verified this run, laptop, main @65beb42c1a)
Probe ~/git/fleet/probe-claimant-requests (real claimant.py copied verbatim; transport and queue CLI stubbed):
hasattr(module, "requests")→False;hasattr(module, "subprocess")→False.launch_step("live", 3)with one valid unboundhanded_offcandidate from a stubbedrun_poll→[](nothing launched, no error surfaced). With stubrequestsandsubprocessinjected into the module namespace, the identical call → one launched session (ses_1bound).supervision_step("live")with a stubbed queue list returning a claimed opencode task whose session 404s with zero messages: with onlysubprocessstubbed (requests still missing) →[]; with both stubbed → the task is recovered as azero_messagecandidate and the delete+bind recovery runs.- First probe round (no stubs at all) printed
Supervision check failed for queue <each of the 4 queues>: name 'subprocess' is not defined— the exact warning shape a live run would emit. - CI never catches this:
.github/workflows/pm-stack-tests.ymlruns onlytest_poll.pyfor this package (per ci(pm-stack): opencode-claimant install.test.mjs (13 tests pinning the #3278 typo'd-flag install guard) run by no workflow — #5951 wired only the Python suite #6091/ci(pm-stack): Python suites test_poll.py (36 tests, #3026 claimant cap gate) and test_update_choice_options.py (7 tests) run by no workflow #5951);claimant.pyhas no test suite at all.
Related: #6533 (handed-off tasks are never launched — executed_lane/session_id stay null). #6533 suspects poll visibility for parked tasks; this issue is a second, independent break in the same launch path: even a candidate the poll does surface in handed_off stage cannot launch. Both need fixing for a handoff to result in a session.
Why it matters
The claimant is the component that turns handed-off opencode-lane queue tasks into running sessions and recovers dead bound sessions. As shipped, live mode is inert: it polls, passes its own gate and cap checks, launches nothing, recovers nothing, and its fire log shows no reason — the failure mode is indistinguishable from "no work to do", which is how it can persist unnoticed alongside #6533.
Acceptance criteria
-
claimant.pyperforms its session HTTP calls through a module that exists in the deployed environment (stdliburllib, followingpoll.py's pattern in the same directory, or a declared/installed dependency), andsubprocessis available at module scope. - A regression test exercises
launch_stepwith a stubbed transport/queue CLI and a validhanded_offcandidate and asserts a session is launched and bound; a second test exercisessupervision_steprecovering a gone, zero-message session. The suite is wired intopm-stack-tests.ymlalongsidetest_poll.py. -
launch_step's skips are returned and recorded in thefires.jsonlentry (no more hard-coded empty skips inmain()), so a zero-launch fire states why. - Negative control: the new tests fail against the pre-fix
claimant.py.
Activity
developing-today commentedon Nov 7, 2026
CODE-2133
dezren39 commentedon Nov 7, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 8, 2026
🤖 Agent note · triage complete (task 11099, lane code-a)
requests.used at :197/:226/:252/:392/:407/:432 with no import,subprocessimported only locally in run_poll.urllibhelpers andsubprocessimported at the top ofsupervision_step/run_poll. Butmain()still calledlog_fire(mode, [], launched, cap_room, [])with hard-coded empty skips (:550), and no claimant test suite was added — acceptance items 2 and 3 stayed unmet.supervision_stepreturns [] in live mode,launch_steponly simulates, no session HTTP at all),test_poll.py(438 lines) DELETED, README rewritten. Current main therefore has norequestsbug because it has no live launch/supervision implementation at all — live mode is inert by construction, which is the same user-visible failure this issue filed, by a worse mechanism..github/workflows/pm-stack-tests.ymlstill assertspm-stack/opencode-claimant/test_poll.pyexists and fails the job if missing; the workflow only triggers on external-comms paths, so the deletion can sit silent.repo-health:v1:fix:developing-today/code:issue:6865): restore the claimant package from d0703e8^ (the 555-line urllib version, including test_poll.py), then finish the original acceptance — skips returned and recorded in fires.jsonl, a test_claimant suite for launch_step/supervision_step wired into pm-stack-tests.yml, negative control against the pre-fix file. The keeper-snapshot regression mechanism itself (a stale checkout snapshot overwriting newer main work, cf. closed opencode-claimant(poll/claimant): snapshot rewrite dropped poll.py's test-pinned cap API (36/36 tests error) and inverted cap_room — idle reads as saturated, busy launches unbounded #6609 for the same pattern) is named in the follow-up packet as a lead, not folded into its scope.51 remaining items
developing-today commentedon Nov 8, 2026
Agent note — PR opened, parked on CI (lane
code-u, task 11370, 2026-11-07)PR #7290 restores the live claimant package from
d0703e82ce^(claimant.py 555 lines, test_poll.py, README) and finishes this issue's acceptance: module-scopesubprocess, the supervision zero-message check fixed to read the curl result, error-body session GETs treated as gone sessions,str(task_id)in bind argv, andlaunch_stepreturning(launched, skips)withmain()recording real skips infires.jsonl. Newtest_claimant.py(6 tests) is wired intopm-stack-tests.yml, which now also triggers onpm-stack/opencode-claimant/**changes.Verification so far: laptop worktree — test_poll.py + test_claimant.py = 53 tests OK; negative control — the new suite fails against both the pre-fix
65beb42c1aclaimant.py and the 307-line shadow stub. One reconciliation inside the restoration:TestFetchClaimedRowspinned the broker-HTTP transport #5419 deliberately replaced, so that class was rewritten against the current repo-queue CLI transport.Task 11370 is parked for 20 minutes on CI pending (all checks still pending at the 5-minute poll boundary). On resume: read PR #7290 checks fresh, disposition any Codex findings, merge when green under the standing criteria, then complete the task.
developing-today commentedon Nov 8, 2026
🤖 Agent note · parked
Merge pull request #7290 from developing-today/queue/11370-6865-claim…
dezren39 commentedon Nov 8, 2026
🤖 Agent note · done (merged)
python3 -m unittest test_poll test_claimant= 53 tests OK. PR CI checks were still QUEUED since 04:54Z (>90 min, runner infra stall, not failures) at merge time; merged under the standing merge directive on the verified tests, noting the infra stall here.