GitHub PR Comment Handler
Use this skill when the user wants to work through requested changes on a GitHub pull request. Use the GitHub app for PR metadata and patch context when available, but treat thread-aware review data as a GraphQL problem because flat comment surfaces do not preserve full review-thread state.
Thread Reader
The bundled reader defaults to a persistently authenticated gh:
python scripts/fetch_comments.py
For a short-lived GitHub App wrapper, pass the compatible executable plus an explicit base repository and PR number:
python scripts/fetch_comments.py \
--gh-cli codex-gh \
--repo OWNER/REPOSITORY \
--pr 123
--gh-cli also defaults from GH_CLI when set. The value must be one executable or wrapper path that accepts normal gh arguments; the reader never invokes a shell. Set any wrapper-specific environment outside the command. Prefer explicit --repo and --pr with wrappers so the target does not depend on local branch discovery.
The selected CLI performs both the authentication check and GraphQL calls. A wrapper may mint and inject a short-lived token internally; the reader does not need a stored token or gh auth login. Do not print, persist, or pass token values as command-line arguments.
When --repo and --pr are omitted, the reader uses gh pr view --json number,url through the same selected CLI and derives the base OWNER/REPOSITORY from the returned PR URL. The two explicit target arguments must be supplied together.
Workflow
- Resolve the PR.
- If the user provides a repository and PR number or URL, pass the repository and number explicitly.
- Otherwise, use local git context and the configured CLI to resolve the current branch PR.
- Inspect review context with thread-aware reads.
- Use the GitHub app to fetch PR metadata and patch context when the repo and PR are known.
- Use
scripts/fetch_comments.py whenever the task depends on unresolved review threads, inline review locations, comment URLs, or resolution state.
- Use
isResolved as the authoritative thread state. Treat viewerCanResolve as advisory for GitHub App flows because the field can be false even when the same dedicated App's resolveReviewThread mutation succeeds.
- Use connector-only comment reads only for lightweight top-level PR comment summaries.
- Cluster actionable review threads.
- Group comments by file or behavior area.
- Separate actionable change requests from informational comments, approvals, already-resolved threads, and duplicates.
- Confirm scope before editing.
- Present numbered actionable threads with a one-line summary of the required change.
- If the user did not ask to fix everything, ask which threads to address.
- If the user asks to fix everything, interpret that as all unresolved actionable threads and call out anything ambiguous.
- Implement the selected fixes locally.
- Keep each code change traceable back to the thread or feedback cluster it addresses.
- If a comment calls for explanation rather than code, draft the response rather than forcing a code change.
- Summarize the result.
- List which threads were addressed, which were intentionally left open, and what tests or checks support the change.
Write Safety
- Do not reply on GitHub, resolve review threads, or submit a review unless the user explicitly asks for that write action.
- Treat a PR review, a REST reply/comment write, and the GraphQL
resolveReviewThread mutation as separate authorization boundaries. A successful review or reply does not prove resolution authority.
- For GitHub App wrappers, treat the exact minted permission set plus repository selection as the boundary. Do not infer resolution authority from App identity,
pull_requests:write, issues:write, or adjacent REST writes. If the same dedicated reviewer App already has repository-specific contents:write for an authorized merge flow, that may be the minimum scope that also permits thread resolution; otherwise do not broaden the token implicitly.
- When resolving addressed threads is explicitly authorized, attempt only threads that are demonstrably addressed, route on the mutation result, and re-read each affected thread's
isResolved value before reporting it resolved.
- If
resolveReviewThread returns an integration FORBIDDEN error such as Resource not accessible by integration, keep any posted reply or review as evidence, leave the thread unresolved, and hand off boundedly with the thread URLs, sanitized permission names that failed, and the two permitted next actions: an authorized collaborator resolves those specific threads manually, or the operator explicitly grants the repository-specific minimum scope to the same dedicated reviewer App and reruns verification. Do not switch to another GitHub identity or ask for broader credentials unless the operator explicitly authorizes that scope change.
- If review comments conflict or would cause a behavioral regression, surface the tradeoff before making changes.
- If a comment is ambiguous, ask for clarification or draft a proposed response instead of guessing.
- Do not treat flat PR comments as a complete representation of review-thread state.
- If the selected CLI hits authentication or rate-limit issues, refresh its authentication according to the chosen bare-CLI or wrapper flow and retry. Do not default to persistent login when a short-lived wrapper is configured.
Fallback
If neither the connector nor the configured CLI can resolve the PR cleanly, identify whether the missing scope is the repository, PR number, or CLI authentication. Retry with explicit --repo and --pr before changing authentication mechanisms.
1---2name: gh-address-comments3description: Address actionable GitHub pull request review feedback. Use when the user wants to inspect unresolved review threads, requested changes, or inline review comments on a PR, then implement selected fixes. Use the GitHub app for PR metadata and flat comment reads, and use the bundled GraphQL script through a compatible GitHub CLI or short-lived GitHub App wrapper whenever thread-level state matters.4---56<!-- Modified from the OpenAI GitHub plugin skill to support configurable CLI wrappers and explicit PR targets. -->78# GitHub PR Comment Handler910Use this skill when the user wants to work through requested changes on a GitHub pull request. Use the GitHub app for PR metadata and patch context when available, but treat thread-aware review data as a GraphQL problem because flat comment surfaces do not preserve full review-thread state.1112## Thread Reader1314The bundled reader defaults to a persistently authenticated `gh`:1516```sh17python scripts/fetch_comments.py18```1920For a short-lived GitHub App wrapper, pass the compatible executable plus an explicit base repository and PR number:2122```sh23python scripts/fetch_comments.py \24 --gh-cli codex-gh \25 --repo OWNER/REPOSITORY \26 --pr 12327```2829`--gh-cli` also defaults from `GH_CLI` when set. The value must be one executable or wrapper path that accepts normal `gh` arguments; the reader never invokes a shell. Set any wrapper-specific environment outside the command. Prefer explicit `--repo` and `--pr` with wrappers so the target does not depend on local branch discovery.3031The selected CLI performs both the authentication check and GraphQL calls. A wrapper may mint and inject a short-lived token internally; the reader does not need a stored token or `gh auth login`. Do not print, persist, or pass token values as command-line arguments.3233When `--repo` and `--pr` are omitted, the reader uses `gh pr view --json number,url` through the same selected CLI and derives the base `OWNER/REPOSITORY` from the returned PR URL. The two explicit target arguments must be supplied together.3435## Workflow36371. Resolve the PR.38 - If the user provides a repository and PR number or URL, pass the repository and number explicitly.39 - Otherwise, use local git context and the configured CLI to resolve the current branch PR.402. Inspect review context with thread-aware reads.41 - Use the GitHub app to fetch PR metadata and patch context when the repo and PR are known.42 - Use `scripts/fetch_comments.py` whenever the task depends on unresolved review threads, inline review locations, comment URLs, or resolution state.43 - Use `isResolved` as the authoritative thread state. Treat `viewerCanResolve` as advisory for GitHub App flows because the field can be false even when the same dedicated App's `resolveReviewThread` mutation succeeds.44 - Use connector-only comment reads only for lightweight top-level PR comment summaries.453. Cluster actionable review threads.46 - Group comments by file or behavior area.47 - Separate actionable change requests from informational comments, approvals, already-resolved threads, and duplicates.484. Confirm scope before editing.49 - Present numbered actionable threads with a one-line summary of the required change.50 - If the user did not ask to fix everything, ask which threads to address.51 - If the user asks to fix everything, interpret that as all unresolved actionable threads and call out anything ambiguous.525. Implement the selected fixes locally.53 - Keep each code change traceable back to the thread or feedback cluster it addresses.54 - If a comment calls for explanation rather than code, draft the response rather than forcing a code change.556. Summarize the result.56 - List which threads were addressed, which were intentionally left open, and what tests or checks support the change.5758## Write Safety5960- Do not reply on GitHub, resolve review threads, or submit a review unless the user explicitly asks for that write action.61- Treat a PR review, a REST reply/comment write, and the GraphQL `resolveReviewThread` mutation as separate authorization boundaries. A successful review or reply does not prove resolution authority.62- For GitHub App wrappers, treat the exact minted permission set plus repository selection as the boundary. Do not infer resolution authority from App identity, `pull_requests:write`, `issues:write`, or adjacent REST writes. If the same dedicated reviewer App already has repository-specific `contents:write` for an authorized merge flow, that may be the minimum scope that also permits thread resolution; otherwise do not broaden the token implicitly.63- When resolving addressed threads is explicitly authorized, attempt only threads that are demonstrably addressed, route on the mutation result, and re-read each affected thread's `isResolved` value before reporting it resolved.64- If `resolveReviewThread` returns an integration `FORBIDDEN` error such as `Resource not accessible by integration`, keep any posted reply or review as evidence, leave the thread unresolved, and hand off boundedly with the thread URLs, sanitized permission names that failed, and the two permitted next actions: an authorized collaborator resolves those specific threads manually, or the operator explicitly grants the repository-specific minimum scope to the same dedicated reviewer App and reruns verification. Do not switch to another GitHub identity or ask for broader credentials unless the operator explicitly authorizes that scope change.65- If review comments conflict or would cause a behavioral regression, surface the tradeoff before making changes.66- If a comment is ambiguous, ask for clarification or draft a proposed response instead of guessing.67- Do not treat flat PR comments as a complete representation of review-thread state.68- If the selected CLI hits authentication or rate-limit issues, refresh its authentication according to the chosen bare-CLI or wrapper flow and retry. Do not default to persistent login when a short-lived wrapper is configured.6970## Fallback7172If neither the connector nor the configured CLI can resolve the PR cleanly, identify whether the missing scope is the repository, PR number, or CLI authentication. Retry with explicit `--repo` and `--pr` before changing authentication mechanisms.