Skip to content

Add ranked atomic agent work selection primitives - #517

Merged
unbraind merged 7 commits into
mainfrom
feat/agent-work-selection-ranking
Jul 11, 2026
Merged

unbraind merged 7 commits into
mainfrom
feat/agent-work-selection-ranking

Conversation

@unbraind

@unbraind unbraind commented Jul 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • expose filtered, bounded claimNext() through the public SDK, MCP action schema, and CLI
  • keep pm next recommendation 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-available envelope 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 semantics
  • pm-1mwk — ranked ready continuation
  • pm-eqk0 — human-gated decision separation

Verification

  • node scripts/run-tests.mjs coverage — 5,550/5,550; 100% statements/branches/functions/lines
  • pnpm lint — ESLint, zero jscpd clones, static-quality/docstring/token gates
  • pnpm contracts:check
  • pnpm quality:docs-skills
  • pnpm security:scan
  • pnpm audit --audit-level moderate
  • fresh packed-package install in an isolated workspace proved filtered rank-1 selection and bounded atomic claim

Closes #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:

  • 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_needed queue for human-gated decisions.

Bug Fixes:

  • Treat exhaustion of claim --next --if-available as 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 next and 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-attempts for 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 --next accepts pm next filters (--type, --tag, --priority, --assignee-filter, --parent, --sprint, --release), adds --max-attempts (1–100) and --include-decisions; with --if-available returns an empty envelope on exhaustion; completions updated.
    • SDK/MCP: PmClient.claimNext() and top-level claimNext() expose the same filtered, bounded selection; schemas enforce one-of id|next with a next=true discriminator, validate maxAttempts, accept numeric priorities, and publish the full claim-next surface.
  • Bug Fixes

    • Agent UX: add atomic select-and-claim (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-based rank, thread next-work filters to claim --next, walk ranked candidates on race loss, and standardize no_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.

Written for commit dba15cf. Summary will update on new commits.

Review in cubic

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.
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai please review this broad SDK/CLI work-selection bundle.

/gemini review

@coderabbitai full review

@sourcery-ai

sourcery-ai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds 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 separation

sequenceDiagram
  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
Loading

File-Level Changes

Change Details Files
Introduce bounded, filterable atomic claim-next with explicit availability semantics in the CLI.
  • Split ClaimNextResult into available vs unavailable result variants, adding an explicit available flag and stable exhaustion warning.
  • Add maxAttempts option to claim-next mutation, with validation for 1–100 and usage to bound the candidate walk.
  • Update claimNextFromRecommendations to slice by maxAttempts, mark successful results as available, and return a structured empty result under ifAvailable instead of throwing.
  • Wire new lifecycle options and next-work filters into runClaimAction so claim --next accepts type/tag/priority/assigneeFilter/parent/sprint/release/includeDecisions.
src/cli/commands/claim.ts
src/cli/register-operations.ts
tests/unit/commands/claim-command.spec.ts
tests/unit/commands/register-commands.spec.ts
Extend next-work ranking to include explicit per-row rank and separate human-gated Decision items from agent-ready work.
  • Add rank and decision_needed fields to the NextResult/NextActionableItem model and include includeDecisions in NextOptions filters.
  • Introduce partitionDecisionEntries to keep Decision items out of the agent-ready queue by default while still visible to callers.
  • Preserve recommendation order in ready/blocked queues, assigning one-based ranks to actionable items and rendering ranks in markdown output.
  • Expose decision-needed and include-decisions behavior in CLI, list-query options, and next command tests, including priority/rank expectations.
src/cli/commands/next.ts
src/cli/register-list-query.ts
tests/unit/commands/next-command.spec.ts
Expose claim-next as a first-class SDK primitive and align MCP action/contract schemas and docs with the ranked claim semantics.
  • Add PmClient.claimNext and top-level claimNext helper that invoke the claim command with next=true and full mutation options.
  • Update MCP action handler for claim to route next=true requests through runClaimNext with merged options/args, preserving filters.
  • Broaden CLI contracts for the claim action to allow id-or-next via oneOfRequired and include next-work filters and maxAttempts parameters.
  • Adjust SDK docs and contract fixtures to describe ranks, decision_needed separation, bounded race-loss walking, and the new claimNext API; extend completion scripts with new claim-next flags.
src/sdk/runtime.ts
src/sdk/index.ts
src/sdk/cli-contracts/tool-schema.ts
src/cli/commands/completion.ts
tests/unit/sdk/sdk-index.spec.ts
tests/fixtures/contracts/full.json
docs/SDK.md
docs/COMMANDS.md
src/cli/commands/index.ts
Record tracker history and changelog entries for ranked ready continuation, bounded claim-next walking, and human-gated decision separation. .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.toon
CHANGELOG.md
.agents/pm/extensions/.managed-extensions.json

Assessment against linked issues

Issue Objective Addressed Explanation
#509 Add an atomic select-and-claim operation that combines recommendation and claim into a single command, walking to the next ready candidate on claim race loss to avoid the TOCTOU window. ✅
#509 Allow the atomic select-and-claim operation to respect existing pm next filters (type, tag, priority, assignee-filter, parent, sprint, release, and author/assignee) so workers can scope to their lane. ✅
#509 Provide bounded candidate walking and contention-friendly semantics via --if-available and a configurable max-attempts limit, returning a non-error empty result when no claimable item remains. ✅
#513 Ensure pm next --json ready[] is ordered by the same ranking used to choose recommended (priority-first, then existing tie-breakers), so ready is a true continuation of the recommendation. ✅
#513 Expose an explicit rank/score field on each actionable item in pm next --json so JSON consumers can deterministically reconstruct or rely on the ranking. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds ranked pm next queues with Decision separation, bounded atomic pm claim --next selection, expanded CLI and SDK contracts, generated schema updates, direct test initialization, and sharded CI coverage execution.

Changes

Ranked next-work and atomic claiming

Layer / File(s) Summary
Ranked queues and Decision handling
src/cli/commands/next.ts, tests/unit/commands/next-command.spec.ts, docs/*
pm next exposes one-based ranks, separates Decision items into decision_needed, supports explicit inclusion, and documents the resulting queue behavior.
Bounded candidate claiming
src/cli/commands/claim.ts, src/cli/register-operations.ts, tests/unit/commands/claim-command.spec.ts
pm claim --next validates maxAttempts, forwards candidate filters, walks ranked candidates, and returns either a claimed item or a stable unavailable envelope.
CLI and completion wiring
src/cli/commands/completion.ts, src/cli/commands/index.ts, src/cli/register-list-query.ts, tests/unit/commands/register-commands.spec.ts
Next-mode filters, attempt limits, Decision inclusion, completion entries, and runClaimNext exports are registered and tested.

SDK and contract integration

Layer / File(s) Summary
Runtime APIs and action routing
src/sdk/runtime.ts, src/sdk/index.ts, tests/unit/sdk/sdk-index.spec.ts
The SDK adds claimNext, ClaimNextOptions, and runtime dispatch for claims requested with next.
CLI and tool schemas
src/sdk/cli-contracts/*, tests/fixtures/contracts/full.json
Claim flags and tool schemas support next-mode filters, includeDecisions, bounded attempts, and mutually exclusive id/next inputs.

CI and release records

Layer / File(s) Summary
Sharded coverage execution
.github/workflows/ci.yml, tests/integration/ci-workflow-contract.spec.ts, tests/helpers/withTempPmPath.ts
Coverage runs through four shard jobs and a merge job, while test PM initialization calls runInit directly.
Changelog and PM records
CHANGELOG.md, .agents/pm/issues/*, .agents/pm/history/*, .agents/pm/chores/*, .agents/pm/extensions/*
Release notes and tracked issue, chore, history, and extension metadata record the shipped behavior and verification updates.

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
Loading

Possibly related PRs

  • unbraind/pm-cli#502: Implements the atomic claim-next selection path extended by this PR.
  • unbraind/pm-cli#487: Adds related relevance-based ranking behavior in the pm next flow.
  • unbraind/pm-cli#411: Refactors the tool-schema construction used by these claim and next contract updates.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Meets [#509, #513]: atomic claim-next uses bounded retries/filters, and ready items expose stable one-based ranks in order.
Out of Scope Changes check ✅ Passed The CI, tests, docs, changelog, and .agents tracker updates all support the linked work; no unrelated scope stands out.
Title check ✅ Passed The title clearly summarizes the main change: ranked atomic agent work selection primitives.
Description check ✅ Passed The description accurately describes the CLI, SDK, schema, docs, tests, and exhaustion behavior changes in this PR.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

@unbraind: Got it — I'll perform a full review of this PR covering the SDK, MCP action schema, and CLI changes for the ranked atomic work-selection primitives.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 31 minutes.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/sdk/runtime.ts Resolved
Comment thread docs/SDK.md Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/cli/commands/claim.ts Resolved
Comment thread src/cli/commands/claim.ts Resolved
Comment thread src/cli/register-operations.ts Resolved
@greptile-apps

greptile-apps Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds ranked atomic next-work claiming across the CLI, SDK, and MCP contract surfaces. The main changes are:

  • Adds bounded claim --next and SDK claimNext() selection with shared next-work filters.
  • Keeps pm next ready work in one stable ranked sequence with one-based ranks.
  • Separates human-gated Decision items into decision_needed unless callers opt in.
  • Returns a non-error empty envelope for exhausted --if-available worker lanes.
  • Updates completions, contracts, docs, tests, and CI coverage sharding.

Confidence Score: 5/5

Safe to merge with low risk.

The core claim-next flow, ranking partition, SDK/MCP schema exposure, and CI sharding changes are covered by focused unit and contract tests. No verified functional or security regressions were found in the changed paths reviewed.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Captured a before-baseline placeholder for atomic_next_claim to enable comparison against post-run results.
  • Executed the atomic_next_claim smoke harness to exercise the contract interaction and collect results.
  • Collected and reviewed the runtime CLI transcript and assertions from the post-run run for atomic_next_claim.
  • Reviewed the contract validation output and logged the command, working directory, and exit code metadata included with the proof files.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
src/cli/commands/claim.ts Adds bounded ranked claim-next selection, skip/exhaustion envelopes, and retry-on-race behavior; no blocking issues found.
src/cli/commands/next.ts Adds one-based ranks, decision-needed partitioning, stable ready ordering, and markdown rendering updates; no blocking issues found.
src/cli/register-operations.ts Registers claim-next CLI flags and dispatches filtered claim-next options through the command handler; no blocking issues found.
src/sdk/runtime.ts Exposes SDK/MCP claimNext dispatch and typed result surface; no blocking issues found.
src/sdk/cli-contracts/tool-schema.ts Extends the tool schema for claim-next options and discriminator requirements; no blocking issues found.
.github/workflows/ci.yml Splits coverage into shards and merges reports while retaining the coverage gate; no blocking issues found.
tests/unit/commands/claim-command.spec.ts Adds coverage for claim-next bounds, ranking, conflict retries, and empty if-available behavior; no blocking issues found.
tests/unit/commands/next-command.spec.ts Covers ranked ready output and decision separation behavior for next-work selection; no blocking issues found.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Worker as Agent/Worker
participant CLI as pm claim --next / SDK claimNext
participant Next as runNext ranking
participant Claim as atomic runClaim
participant Store as Item store

Worker->>CLI: request next claim with filters + maxAttempts
CLI->>Next: compute ranked ready queue excluding decisions by default
Next-->>CLI: recommended + ready rows with one-based ranks
loop bounded candidate walk
    CLI->>Claim: attempt candidate claim
    Claim->>Store: test-and-set assignee under item mutation
    alt candidate still available
        Store-->>Claim: claimed item
        Claim-->>CLI: "available=true + recommendation + attempts"
        CLI-->>Worker: claimed envelope
    else already held by another worker
        Store-->>Claim: already_claimed_by / skipped
        Claim-->>CLI: advance to next rank
    end
end
alt exhausted with --if-available
    CLI-->>Worker: "available=false non-error envelope"
else exhausted without --if-available
    CLI-->>Worker: no_available_next_item error
end
Loading
%%{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 Agent/Worker
participant CLI as pm claim --next / SDK claimNext
participant Next as runNext ranking
participant Claim as atomic runClaim
participant Store as Item store

Worker->>CLI: request next claim with filters + maxAttempts
CLI->>Next: compute ranked ready queue excluding decisions by default
Next-->>CLI: recommended + ready rows with one-based ranks
loop bounded candidate walk
    CLI->>Claim: attempt candidate claim
    Claim->>Store: test-and-set assignee under item mutation
    alt candidate still available
        Store-->>Claim: claimed item
        Claim-->>CLI: "available=true + recommendation + attempts"
        CLI-->>Worker: claimed envelope
    else already held by another worker
        Store-->>Claim: already_claimed_by / skipped
        Claim-->>CLI: advance to next rank
    end
end
alt exhausted with --if-available
    CLI-->>Worker: "available=false non-error envelope"
else exhausted without --if-available
    CLI-->>Worker: no_available_next_item error
end
Loading

Reviews (13): Last reviewed commit: "fix(ci): harden coverage jobs and comple..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds ranked atomic work selection across the CLI, SDK, MCP contracts, docs, and tests. The main changes are:

  • New filtered, bounded claimNext support for worker lanes.
  • Stable ranked pm next output with explicit one-based ranks.
  • Separate decision_needed output for human-gated Decision items.
  • Non-error empty --if-available result when no claimable candidate remains.

Confidence Score: 4/5

Mostly safe, with one contained ranking bug in the explicit-author claim-next path.

The CLI, SDK, contracts, docs, and tests are updated together. claimNext can choose the wrong item when callers pass --author or SDK author without matching PM_AUTHOR.

src/cli/commands/next.ts

T-Rex T-Rex Logs

What T-Rex did

  • I executed a focused Vitest repro that creates claimable items for Alice and other authors, ran runNext and runClaimNext with explicit author alice, and found that the author_affinity ranking used the environment variable PM_AUTHOR instead of the explicit caller, producing a zero author_affinity for Alice when PM_AUTHOR was env-bob or unset. The same run showed runClaimNext still claimed as alice, meaning the explicit author path was reached while the ranking identity remained environment-based.
  • I cataloged the full validation run and its artifacts, including the complete transcript, before/after state captures, exhaustion outcome, a summary, and a rerunnable validation script, to support end-to-end review of the claim-next validation.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
src/cli/commands/next.ts Adds ranked ready rows and decision-needed separation, but claim-next ranking still computes author affinity from the environment instead of the explicit author option.
src/cli/commands/claim.ts Adds bounded claim-next walking, max-attempt validation, and a non-error unavailable result for if-available exhaustion.
src/cli/register-operations.ts Wires claim --next filters, max-attempts, and include-decisions from Commander into runClaimNext.
src/sdk/runtime.ts Adds PmClient/top-level claimNext support and routes MCP claim next calls through runClaimNext.
src/sdk/cli-contracts/tool-schema.ts Adds claim-next-related parameters to the MCP/tool action schema contract.
tests/unit/commands/claim-command.spec.ts Covers filtered bounded claim-next, race walking, decision opt-in, and exhaustion behavior.
tests/unit/commands/next-command.spec.ts Covers ranked ready continuation and decision-needed separation for pm next.
tests/fixtures/contracts/full.json Refreshes generated contract snapshots for the new claim-next schema and command flags.

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
Loading
%%{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
Loading

Comments Outside Diff (1)

  1. src/cli/commands/next.ts, line 497 (link)

    P1 Uses wrong author
    runClaimNext passes callerAuthor so --author can rank and filter from the worker's lane, but the relevance candidate builder still reads process.env.PM_AUTHOR. When pm claim --next --author alice runs without that env var, author_affinity is computed for the wrong identity, so the claimed item can differ from the requested worker lane's ranking.

    Artifacts

    Repro: focused Vitest harness source for explicit claim-next author relevance

    • Contains supporting evidence from the run (text/typescript; charset=utf-8).

    Repro: failing Vitest output showing Alice author_affinity is zero under explicit author

    • Keeps the command output available without making the summary code-heavy.

    View artifacts

    T-Rex Ran code and verified through T-Rex

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/cli/commands/next.ts
    Line: 497
    
    Comment:
    **Uses wrong author**
    `runClaimNext` passes `callerAuthor` so `--author` can rank and filter from the worker's lane, but the relevance candidate builder still reads `process.env.PM_AUTHOR`. When `pm claim --next --author alice` runs without that env var, `author_affinity` is computed for the wrong identity, so the claimed item can differ from the requested worker lane's ranking.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/cli/commands/next.ts:497
**Uses wrong author**
`runClaimNext` passes `callerAuthor` so `--author` can rank and filter from the worker's lane, but the relevance candidate builder still reads `process.env.PM_AUTHOR`. When `pm claim --next --author alice` runs without that env var, `author_affinity` is computed for the wrong identity, so the claimed item can differ from the requested worker lane's ranking.

Reviews (1): Last reviewed commit: "feat(sdk): add ranked atomic work select..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/cli/register-operations.ts Resolved
Comment thread src/cli/register-operations.ts Resolved
Comment thread src/cli/commands/next.ts Resolved
@codecov

codecov Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 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.
@unbraind

Copy link
Copy Markdown
Owner Author

Review round addressed in e5eb6fb:

  • explicit caller author now drives relevance affinity
  • numeric SDK/MCP maxAttempts and priority inputs are preserved
  • ClaimNextOptions documents the 1..100 bound
  • opted-in Decisions no longer duplicate decision_needed rows
  • exhaustion code is centralized and SDK prose corrected

Focused 253-test suite plus strict lint/static gates pass. Re-triggering all available reviewers now.

@greptileai
/gemini review
@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

@unbraind: Thanks for the update — noted that explicit caller author now drives relevance affinity, numeric maxAttempts/priority inputs are preserved, the 1..100 bound is documented, opted-in Decisions no longer duplicate decision_needed rows, and exhaustion handling is centralized. I'll kick off a full review of the PR now.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 8 minutes.

Comment thread src/cli/commands/claim.ts Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/cli/commands/claim.ts Resolved
Comment thread src/cli/register-operations.ts Resolved
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.
@unbraind

Copy link
Copy Markdown
Owner Author

Review fixes are pushed in 6ba65021. Please perform a fresh full review of the current head.

@greptileai
/gemini review
@coderabbitai full review

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

@unbraind: Got it — I'll perform a fresh full review of the current head at 6ba65021, covering the SDK, MCP action schema, and CLI changes for the ranked atomic work-selection primitives.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 58 minutes.

@unbraind

Copy link
Copy Markdown
Owner Author

Bot follow-up on current head 6ba65021:

  • Gemini: the quota response is acknowledged; its last actionable finding was fixed, replied to, reacted to, and resolved. No paid quota expansion will be used.
  • CodeRabbit: the rate-limit response is acknowledged; the requested review is queued, and no paid quota expansion will be used.
  • @greptileai: the check reports confidence 4/5 without a new review comment or unresolved thread. All three prior Greptile findings are fixed with regression coverage and resolved. Please identify any remaining current-head finding required for 5/5, or rerun the check against 6ba65021.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

next command's flag/schema contract is missing --include-decisions.

src/cli/register-list-query.ts adds --include-decisions to the next command, but this fixture's command_flags entry for next (and the corresponding next action 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

📥 Commits

Reviewing files that changed from the base of the PR and between 26933b6 and 6ba6502.

📒 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.toon
  • CHANGELOG.md
  • docs/COMMANDS.md
  • docs/SDK.md
  • src/cli/commands/claim.ts
  • src/cli/commands/completion.ts
  • src/cli/commands/index.ts
  • src/cli/commands/next.ts
  • src/cli/register-list-query.ts
  • src/cli/register-operations.ts
  • src/sdk/cli-contracts/flag-contracts.ts
  • src/sdk/cli-contracts/tool-schema.ts
  • src/sdk/index.ts
  • src/sdk/runtime.ts
  • tests/fixtures/contracts/full.json
  • tests/unit/commands/claim-command.spec.ts
  • tests/unit/commands/next-command.spec.ts
  • tests/unit/commands/register-commands.spec.ts
  • tests/unit/sdk/sdk-index.spec.ts

Comment thread CHANGELOG.md Resolved
Comment thread src/cli/commands/completion.ts Resolved
Comment thread src/cli/commands/next.ts Resolved
Comment thread tests/fixtures/contracts/full.json Resolved
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.
@unbraind

Copy link
Copy Markdown
Owner Author

CodeRabbit final-round follow-up for 929dc1e1:

  • The three inline findings each have a direct evidence reply, positive reaction, and resolved thread.
  • The outside-diff contract finding is fixed at the source: includeDecisions now has a concrete parameter definition, so regeneration adds it to the next command/action schema.
  • The related claim action schema now also exposes next, ifAvailable, bounded maxAttempts, and includeDecisions under additionalProperties: false.
  • Focused 294 tests, contract regeneration/check, changelog generation/check, and strict lint/static gates pass.

Fresh current-head review requested:
@greptileai
/gemini review
@coderabbitai full review

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

@unbraind: Thanks for the update — noted that all three inline findings are resolved with evidence, the includeDecisions contract gap is fixed at the source so regeneration now covers it in both the next and claim schemas, and the focused 294-test suite plus contract/changelog regeneration and lint/static gates pass. I'll perform a fresh full review of the current head at 929dc1e1.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 38 minutes.

Comment thread src/sdk/cli-contracts/tool-schema.ts Resolved
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.
@unbraind

Copy link
Copy Markdown
Owner Author

Final current-head fix is pushed in 47b5e5bb. The Greptile discriminator finding has a direct evidence reply, positive reaction, regression coverage, and resolved thread. Please perform the final review of this exact head.

@greptileai
/gemini review
@coderabbitai full review

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

@unbraind: Acknowledged — noted that the Greptile discriminator finding at 47b5e5bb has a direct evidence reply, positive reaction, regression coverage, and a resolved thread. I'll perform the final full review of this exact head now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.
@unbraind

Copy link
Copy Markdown
Owner Author

@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

@unbraind

Copy link
Copy Markdown
Owner Author

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 Gates (coverage).

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

@unbraind: Got it — I'll perform a full review of the current head at b7cba902, covering the direct production-handler fixture initialization and the four-shard globally merged coverage gate changes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6ba6502 and b7cba90.

📒 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.yml
  • CHANGELOG.md
  • src/cli/commands/completion.ts
  • src/cli/commands/next.ts
  • src/sdk/cli-contracts/tool-parameter-tables.ts
  • src/sdk/cli-contracts/tool-schema.ts
  • tests/fixtures/contracts/full.json
  • tests/helpers/withTempPmPath.ts
  • tests/integration/ci-workflow-contract.spec.ts
  • tests/unit/commands/claim-command.spec.ts
  • tests/unit/commands/next-command.spec.ts
  • tests/unit/sdk/sdk-index.spec.ts

Comment thread .github/workflows/ci.yml Resolved
Comment thread src/cli/commands/completion.ts Resolved
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.
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai please review the current head dba15cf after the final security/completion feedback fixes.

/gemini review

@coderabbitai full review

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

@unbraind: Got it — I'll perform a full review of the current head at dba15cfd, covering the final security/completion feedback fixes on top of the ranked atomic work-selection bundle (SDK, MCP action schema, and CLI).

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 51 minutes.

@unbraind

Copy link
Copy Markdown
Owner Author

Final bot-response audit on dba15cfd:

  • Gemini could not run because its daily quota is exhausted; marked not useful for this round. Earlier Gemini findings were implemented and verified.
  • CodeRabbit acknowledged the current head but is review-rate-limited for 51 minutes; marked not useful for this round. Its two concrete findings on the immediately preceding head were implemented, replied to inline, reacted to, and resolved.
  • Greptile completed successfully on the current head.
  • Thread-aware audit reports zero unresolved review threads.
  • Every required CI, security, coverage, and Codecov check is green.

@unbraind

unbraind commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Tracked in PM: pm-1mwk, pm-7rlp, pm-eqk0, pm-fjxm, pm-krwu.

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

Labels

None yet

Projects

None yet

1 participant