Skip to main content
scripts/pr-review-threads.py replaces the improvised manual workflow of paginating gh api graphql for a pull request’s review threads and hand-picking unresolved CodeRabbit comments to resolve. By default it runs gh in the repo’s activated Flox environment; set RUN_WITH_DAGGER=1 to opt into the shared Dagger wrapper, which runs the same gh calls in the prebuilt Flox-toolchain container.

Usage

--repo/--pr default to the current branch’s associated PR (via gh pr view). --provider coderabbitai is a shorthand for the coderabbitai[bot] author login; any other value matches an exact author.login. GH_TOKEN (or GITHUB_TOKEN, or gh auth token output) is required and is passed only as a child-process environment variable — never in command-line arguments, image layers, logs, or the script’s own output. With RUN_WITH_DAGGER=1, the wrapper supplies it to the container as a secret environment variable; otherwise it stays in the activated project process.

Safety model

  • inspect is strictly read-only and never invokes the resolve mutation.
  • resolve mutates only the thread IDs passed via --thread. It never guesses or resolves by path/body/provider.
  • Validation is all-or-nothing: any unknown thread ID, or any outdated thread without --allow-outdated, refuses the entire request before any mutation runs. GitHub has no batch resolve mutation, so this does not make the mutation calls themselves atomic — if a later one fails after earlier ones succeeded, the command reports what it actually resolved and exits non-zero.
  • Already-resolved thread IDs are reported as no-ops; no mutation call is issued for them.
  • Exit codes: 0 success, 2 usage error, 3 auth/API/GraphQL failure, 4 refusal (unsafe/unknown/outdated mutation request).

Implementation notes

Pagination is fully recursive across reviewThreads, reviews, top-level pull request comments, and each thread’s own nested comments connection. By default gh runs in the repo’s activated project environment; RUN_WITH_DAGGER=1 opts into the shared prebuilt execution image.
Last modified on August 5, 2026