gh-pr-comment-fixer
Fix GitHub PR review comments using the gh CLI: fetch review threads, implement requested changes, run the full test suite, commit and push fixes, then resolve the review threads. Use when asked to ad
SKILL.md.codex/skills/gh-pr-comment-fixer/SKILL.md
GitHubGh Pr Comment Fixer
Use this on a writable PR branch when actionable review feedback exists.
If you only need to detect whether review feedback, CI failure, stale head state, or mergeability needs attention, start with the read-only babysitter snapshot instead:
uv run python scripts/dev/pr_babysitter_snapshot.py <pr-number> --expected-head-sha <sha> --json
Use this skill after that snapshot recommends process_review_comment or when the user explicitly
asks to fix known review comments.
Scope
- Fetch PR context for current branch.
- Read
docs/context/issue_relationships.mdand the linked issue's current native relationship state while fixing comments. PR bodies do not mirror those links. - Collect review threads and top-level PR comments.
- Apply only fixable-now items that stay inside PR scope.
- Run proof at the tightest practical level, then push and resolve threads.
Workflow
- Confirm PR for current branch and branch match.
- Pull requested comments and review threads; keep thread IDs for actionable items. Re-read the linked issue's native Parent/Blocked by/Blocking state before any relationship-related edit.
- Classify requests:
- fixable now,
- needs clarification (ask before editing),
- out-of-scope (defer).
- Apply minimal edits grouped by concern.
- Run appropriate validation (prefer targeted first; full suite only when needed by risk).
- Commit and push.
- Rebuild the final PR title/body from the post-fix diff and validation, then run the REST reconciliation helper with the final title and body. A no-op is valid; any metadata change invalidates prior final-state review evidence and requires a fresh exact-head review trailer. Do not infer or silently change graph edges while applying review fixes.
- Re-query unresolved review threads after the push and metadata reconciliation before resolving anything. Bots may add fresh findings once a draft PR becomes ready or after the first fix commit.
- Resolve only addressed threads using the
resolveReviewThreadmutation viagh api graphql. - Re-check thread state; report any unresolved items with blocker reason (permissions, rate limits, or external dependency).
Anti-Loop / Retry
- Do not rerun unchanged failing validation more than twice without code change or clarified input.
- If a review request cannot be fixed safely, leave a precise blocker note and stop.
Artifact and Race Rules
- Inspect
output/-class artifacts before commit and document disposal/durability. - Verify PR head before applying fixes; avoid resolving threads not yet satisfied by code or commit.
- Do not force-push or mutate thread state for unresolved/ambiguous feedback.
- Do not create native issue links from review prose. Relationship changes require an explicit issue declaration, a fresh read, and native-link readback from the writable worktree.
Required Output
- Which comments were fixed,
- validation command and result,
- commit SHA pushed,
- post-push unresolved-thread re-query result,
- resolved thread IDs,
- remaining open threads/blockers.
When to use
Use this skill for the scope named in its frontmatter description and registry metadata.
Guardrails
- Stay within the skill scope declared in
.agents/skills/skills.yaml. - Prefer repository scripts and canonical docs before ad-hoc commands.
- Record blockers and validation gaps instead of overstating completion.
Output
Return the schema named by the output_schema frontmatter field, or a compact equivalent when the caller does not require YAML.