Skip to main content

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

  1. Go to Settings in the sidebar → Automation
  2. Toggle Auto-Fix Findings on

The .codepeel.yml setting takes priority if both are configured.


How It Works

  1. CodePeel completes the review and identifies fixable findings
  2. Generates corrected code for each fixable issue (uses suggestedFix from findings)
  3. Fetches the original file content from your branch
  4. Applies fixes in reverse line order (to preserve line numbers)
  5. Creates a new branch: codepeel/fix-pr-{number}-{timestamp}
  6. Opens a PR targeting your feature branch (so fixes merge with your code)
  7. Posts a comment on your original PR linking to the fix PR

What Gets Auto-Fixed

CategoryExamples
Typo fixesVariable names, comments, strings
Missing error handlingAdding try/catch or .catch()
Security patternsReplacing eval(), innerHTML, unsafe deserialization
Performance fixesMemoization, lazy loading patterns
Import fixesMissing imports, unused imports
Simple refactoringsconst 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

FeatureSuggestion blocksAuto-fix PR
Apply individually
Apply all at once
Creates reviewable diff
Requires opt-inNoYes

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