Review Implement Phase
Run only the implementation phase of the review-framework loop:
take triaged will_address actions, make code changes, commit in logical steps, post GitHub status updates, and update action status.
Run commands from this skill directory. All script paths below are relative to it.
Inputs
- Required:
- PR URL
- existing
review-actions.json in output dir
- Optional:
- output directory
- scope constraints (specific action IDs or files)
If output directory is omitted, derive:
wip/reviews/<owner>_<repo>_pr-<number>/
Preconditions
<output-dir>/review-actions.json must exist and be valid v2.
System dependencies required on PATH:
node (Node.js)
gh (GitHub CLI)
If either is missing, halt immediately and ask the user to install it. The implement-phase scripts require only node and gh.
GitHub admin capability must be available before starting implementation:
node ./scripts/check-github-admin-ready.mjs --pr <PR_URL>
If missing, instruct user to run:
/review-fetch-phase <PR_URL> [output-dir]
/review-triage-phase <PR_URL> [output-dir]
Behavior
- Read actions JSON and select actionable rows:
decision: will_address
status: pending | in_progress
- Preflight GitHub admin capability:
- run
check-github-admin-ready.mjs and fail fast if unavailable
- Always post standalone comments (never pending PR reviews):
- When posting progress updates, do not create a PR review (draft/pending or otherwise).
- Forbidden flows:
gh pr review --comment ...
- GraphQL
addPullRequestReview, addPullRequestReviewComment, addPullRequestReviewThread (this workflow never uses pending reviews)
- Allowed flows:
- thread replies via
addPullRequestReviewThreadReply (or wrapper script)
- issue comments via
addComment (or wrapper script)
- Before starting implementation:
- Detect pending reviews authored by the acting user on this PR:
gh api graphql -f query='query($owner:String!,$repo:String!,$pr:Int!,$before:String){viewer{login} repository(owner:$owner,name:$repo){pullRequest(number:$pr){reviews(last:100,states:PENDING,before:$before){pageInfo{hasPreviousPage startCursor} nodes{id author{login}}}}}}' -F owner=<owner> -F repo=<repo> -F pr=<number> --jq '.data as $d | $d.repository.pullRequest.reviews | {mine: [.nodes[] | select(.author.login == $d.viewer.login)], pageInfo}'
- The
author.login filter matters: another user's pending review is not yours to submit or dismiss, and must not block this workflow. --jq is gh's built-in filter and needs no jq binary.
- The filter keeps
pageInfo beside the matches, because an empty mine alone cannot tell "no pending review" from "the match is on an earlier page". Read both: while mine is empty and pageInfo.hasPreviousPage is true, re-run the query with -f before=<pageInfo.startCursor>. Conclude there is no pending review only when mine is empty and hasPreviousPage is false.
- GitHub allows one pending review per user per PR, so
mine holds at most one node across all pages.
- If one exists, halt and clean it up (submit or dismiss) before continuing.
- After posting any "On it" / "Done" comment:
- Re-check for a pending review authored by the acting user, with the same filtered query and the same paging rule: keep reading
pageInfo until mine is non-empty or hasPreviousPage is false.
- If one exists, the workflow is blocked until it is cleaned up.
- Implementation requirement:
- For
review_thread targets, always reply using thread replies (never inline PR review comments).
- If you only have the thread node id, first fetch the thread’s primary comment node id, then call
addPullRequestReviewThreadReply.
- For
pull_request_review targets (review-body findings, PRR_… node ids), inline replies are not possible. post-review-thread-reply.mjs auto-detects this and posts a top-level PR issue comment instead (response kind: "issue_comment"); there is no thread to resolve, so the implementer skips resolve-review-thread.mjs for these and records the issue-comment id in the action's done record.
- Delegate implementation to:
./agents/review-implementer.md
- Require implementer responsibilities:
- make code changes
- run relevant checks
- create focused commits
- post "On it" when starting each action
- post "Done" when finished (universal); resolve the thread only when
target.kind === "review_thread" and a threadNodeId is available. pull_request_review targets have no inline thread, so the implementer skips the resolve step for them and records the issue-comment id in the action's done record (per behavior step 3).
- use encoded helper scripts for thread admin operations:
node ./scripts/post-review-thread-reply.mjs --repo <owner>/<repo> --pr <number> --comment-node-id <primaryCommentNodeId> --body "<text>" (works for both review_thread and pull_request_review — auto-detects node kind)
node ./scripts/resolve-review-thread.mjs --thread-node-id <threadNodeId> (only for review_thread targets)
- comments must be posted as individual standalone comments/replies, never as part of a pending review
- after each action completion (Done + resolve when applicable), verify no new pending review was created by the acting user
- never use inline parser snippets (for example:
python -c, node -e, ruby -e, ad-hoc awk/sed JSON parsing)
- only set
status: done after Done (and, for review_thread targets, resolve) succeeds
- update
review-actions.json (status, done.doneAt, done.summary, done.commits) in the same completion step
- Render latest action markdown:
node ../review-triage-phase/scripts/render-review-actions.mjs --in <output-dir>/review-actions.json --out <output-dir>/review-actions.md
Ownership
- This phase owns actual fixes plus posting Done and resolving completed threads.
- If GitHub thread reply/resolve cannot be performed, the phase is blocked and must not report completion.
- If comments were accidentally posted as a pending review, the phase is blocked until the pending review is explicitly submitted or dismissed and the action comments are re-posted as standalone comments.
Output to user
Return:
- commits created
- actions transitioned to done
- written artifacts (
review-actions.json, review-actions.md)
Suggest next steps:
/review-fetch-phase <PR_URL> [output-dir]
/review-triage-phase <PR_URL> [output-dir]
1---2name: review-implement-phase3description: Implements triaged review actions, commits focused fixes, and posts Done plus resolves threads. Use when the user wants only the implementation phase of the review-framework workflow.4---5
6# Review Implement Phase
7
8Run only the implementation phase of the review-framework loop:
9
10take triaged `will_address` actions, make code changes, commit in logical steps, post GitHub status updates, and update action status.
11
12Run commands from this skill directory. All script paths below are relative to it.
13
14## Inputs
15
16- Required:
17 - PR URL
18 - existing `review-actions.json` in output dir
19- Optional:
20 - output directory
21 - scope constraints (specific action IDs or files)
22
23If output directory is omitted, derive:
24
25`wip/reviews/<owner>_<repo>_pr-<number>/`
26
27## Preconditions
28
29`<output-dir>/review-actions.json` must exist and be valid v2.
30
31System dependencies required on PATH:
32
33- `node` (Node.js)
34- `gh` (GitHub CLI)
35
36If either is missing, halt immediately and ask the user to install it. The implement-phase scripts require only `node` and `gh`.
37
38GitHub admin capability must be available before starting implementation:
39
40```bash
41node ./scripts/check-github-admin-ready.mjs --pr <PR_URL>
42```
43
44If missing, instruct user to run:
45
46- `/review-fetch-phase <PR_URL> [output-dir]`
47- `/review-triage-phase <PR_URL> [output-dir]`
48
49## Behavior
50
511. Read actions JSON and select actionable rows:
52 - `decision: will_address`
53 - `status: pending | in_progress`
542. Preflight GitHub admin capability:
55 - run `check-github-admin-ready.mjs` and fail fast if unavailable
563. Always post standalone comments (**never pending PR reviews**):
57 - When posting progress updates, do **not** create a PR review (draft/pending or otherwise).
58 - Forbidden flows:
59 - `gh pr review --comment ...`
60 - GraphQL `addPullRequestReview`, `addPullRequestReviewComment`, `addPullRequestReviewThread` (this workflow never uses pending reviews)
61 - Allowed flows:
62 - thread replies via `addPullRequestReviewThreadReply` (or wrapper script)
63 - issue comments via `addComment` (or wrapper script)
64 - Before starting implementation:
65 - **Detect pending reviews authored by the acting user** on this PR:
66 `gh api graphql -f query='query($owner:String!,$repo:String!,$pr:Int!,$before:String){viewer{login} repository(owner:$owner,name:$repo){pullRequest(number:$pr){reviews(last:100,states:PENDING,before:$before){pageInfo{hasPreviousPage startCursor} nodes{id author{login}}}}}}' -F owner=<owner> -F repo=<repo> -F pr=<number> --jq '.data as $d | $d.repository.pullRequest.reviews | {mine: [.nodes[] | select(.author.login == $d.viewer.login)], pageInfo}'`
67 - The `author.login` filter matters: another user's pending review is not yours to submit or dismiss, and must not block this workflow. `--jq` is `gh`'s built-in filter and needs no `jq` binary.
68 - The filter keeps `pageInfo` beside the matches, because an empty `mine` alone cannot tell "no pending review" from "the match is on an earlier page". Read both: while `mine` is empty and `pageInfo.hasPreviousPage` is true, re-run the query with `-f before=<pageInfo.startCursor>`. Conclude there is no pending review only when `mine` is empty and `hasPreviousPage` is false.
69 - GitHub allows one pending review per user per PR, so `mine` holds at most one node across all pages.
70 - If one exists, **halt** and clean it up (submit or dismiss) before continuing.
71 - After posting any "On it" / "Done" comment:
72 - **Re-check for a pending review authored by the acting user**, with the same filtered query and the same paging rule: keep reading `pageInfo` until `mine` is non-empty or `hasPreviousPage` is false.
73 - If one exists, the workflow is **blocked** until it is cleaned up.
74 - Implementation requirement:
75 - For `review_thread` targets, always reply using **thread replies** (never inline PR review comments).
76 - If you only have the thread node id, first fetch the thread’s primary comment node id, then call `addPullRequestReviewThreadReply`.
77 - For `pull_request_review` targets (review-body findings, `PRR_…` node ids), inline replies are not possible. `post-review-thread-reply.mjs` auto-detects this and posts a top-level PR issue comment instead (response `kind: "issue_comment"`); there is no thread to resolve, so the implementer skips `resolve-review-thread.mjs` for these and records the issue-comment id in the action's `done` record.
784. Delegate implementation to:
79 - `./agents/review-implementer.md`
805. Require implementer responsibilities:
81 - make code changes
82 - run relevant checks
83 - create focused commits
84 - post "On it" when starting each action
85 - post "Done" when finished (universal); resolve the thread **only when `target.kind === "review_thread"`** and a `threadNodeId` is available. `pull_request_review` targets have no inline thread, so the implementer skips the resolve step for them and records the issue-comment id in the action's `done` record (per behavior step 3).
86 - use encoded helper scripts for thread admin operations:
87 - `node ./scripts/post-review-thread-reply.mjs --repo <owner>/<repo> --pr <number> --comment-node-id <primaryCommentNodeId> --body "<text>"` (works for both `review_thread` and `pull_request_review` — auto-detects node kind)
88 - `node ./scripts/resolve-review-thread.mjs --thread-node-id <threadNodeId>` (only for `review_thread` targets)
89 - comments must be posted as individual standalone comments/replies, never as part of a pending review
90 - after each action completion (Done + resolve when applicable), verify no new pending review was created by the acting user
91 - never use inline parser snippets (for example: `python -c`, `node -e`, `ruby -e`, ad-hoc awk/sed JSON parsing)
92 - only set `status: done` after Done (and, for `review_thread` targets, resolve) succeeds
93 - update `review-actions.json` (`status`, `done.doneAt`, `done.summary`, `done.commits`) in the same completion step
946. Render latest action markdown:
95
96```bash
97node ../review-triage-phase/scripts/render-review-actions.mjs --in <output-dir>/review-actions.json --out <output-dir>/review-actions.md
98```
99
100## Ownership
101
102- This phase owns actual fixes plus posting Done and resolving completed threads.
103- If GitHub thread reply/resolve cannot be performed, the phase is blocked and must not report completion.
104- If comments were accidentally posted as a pending review, the phase is blocked until the pending review is explicitly submitted or dismissed and the action comments are re-posted as standalone comments.
105
106## Output to user
107
108Return:
109
110- commits created
111- actions transitioned to done
112- written artifacts (`review-actions.json`, `review-actions.md`)
113
114Suggest next steps:
115
116- `/review-fetch-phase <PR_URL> [output-dir]`
117- `/review-triage-phase <PR_URL> [output-dir]`