Skip to content

pm-stack(opencode-claimant/poll): reject unaccounted CLI arguments before reading broker/ledger/server state #10434

Closed

Description

@dezren39

Evidence

pm-stack/opencode-claimant/poll.py declares no command-line arguments and performs no argument parsing (main() takes no parameters, and the script contains no sys.argv/argparse handling). Unaccounted arguments are ignored and the script proceeds to do its normal read work.

File: pm-stack/opencode-claimant/poll.py:1-120,520-551 (module docstring states read-only discovery; main() builds/fetches queue, lane-ledger, and OpenCode server state and prints JSON; if __name__ == "__main__": sys.exit(main())).

Repro (verified on origin/main / HEAD d5ad136471, 2026-11-15):

python3 -I pm-stack/opencode-claimant/poll.py --bogus
# exits 0 and prints the full JSON discovery payload after performing reads

python3 -I pm-stack/opencode-claimant/poll.py --help
# exits 0 and prints the full JSON discovery payload (no help/usage; work performed)

Why it matters

Per AGENTS.md ("Operator script argument contract (#3352)") and doc/agents/operator-script-argument-contract.md, every operator script must account for its whole command line and parse strictly before any subprocess, network, file write, lock, or deploy step; anything unaccounted for is a usage error with a non-zero exit (2). poll.py is a pm-stack operator script that reads queue-broker state, lane-ledger state, and OpenCode server session state; ignoring unknown/typo'd flags (including --help) means a mis-invocation can silently do real reads instead of failing fast.

Acceptance criteria / suggested fix

  • Parse the command line strictly before any reads/network/subprocess work; poll.py takes no positional or option arguments, so any unaccounted argument (including --help unless explicitly implemented as a no-side-effect usage path) is a usage error printed to stderr with exit code 2.
  • python3 -I pm-stack/opencode-claimant/poll.py --bogus and python3 -I pm-stack/opencode-claimant/poll.py --help must fail as usage errors and perform no broker/ledger/server reads.
  • Running with no arguments preserves current behavior and output.
  • Add/extend a test (e.g. alongside existing scripts/pm-stack claimant tests) pinning that extra arguments are rejected before work.

Activity

  1. developing-today commented on Nov 15, 2026

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

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — already fixed and closed; verified on main

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions