Add ranked atomic agent work selection primitives
Merged
UN
4mo ago+1099+1099+0123456789012345678901234567890123456789-121-121-012345678901234567890123456789
Summary
- expose filtered, bounded
claimNext()through the public SDK, MCP action schema, and CLI - keep
pm nextrecommendation and ready tail in one stable ranked sequence with explicit one-based ranks - separate human-gated Decisions into
decision_needed, with explicit maintainer opt-in for claiming - return a non-error empty
--if-availableenvelope when a worker lane is exhausted - update completions, contracts, docs, generated contract snapshot, and package-owned changelog
pm tracker items
pm-fjxm— filtered bounded atomic claim-next walking and exhaustion semanticspm-1mwk— ranked ready continuationpm-eqk0— human-gated decision separation
Verification
node scripts/run-tests.mjs coverage— 5,550/5,550; 100% statements/branches/functions/linespnpm lint— ESLint, zero jscpd clones, static-quality/docstring/token gatespnpm contracts:checkpnpm quality:docs-skillspnpm security:scanpnpm audit --audit-level moderate- fresh packed-package install in an isolated workspace proved filtered rank-1 selection and bounded atomic claim
Summary by Sourcery
Add ranked atomic next-work claiming with bounded candidate walks, expose it through the CLI, SDK, and MCP contracts, and refine next-work queues to separate human-gated decisions from agent-ready items.
New Features:
- Introduce CLI and SDK support for
claim --next/claimNext()using next-work filters and bounded ranked candidate selection. - Expose one-based ranks on next-work actionable items and surface a separate
decision_neededqueue for human-gated decisions.
Bug Fixes:
- Treat exhaustion of
claim --next --if-availableas a deliberate non-error empty result instead of throwing, enabling contention-tolerant worker loops. - Align pm next / claim --next behavior with documentation by keeping ready items in stable recommendation order and excluding human-gated Decision records from agent lanes by default.
Enhancements:
- Extend
pm nextand related rendering to show explicit ranks, support optional inclusion of decision items, and document the updated semantics in SDK and command docs. - Update MCP action schemas and CLI contracts for claim to support both item-id and next-work based invocation, along with new filters and bounds.
- Tighten validation around
--max-attemptsfor claim-next candidate walks to enforce safe, bounded ranges.
Documentation:
- Refresh SDK and command documentation to describe ranked next-work queues, decision separation, new claim-next filters, and exhaustion semantics.
Tests:
- Expand unit tests for claim-next, next-work ranking, markdown rendering, SDK entrypoints, and CLI registration to cover the new filters, ranks, decision partitioning, and empty-claim behavior.
Chores:
- Update generated contracts snapshot, agent issue history, and changelog entries to track the new ranked claim-next behavior and decision handling fixes.
Summary by cubic
Adds ranked, atomic next-work selection so agents can safely claim the next item in a stable order across the CLI, SDK, and MCP. Speeds up CI by sharding coverage and removing the test fixture spawn tax while keeping the 100% coverage gate, and hardens coverage by disabling persisted checkout credentials.
-
New Features
- CLI:
pm claim --nextacceptspm nextfilters (--type,--tag,--priority,--assignee-filter,--parent,--sprint,--release), adds--max-attempts(1–100) and--include-decisions; with--if-availablereturns an empty envelope on exhaustion; completions updated. - SDK/MCP:
PmClient.claimNext()and top-levelclaimNext()expose the same filtered, bounded selection; schemas enforce one-ofid|nextwith anext=truediscriminator, validatemaxAttempts, accept numeric priorities, and publish the full claim-next surface.
- CLI:
-
Bug Fixes
- GH-509/513: Keep the ready queue in recommendation order with one-based
rank, thread next-work filters toclaim --next, walk ranked candidates on race loss, and standardizeno_available_next_item. - Contracts/CLI: Honor explicit author affinity, keep Decision items out of agent lanes by default and exclusive across
ready/held_by_others, resolve claimant identity defaults, distinguish zero-match candidate errors from exhaustion, and align strict SDK/MCP schemas. - CI/CLI: Disable persisted checkout credentials in coverage jobs and lock it in the workflow contract; complete claim-next completions with dynamic type/tag choices to match
pm next.
- GH-509/513: Keep the ready queue in recommendation order with one-based