Repository navigation
Add ranked atomic agent work selection primitives - #517
Conversation
Expose filtered and bounded claimNext across the SDK, MCP, and CLI; preserve ranked ready queues; separate human-gated decisions; and return a non-error exhaustion envelope. Includes complete contracts, docs, pm evidence, changelog, and 100% coverage.
|
@greptileai please review this broad SDK/CLI work-selection bundle. /gemini review @coderabbitai full review |
Reviewer's GuideAdds ranked atomic next-work claim primitives across CLI, SDK, MCP contracts, and docs: claim-next becomes filterable and bounded, next-work ranking gains explicit ranks and separates human-gated decisions, and exhaustion under --if-available returns a non-error empty envelope for worker lanes. Sequence diagram for ranked bounded claim-next flow with filters and decision separationsequenceDiagram
actor Worker
participant CliClaimCommand as runClaimAction
participant ClaimNext as runClaimNext
participant Next as runNext
participant DecisionPartition as partitionDecisionEntries
participant RankReady as rankNextReadyEntries
participant ClaimLoop as claimNextFromRecommendations
participant Claim as runClaim
Worker->>CliClaimCommand: pm claim --next [filters, maxAttempts, ifAvailable, includeDecisions]
CliClaimCommand->>ClaimNext: runClaimNext(force, globalOptions, lifecycleOptions, nextOptions)
ClaimNext->>Next: runNext(nextOptions with limit=parseClaimNextAttempts(maxAttempts))
Next->>DecisionPartition: partitionDecisionEntries(report.ready, includeDecisions)
DecisionPartition-->>Next: {agent, decisions}
Next->>RankReady: rankNextReadyEntries(agent)
RankReady-->>Next: rankedReady
Next->>RankReady: rankNextReadyEntries(decisions)
RankReady-->>Next: rankedDecisions
Next-->>ClaimNext: NextResult {recommended, ready (ranked), decision_needed (ranked)}
ClaimNext->>ClaimLoop: claimNextFromRecommendations([recommended, ...ready].slice(0, maxAttempts), force, global, options)
loop each recommendation up to maxAttempts
ClaimLoop->>Claim: runClaim(recommendation.id, force, global, options)
alt claimed.skipped is false
Claim-->>ClaimLoop: ClaimResult
ClaimLoop-->>CliClaimCommand: ClaimNextAvailableResult {available:true, recommendation, attempts}
CliClaimCommand-->>Worker: success with claimed item
note over ClaimLoop: break
else claimed.skipped is true
Claim-->>ClaimLoop: ClaimResult {skipped:true}
end
end
alt no actionable item and options.ifAvailable is true
ClaimLoop-->>CliClaimCommand: ClaimNextUnavailableResult {available:false, item:null, skipped:true, warning:"no_available_next_item"}
CliClaimCommand-->>Worker: successful empty envelope
else no actionable item and ifAvailable is false
ClaimLoop-->>CliClaimCommand: throw PmCliError(CONFLICT)
CliClaimCommand-->>Worker: error: No actionable item remained available to claim
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughThe PR adds ranked ChangesRanked next-work and atomic claiming
SDK and contract integration
CI and release records
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Agent
participant runClaimNext
participant runNext
participant claimNextFromRecommendations
participant SDK
Agent->>runClaimNext: request next claim with filters
runClaimNext->>runNext: compute ranked candidates
runNext->>claimNextFromRecommendations: provide bounded recommendations
claimNextFromRecommendations-->>runClaimNext: claimed item or unavailable result
SDK->>runClaimNext: dispatch claim action with next=true
runClaimNext-->>Agent: return claim envelope
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 31 minutes. |
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- The
partitionDecisionEntrieshelper currently recomputes the ready list twice; consider derivingagentfrom the precomputeddecisionsto avoid duplicate filtering and keep the logic easier to reason about. ClaimNextUnavailableResult.warningsis hard-coded as["no_available_next_item"]; you may want to centralize this string (e.g., in an enum/constant shared with error contexts) to reduce the chance of future divergence between success-envelope warnings and error codes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `partitionDecisionEntries` helper currently recomputes the ready list twice; consider deriving `agent` from the precomputed `decisions` to avoid duplicate filtering and keep the logic easier to reason about.
- `ClaimNextUnavailableResult.warnings` is hard-coded as `["no_available_next_item"]`; you may want to centralize this string (e.g., in an enum/constant shared with error contexts) to reduce the chance of future divergence between success-envelope warnings and error codes.
## Individual Comments
### Comment 1
<location path="src/sdk/runtime.ts" line_range="1184-1185" />
<code_context>
}
+ /** Atomically claim the highest-ranked available item using the public next-work filters. */
+ claimNext(
+ options: PmClientFullMutationOptions = {},
+ ): Promise<ClaimNextResult> {
+ return this.runTyped("claim", {
</code_context>
<issue_to_address>
**suggestion:** The SDK `claimNext` helper mirrors CLI flags but doesn’t surface that `maxAttempts` is bounded, which may surprise callers.
In the CLI, `--max-attempts` is validated via `parseClaimNextAttempts` (1–100). SDK callers of `claimNext` don’t see this bound in the signature or JSDoc and only discover it at runtime. Please document the valid range for `maxAttempts` here and consider a stricter type or helper to encode the constraint for SDK users.
Suggested implementation:
```typescript
import type { ClaimNextResult, ClaimResult, ReleaseResult } from "../cli/commands/claim.js";
type ClaimNextAttempts =
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
| 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20
| 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30
| 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40
| 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50
| 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60
| 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70
| 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80
| 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90
| 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100;
/**
* Options for {@link PmClient.claimNext}.
*
* Mirrors {@link PmClientFullMutationOptions} but constrains `maxAttempts`
* to the valid CLI range (1–100) so SDK callers see the bound at compile time.
*/
export interface ClaimNextOptions extends PmClientFullMutationOptions {
/**
* Maximum number of attempts to claim the next item.
*
* Must be between 1 and 100 inclusive. Values outside this range will be rejected
* by the underlying CLI command, matching the validation performed by
* `parseClaimNextAttempts` for the `--max-attempts` flag.
*/
maxAttempts?: ClaimNextAttempts;
}
```
```typescript
/**
* Atomically claim the highest-ranked available item using the public next-work filters.
*
* The `maxAttempts` option mirrors the CLI's `--max-attempts` flag and must be between
* 1 and 100 inclusive. Values outside this range will be rejected by the underlying
* CLI command, matching the `parseClaimNextAttempts` validation.
*/
claimNext(
options: ClaimNextOptions = {},
): Promise<ClaimNextResult> {
```
If this file re-exports SDK types from an index (e.g. `src/sdk/index.ts` or similar), you may also want to export `ClaimNextOptions` so SDK consumers can reference the stricter type directly:
1. Add `ClaimNextOptions` to any public export surface that currently exposes `PmClientFullMutationOptions`.
2. Optionally, update external usage sites that call `claimNext` with an explicit type annotation to use `ClaimNextOptions` instead of `PmClientFullMutationOptions`, so callers see the constrained `maxAttempts` range in their editors and at compile time.
</issue_to_address>
### Comment 2
<location path="docs/SDK.md" line_range="542-546" />
<code_context>
+remain visible in `decision_needed` but stay outside the agent-ready queue unless
+the caller explicitly opts in. `PmClient.claimNext()` and top-level `claimNext()`
+compose the same ranking result and atomic claim mutation, accept the next-work
+filters, and bound race-loss candidate walking with `maxAttempts`, so custom SDK
+tools do not need to reproduce CLI concurrency policy.
</code_context>
<issue_to_address>
**suggestion (typo):** Consider adjusting the verb form in this coordinated list for clearer parallelism.
In the sentence starting with "`PmClient.claimNext()` and top-level `claimNext()`", the verb list "compose", "accept", and "bound" breaks present-tense parallelism because "bound" reads like a past participle. Consider using "bounds" or slightly rephrasing (e.g., "and it bounds the race-loss candidate walk") to keep the verbs parallel and the sentence smoother.
```suggestion
remain visible in `decision_needed` but stay outside the agent-ready queue unless
the caller explicitly opts in. `PmClient.claimNext()` and top-level `claimNext()`
compose the same ranking result and atomic claim mutation, accept the next-work
filters, and they bound the race-loss candidate walk with `maxAttempts`, so
custom SDK tools do not need to reproduce CLI concurrency policy.
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request enhances the task management CLI and SDK by implementing candidate filtering and a bounded race-loss walk for atomic next-item claims (GH-509), ensuring the ready queue preserves recommendation ranking with explicit one-based ranks (GH-513), and separating human-gated decisions into a dedicated section to prevent autonomous agents from claiming them by default (pm-eqk0). The review feedback suggests improving programmatic SDK usability by typing maxAttempts as number | string instead of strictly string, and updating the parsing and registration logic accordingly.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Greptile SummaryThis PR adds ranked atomic work selection across the CLI, SDK, MCP contracts, docs, and tests. The main changes are:
Confidence Score: 4/5Mostly safe, with one contained ranking bug in the explicit-author claim-next path. The CLI, SDK, contracts, docs, and tests are updated together.
What T-Rex did
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Worker as Worker/SDK/MCP
participant Claim as runClaimNext
participant Next as runNext
participant Rank as Relevance ranking
participant Store as Item store lock
Worker->>Claim: claimNext(filters, author, maxAttempts)
Claim->>Next: "runNext(filters + callerAuthor, limit=maxAttempts)"
Next->>Rank: rank ready candidates
Rank-->>Next: recommended + ready rows with ranks
Next-->>Claim: ranked claimable recommendations
loop bounded candidate walk
Claim->>Store: runClaim(candidate id)
alt candidate available
Store-->>Claim: claim result
Claim-->>Worker: available:true + recommendation
else already claimed / skipped
Store-->>Claim: conflict or skipped
Claim->>Claim: advance to next rank
end
end
Claim-->>Worker: available:false when --if-available exhausted
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Worker as Worker/SDK/MCP
participant Claim as runClaimNext
participant Next as runNext
participant Rank as Relevance ranking
participant Store as Item store lock
Worker->>Claim: claimNext(filters, author, maxAttempts)
Claim->>Next: "runNext(filters + callerAuthor, limit=maxAttempts)"
Next->>Rank: rank ready candidates
Rank-->>Next: recommended + ready rows with ranks
Next-->>Claim: ranked claimable recommendations
loop bounded candidate walk
Claim->>Store: runClaim(candidate id)
alt candidate available
Store-->>Claim: claim result
Claim-->>Worker: available:true + recommendation
else already claimed / skipped
Store-->>Claim: conflict or skipped
Claim->>Claim: advance to next rank
end
end
Claim-->>Worker: available:false when --if-available exhausted
|
There was a problem hiding this comment.
Code Review
This pull request implements key enhancements to the task selection and claiming workflow. It introduces candidate filters, bounded race-loss walking, and an empty exhaustion envelope for pm claim --next (GH-509). It also ensures the ready queue preserves recommendation ordering with explicit one-based ranks (GH-513), and separates human-gated Decision items into a dedicated decision_needed section (pm-eqk0). Feedback focuses on ensuring that numeric values for maxAttempts and priority are not silently ignored in CLI operation registration, and preventing duplicate decision items in the output when includeDecisions is enabled.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Thread explicit author affinity through relevance ranking, accept numeric SDK selection inputs, avoid opted-in Decision duplication, and centralize claim exhaustion contracts based on bot review feedback.
|
Review round addressed in e5eb6fb:
Focused 253-test suite plus strict lint/static gates pass. Re-triggering all available reviewers now. @greptileai |
|
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 8 minutes. |
There was a problem hiding this comment.
Code Review
This pull request introduces significant enhancements to the pm next and pm claim --next commands, as well as their SDK and MCP integrations. Key changes include adding stable one-based ranks to actionable items, separating human-gated Decision items into a distinct decision_needed queue by default, and extending pm claim --next to support candidate filters, bounded race-loss candidate walking (via --max-attempts), and a non-error empty result upon exhaustion (via --if-available). The review feedback identifies an opportunity to improve error handling in claimNextFromRecommendations by differentiating between cases where no candidates matched the filters versus when all candidates were claimed by other agents.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Resolve empty claimant identity through tracker defaults, distinguish zero-match selection errors, and publish the complete claim-next flag contract after second-round bot review.
|
Review fixes are pushed in @greptileai |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 58 minutes. |
|
Bot follow-up on current head
|
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/fixtures/contracts/full.json (1)
4386-4442: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
nextcommand's flag/schema contract is missing--include-decisions.
src/cli/register-list-query.tsadds--include-decisionsto thenextcommand, but this fixture'scommand_flagsentry fornext(and the correspondingnextaction JSON schema) doesn't list it. This snapshot needs regeneration to stay in sync with the CLI surface.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/fixtures/contracts/full.json` around lines 4386 - 4442, Regenerate the contract fixture for the next command so its command_flags entry and corresponding action JSON schema include the --include-decisions flag added by register-list-query.ts. Preserve all existing flags, aliases, and provider metadata while synchronizing both schema representations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 12: Update the changelog entry for “pm next / claim --next” to state that
human-gated Decision items are excluded from agent claim lanes by default, while
authorized maintainers may explicitly opt in. Preserve the existing issue link
and avoid wording that suggests Decisions are generally claimable agent work.
In `@src/cli/commands/completion.ts`:
- Around line 1717-1725: Update the claim --next completion entry for --priority
near the existing NextOptions filters to provide the fixed choices 0, 1, 2, 3,
and 4, matching the completion used by the next command while leaving the other
option completions unchanged.
In `@src/cli/commands/next.ts`:
- Around line 565-574: Update the ready-entry partitioning in the command flow
to derive held_by_others from partitionedByDecision.agent rather than invoking
partitionCallerOwnedReady again on report.ready. Reuse the existing filtered
partition for both held_by_others and rankedReady, ensuring decision entries
remain exclusively in decision_needed and avoiding redundant partitioning.
In `@tests/fixtures/contracts/full.json`:
- Around line 24169-24199: Update the claim schema’s properties definition near
the oneOf branches to include next, maxAttempts, and includeDecisions with their
appropriate types and validation. Preserve the existing mutual exclusivity
between id and next, and ensure these claim-specific options are accepted
despite additionalProperties being false.
---
Outside diff comments:
In `@tests/fixtures/contracts/full.json`:
- Around line 4386-4442: Regenerate the contract fixture for the next command so
its command_flags entry and corresponding action JSON schema include the
--include-decisions flag added by register-list-query.ts. Preserve all existing
flags, aliases, and provider metadata while synchronizing both schema
representations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: b09f5f8e-3781-4835-9fd3-d233a9816fbd
📒 Files selected for processing (25)
.agents/pm/extensions/.managed-extensions.json.agents/pm/history/pm-1mwk.jsonl.agents/pm/history/pm-eqk0.jsonl.agents/pm/history/pm-fjxm.jsonl.agents/pm/issues/pm-1mwk.toon.agents/pm/issues/pm-eqk0.toon.agents/pm/issues/pm-fjxm.toonCHANGELOG.mddocs/COMMANDS.mddocs/SDK.mdsrc/cli/commands/claim.tssrc/cli/commands/completion.tssrc/cli/commands/index.tssrc/cli/commands/next.tssrc/cli/register-list-query.tssrc/cli/register-operations.tssrc/sdk/cli-contracts/flag-contracts.tssrc/sdk/cli-contracts/tool-schema.tssrc/sdk/index.tssrc/sdk/runtime.tstests/fixtures/contracts/full.jsontests/unit/commands/claim-command.spec.tstests/unit/commands/next-command.spec.tstests/unit/commands/register-commands.spec.tstests/unit/sdk/sdk-index.spec.ts
Keep Decision projections exclusive across ready and held queues, align claim-next completions, and expose the complete atomic selection surface in strict SDK/MCP schemas. Regenerate contracts and the pm-owned changelog with review evidence.
|
CodeRabbit final-round follow-up for
Fresh current-head review requested: |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 38 minutes. |
Require next=true in the claim action one-of branch so schema validation and runtime dispatch agree. Refresh contract and tracker evidence after the final Greptile finding.
|
Final current-head fix is pushed in @greptileai |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
✅ Action performedReview finished.
|
Initialize isolated PM fixtures through the production init handler instead of a cold CLI process, eliminating 1,704 redundant subprocess launches per full run. Parallelize CI coverage across four Vitest blob-report shards and merge them before enforcing the unchanged global 100% thresholds. Restore the final SDK and claim-next coverage branches and record exact PM evidence.
|
@greptileai please review the current head b7cba90, including the direct production-handler fixture initialization and four-shard globally merged coverage gate. /gemini review @coderabbitai full review |
|
Performance update: the full local all-source coverage gate now passes 5,552 tests at exact 100/100/100/100 in 8m56s, down from the observed 15–17 minute baseline. CI now runs four coverage shards in parallel and merges their blob reports before enforcing global thresholds; the required check remains named |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 239-240: Update the Checkout steps in both the coverage-shards and
coverage jobs to set persist-credentials to false on actions/checkout,
preserving the existing action version and other workflow settings.
In `@src/cli/commands/completion.ts`:
- Around line 1717-1718: Update the --type and --tag completion specifications
in the claim --next command to use the existing dynamic typeChoices and
zshTagChoices values, matching the completion patterns used by the other filters
and the nearby --priority option. Replace the free-form :type and :tag arguments
while preserving their descriptions and command behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: ed005b85-02e9-4063-af86-c727a069072a
📒 Files selected for processing (20)
.agents/pm/chores/pm-7rlp.toon.agents/pm/chores/pm-krwu.toon.agents/pm/history/pm-7rlp.jsonl.agents/pm/history/pm-eqk0.jsonl.agents/pm/history/pm-fjxm.jsonl.agents/pm/history/pm-krwu.jsonl.agents/pm/issues/pm-eqk0.toon.agents/pm/issues/pm-fjxm.toon.github/workflows/ci.ymlCHANGELOG.mdsrc/cli/commands/completion.tssrc/cli/commands/next.tssrc/sdk/cli-contracts/tool-parameter-tables.tssrc/sdk/cli-contracts/tool-schema.tstests/fixtures/contracts/full.jsontests/helpers/withTempPmPath.tstests/integration/ci-workflow-contract.spec.tstests/unit/commands/claim-command.spec.tstests/unit/commands/next-command.spec.tstests/unit/sdk/sdk-index.spec.ts
Disable persisted checkout credentials in both coverage jobs and lock that behavior in the workflow contract. Reuse dynamic type and tag choices for claim-next completions to match the next command. Addresses the final CodeRabbit findings on the sharded coverage head.
|
@greptileai please review the current head dba15cf after the final security/completion feedback fixes. /gemini review @coderabbitai full review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 51 minutes. |
|
Final bot-response audit on
|
Summary
claimNext()through the public SDK, MCP action schema, and CLIpm nextrecommendation and ready tail in one stable ranked sequence with explicit one-based ranksdecision_needed, with explicit maintainer opt-in for claiming--if-availableenvelope when a worker lane is exhaustedpm tracker items
pm-fjxm— filtered bounded atomic claim-next walking and exhaustion semanticspm-1mwk— ranked ready continuationpm-eqk0— human-gated decision separationVerification
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 moderateCloses #509
Closes #513
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:
claim --next/claimNext()using next-work filters and bounded ranked candidate selection.decision_neededqueue for human-gated decisions.Bug Fixes:
claim --next --if-availableas a deliberate non-error empty result instead of throwing, enabling contention-tolerant worker loops.Enhancements:
pm nextand related rendering to show explicit ranks, support optional inclusion of decision items, and document the updated semantics in SDK and command docs.--max-attemptsfor claim-next candidate walks to enforce safe, bounded ranges.Documentation:
Tests:
Chores:
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
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.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.Bug Fixes
pm next --claim) to close the recommend→claim TOCTOU window for multi-agent fleets #509/513: Keep the ready queue in recommendation order with one-basedrank, thread next-work filters toclaim --next, walk ranked candidates on race loss, and standardizeno_available_next_item.ready/held_by_others, resolve claimant identity defaults, distinguish zero-match candidate errors from exhaustion, and align strict SDK/MCP schemas.pm next.Written for commit dba15cf. Summary will update on new commits.