Skip to content

opencode-claimant(claimant.py): launch_step ignores its mode argument — a shadow fire creates and binds a session if discovery ever returns a candidate #7366

Closed

Description

@dezren39

Summary

pm-stack/opencode-claimant/claimant.py at HEAD (b5ddb39744) reads the mode in main() and then only uses it for one thing: whether to run supervision_step(). It is never consulted before a launch.

# claimant.py:512-550
mode = read_mode()
if mode == "live":
    supervision_step(mode)
...
launched, skips = launch_step(mode, cap_room)   # mode is passed and ignored

launch_step(mode, cap_room) takes mode as a parameter and never reads it. The body goes straight from the cap check to POST /api/session and repo-queue bind.

The task packet (pm-stack/opencode-claimant/prompt.md, §MODE) is explicit: "In shadow mode ... Never claim, bind, launch, or mutate a task in shadow mode." The living fire instruction is equally explicit that shadow is the default when ~/.local/state/opencode-claimant/mode is absent.

Reproduction (verified 2026-11-08, laptop)

Patched read_mode → "shadow", run_poll → one valid handed_off candidate, and stubbed subprocess.run to record argv:

$ python3 <stub harness invoking claimant.main()>
OpenCode claimant starting in shadow mode
Running gate step...
Running cap step...
Cap room: 36 sessions available
Running launch step...
Fire complete. Launched 1 sessions.
subprocess calls:
  curl -s -m 10 -X POST ... -d {"location": {"directory": "/home/user/git/code"}, ...} http://127.0.0.1:13420/api/session
  repo-queue bind 999999 --worker opencode-claimant --session-id ses_FAKE --launched-by opencode-claimant

main() returns 0 having created and bound a session while mode == "shadow".

Why it is invisible today

Shadow is currently safe by accident, not by design: gate_step() → run_poll() → poll.py → repo-queue list, which prints a human table (#7325), so every queue reads empty and the fire exits before launch_step. The moment #7325 lands — or any caller passes a candidate list, or the mode file is written live and later reverted while a fire is in flight — the guard that should have stopped it does not exist.

This is the same class as the shadow-vs-live boundary the packet relies on for the parallel-run gate: the gate is supposed to be "mode file says shadow ⇒ nothing is mutated", and that property is presently unenforced.

Suggested acceptance

  1. launch_step refuses to create/bind when mode != "live" (early return ([], [{"reason": "shadow_mode"}])), and main() does not call it in shadow mode at all — belt and braces, since the packet describes shadow as read-only by construction.
  2. supervision_step's recovery path is likewise unreachable in shadow mode (it already returns early — pin it with a test that asserts no subprocess.run argv contains bind or DELETE).
  3. Test that fails today: with read_mode → "shadow", one candidate, and a recording subprocess stub, assert zero calls whose argv contains bind, DELETE, or a POST to /api/session.
  4. Test the inverse: read_mode → "live" still launches, so the gate is not a silent kill switch.

Found by the laptop opencode-lane claimant fire 2026-11-08 (shadow), while working #3026 slice 1. Related: #7356 (launch_step's other missing steps), #7325 (the gate that currently masks this), #6257.

Acceptance criteria

  • In shadow mode, launch_step performs no session create, no repo-queue bind, and no other mutation — the mode argument is consulted before any launch action, per the packet's §MODE rule ('Never claim, bind, launch, or mutate a task in shadow mode').
  • In live mode, launches proceed as today.
  • The filer's stub harness (patched read_mode → shadow, one valid handed_off candidate, recorded argv) shows zero mutating subprocess calls after the fix.

Activity

  1. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 8, 2026
  2. developing-today commented on Nov 8, 2026

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

    @dezren39
    MemberAuthor

    Shadow-fire evidence, 2026-11-08T13:03:42Z (laptop OpenChamber scheduled task, route opencode-route/workhorse):

    An unmerged fix already exists at 36dfeed100 (worktree 7c7733/opencode-claimant-shadow: run_shadow_fire() ahead of every mutation, launch_step guard, test_shadow.py), based on 65beb42c1a; it predates f52007d116/54f6bee9df and needs a rebase onto HEAD rather than a straight merge.

  4. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

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

  5. 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
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 8, 2026
  6. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: packet rule: pm-stack/opencode-claimant/prompt.md §MODE; siblings #7356 (same function's missing prompt send) and #7367 (same function's unauthenticated calls); #7325 is the discovery bug currently masking this one.
    Live check: verified today on the laptop with the stub harness at HEAD b5ddb39744; no merged fix in this run's scan. Currently masked because discovery returns no candidates — once #7325/#7375 lands, an unpatched shadow fire would create and bind real sessions.
    Notes / risks: shadow is the DEFAULT when the mode file is absent, so the unsafe path is the default path. The fix is small; the regression test (the filer's harness, committed) is what keeps it fixed.
    Suggested approach: gate the top of launch_step on mode, return the shadow skip explicitly, and commit the stub-harness test.

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

  7. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (already done)

  8. 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/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 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