Context
During a recent swarm session, an agent executed a redundant, duplicative review on a MERGED PR. The agent used get_pull_request_diff to fetch the code but failed to verify the current PR state (Verify-Before-Assert violation).
The Problem
The .agents/skills/pr-review/references/pr-review-guide.md instructed agents to "retrieve the state" using get_pull_request_diff and get_conversation. Neither tool inherently returns the PR's OPEN/MERGED/CLOSED state flag. This structural gap allows an agent to bypass state verification and unknowingly review closed work.
The Architectural Reality
Agents must explicitly rely on the gh CLI (gh pr view <number> --json state) to guarantee PR state before pulling codebase diffs.
The Fix
Update the "Context Initialization" step in .agents/skills/pr-review/references/pr-review-guide.md to explicitly mandate the execution of gh pr view <N> --json state and abort if the PR is MERGED or CLOSED. Keep the instruction terse to preserve MCP tool context budgets.
Acceptance Criteria
Out of Scope
Refactoring other areas of the pr-review skill.
Related
- PR #10503 (Target of the erroneous duplicate review)
Context
During a recent swarm session, an agent executed a redundant, duplicative review on a
MERGEDPR. The agent usedget_pull_request_diffto fetch the code but failed to verify the current PR state (Verify-Before-Assert violation).The Problem
The
.agents/skills/pr-review/references/pr-review-guide.mdinstructed agents to "retrieve the state" usingget_pull_request_diffandget_conversation. Neither tool inherently returns the PR'sOPEN/MERGED/CLOSEDstate flag. This structural gap allows an agent to bypass state verification and unknowingly review closed work.The Architectural Reality
Agents must explicitly rely on the
ghCLI (gh pr view <number> --json state) to guarantee PR state before pulling codebase diffs.The Fix
Update the "Context Initialization" step in
.agents/skills/pr-review/references/pr-review-guide.mdto explicitly mandate the execution ofgh pr view <N> --json stateand abort if the PR isMERGEDorCLOSED. Keep the instruction terse to preserve MCP tool context budgets.Acceptance Criteria
pr-review-guide.mdContext Initialization step mandates checking PR state viagh pr view.OPEN.Out of Scope
Refactoring other areas of the
pr-reviewskill.Related