refix is a Python CLI that automatically triages and fixes unresolved CodeRabbit feedback on GitHub pull requests by using Claude and the GitHub CLI.
refix is designed for repositories that use CodeRabbit for automated PR review and want to close the loop automatically.
For each configured repository, refix can:
- scan open pull requests,
- detect unresolved CodeRabbit reviews and unresolved inline review threads,
- summarize review feedback before starting a fix pass,
- inspect failing GitHub Actions checks and include failed log excerpts in the fix prompt,
- update PR branches that are behind the base branch,
- ask Claude to apply code fixes,
- push commits back to the PR branch,
- resolve review threads after successful fixes, and
- persist progress in a PR state comment and with labels such as
refix:runningandrefix:done.
When CodeRabbit reports a review-side rate limit, refix keeps the PR in refix:running, still allows CI repair and base-branch catch-up, and skips review-fix / auto-merge until CodeRabbit can resume.
Before fixing code, refix can summarize unresolved review feedback into a more actionable prompt for the coding agent.
The tool invokes Claude to apply the requested changes directly in the checked-out pull request branch and pushes the resulting commits.
When a pull request has failing GitHub Actions checks, refix fetches failed log output and feeds the most relevant excerpts into the fix prompt so the agent can repair CI failures first.
If a PR branch is behind the base branch, refix can merge the latest base branch into it and continue the repair flow. Merge conflicts are also routed through the Claude-based fixing flow.
You can target a single repository such as owner/repo, or expand all repositories under an owner with owner/*.
Processed review items are recorded back to the pull request, which prevents the same unresolved feedback from being handled repeatedly.
- Python 3.12
ghCLI authenticated against GitHub- Claude CLI authentication for actual fix runs
- A
.refix.yamlconfiguration file - Optional
.envfile for local environment variables
-
Install dependencies and create local template files:
make setup -
Edit
.refix.yamlbased on.refix.yaml.sample. -
Authenticate the required CLIs:
gh auth login- Claude CLI authentication, or set
CLAUDE_CODE_OAUTH_TOKEN
-
Run one of the following commands:
make dry-run— show what would happen without calling Claudemake run-summarize-only— summarize review feedback onlymake run— run the full fix flow with verbose logsmake run-silent— run the full fix flow with reduced logs
refix reads configuration from .refix.yaml in the repository root, or from a path passed with --config.
models:
summarize: "haiku"
fix: "sonnet"
ci_log_max_lines: 120
# Automatically merge PR when it reaches refix:done state (optional, default false)
auto_merge: false
# Automatically post `@coderabbitai resume` after a CodeRabbit rate-limit wait expires
# (optional, default false)
coderabbit_auto_resume: false
# Whether to process draft PRs (optional)
# Default: false (draft PRs are skipped)
process_draft_prs: false
# Repository targets (required)
repositories:
- repo: "owner/repo"
user_name: "Refix Bot"
user_email: "bot@example.com"Model settings for Claude-based processing.
-
Type: mapping
-
Required: no
-
Default:
models: summarize: "haiku" fix: "sonnet"
Supported nested keys:
summarizefix
Unknown nested keys are ignored with a warning.
Maximum number of failed CI log lines included in the fix prompt.
- Type: integer
- Required: no
- Default:
120 - Minimum effective value:
20
Use this to control prompt size when a PR has failing GitHub Actions checks. Smaller values reduce prompt volume, while larger values include more context from failed jobs.
Automatically merge the fix PR when it reaches the refix:done state.
- Type: boolean
- Required: no
- Default:
false
When enabled, refix will trigger GitHub's auto-merge on the PR after applying fixes. Auto-merge only completes once all required status checks pass.
Whether to include draft PRs in the processing targets.
- Type: boolean
- Required: no
- Default:
false
When set to false (the default), draft PRs are skipped. Set to true to process draft PRs alongside regular open PRs.
Whether refix should automatically post @coderabbitai resume after a CodeRabbit rate-limit comment says the wait time has elapsed.
- Type: boolean
- Required: no
- Default:
false
When a rate-limit notice is active, refix keeps the PR in refix:running, skips review-fix / auto-merge, and still performs CI repair plus base-branch merge handling. Enabling this option lets refix resume CodeRabbit automatically once the wait window has passed.
List of repositories that refix should process.
- Type: non-empty list
- Required: yes
- Default: none
Each entry supports the keys below.
Repository target in owner/repo format.
- Type: string
- Required: yes
- Example:
octocat/Hello-World
You can also use owner/* to expand all repositories under a GitHub user or organization. Other wildcard styles such as owner/repo* are not supported by the current implementation.
Git author name used for commits created by refix.
- Type: string
- Required: no
- Default: not set
If omitted, refix falls back to the effective Git identity available in the execution environment.
Git author email used for commits created by refix.
- Type: string
- Required: no
- Default: not set
If omitted, refix falls back to the effective Git identity available in the execution environment.
- The YAML root must be a mapping.
repositoriesmust be present and must contain at least one entry.- Unknown keys are ignored with warnings rather than treated as hard errors.
models.summarizein YAML takes priority over theREFIX_MODEL_SUMMARIZEenvironment variable when selecting the summarization model.- The
coderabbit_auto_resumeoption only affects active CodeRabbit rate-limit comments; duplicate@coderabbitai resumecomments are avoided when one has already been posted after the latest rate-limit notice.
This repository already includes the workflow used to run refix in GitHub Actions: .github/workflows/run-auto-review.yml.
The workflow:
- checks out the repository,
- installs Python 3.12 and Python dependencies,
- installs the Claude CLI,
- writes
.refix.yamlfrom the GitHub Actions variableREFIX_CONFIG_YAML, - configures Git authentication for push operations, and
- changes to the
srcdirectory and runspython auto_fixer.py --config ../.refix.yaml.
Set the following values in the target repository or organization:
REFIX_CONFIG_YAML- The full YAML configuration text for
refix. - Store the same content that you would place in a local
.refix.yamlfile.
- The full YAML configuration text for
GH_PAT- Personal access token used for GitHub API access and pushing fix commits.
CLAUDE_CODE_OAUTH_TOKEN- Token used by the Claude CLI during automated fix runs.
- Open
Settings->Secrets and variables->Actions. - Add the
REFIX_CONFIG_YAMLvariable. - Add the
GH_PATandCLAUDE_CODE_OAUTH_TOKENsecrets. - Open the
Run auto reviewworkflow in the Actions tab. - Trigger the workflow with
Run workflow.
models:
summarize: "haiku"
fix: "sonnet"
ci_log_max_lines: 120
repositories:
- repo: "your-org/your-repo"
user_name: "Refix Bot"
user_email: "bot@example.com".github/workflows/run-auto-review.yml- Manual (
workflow_dispatch) execution for the actual auto-fix flow.
- Manual (
.github/workflows/test.yml- Test workflow triggered on pull requests and on manual dispatch.
Contributions are welcome.
- Open an issue for bugs, ideas, or questions.
- Submit a pull request for fixes, improvements, or documentation updates.
- Use the provided issue and pull request templates to keep reports actionable.
This project is licensed under the MIT License. See LICENSE.