Auto-Fix PRs
CodePeel can automatically create a fix PR that resolves all fixable findings from your review.
How to Enable
Option 1: Via .codepeel.yml
auto_fix:
enabled: true
Option 2: Via the Dashboard
- Go to Settings in the sidebar → Automation
- Toggle Auto-Fix Findings on
The
.codepeel.ymlsetting takes priority if both are configured.
How It Works
- CodePeel completes the review and identifies fixable findings
- Generates corrected code for each fixable issue (uses
suggestedFixfrom findings) - Fetches the original file content from your branch
- Applies fixes in reverse line order (to preserve line numbers)
- Creates a new branch:
codepeel/fix-pr-{number}-{timestamp} - Opens a PR targeting your feature branch (so fixes merge with your code)
- Posts a comment on your original PR linking to the fix PR
What Gets Auto-Fixed
| Category | Examples |
|---|---|
| Typo fixes | Variable names, comments, strings |
| Missing error handling | Adding try/catch or .catch() |
| Security patterns | Replacing eval(), innerHTML, unsafe deserialization |
| Performance fixes | Memoization, lazy loading patterns |
| Import fixes | Missing imports, unused imports |
| Simple refactorings | const vs let, template literals, nullish coalescing |
What Does NOT Get Auto-Fixed
- Complex logic changes (too risky to automate)
- Architectural refactoring (needs human judgment)
- Multi-file refactoring (cross-cutting concerns)
- Business logic changes (requires domain knowledge)
Auto-Fix vs. Suggestion Blocks
| Feature | Suggestion blocks | Auto-fix PR |
|---|---|---|
| Apply individually | ✅ | — |
| Apply all at once | — | ✅ |
| Creates reviewable diff | — | ✅ |
| Requires opt-in | No | Yes |
Even without auto-fix enabled, every fixable finding includes a GitHub suggestion block for one-click individual fixes.
Important Notes
- Auto-fix is opt-in — disabled by default
- Always review the fix PR before merging
- Fire-and-forget — fix generation failure doesn't affect the main review
- Auto-fix and auto-test can both be enabled — they create separate PRs
- Only findings with a concrete code suggestion get auto-fixed — complex issues are skipped
← All docsCodePeel