You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pm-stack(opencode-claimant/poll): reject unaccounted CLI arguments before reading broker/ledger/server state #10434
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.
Fresh verification (2026-11-17): issue pm-stack(opencode-claimant/poll): reject unaccounted CLI arguments before reading broker/ledger/server state #10434 is CLOSED with status:done, and the fix is present on origin/main: pm-stack/opencode-claimant/poll.py now rejects any argument before any work runs (lines 958-961: if len(sys.argv) > 1: → "poll.py: unexpected argument …; usage: python3 poll.py", a usage error ahead of the broker/ledger/server reads) — exactly the issue's acceptance shape (strict parse first, exit-2 usage error, no-argument behavior preserved). The bulk-intake task that surfaced this triage was minted from a pre-closure snapshot; no follow-on is needed and none is queued.
Activity
developing-today commentedon Nov 15, 2026
CODE-3778
dezren39 commentedon Nov 17, 2026
🤖 Agent note · triaged — already fixed and closed; verified on main
pm-stack/opencode-claimant/poll.pynow rejects any argument before any work runs (lines 958-961:if len(sys.argv) > 1:→ "poll.py: unexpected argument …; usage: python3 poll.py", a usage error ahead of the broker/ledger/server reads) — exactly the issue's acceptance shape (strict parse first, exit-2 usage error, no-argument behavior preserved). The bulk-intake task that surfaced this triage was minted from a pre-closure snapshot; no follow-on is needed and none is queued.