Detect & Heal: How Self-Healing Code Review Works in CI/CD
Learn how Open Code Review's Detect & Heal workflow auto-fixes AI-generated code issues in your CI/CD pipeline — from scan to commit, zero human intervention.
Beyond Detection: The Self-Healing Pipeline
Most code review tools stop at reporting. They tell you what's wrong and leave you to fix it. Open Code Review goes further — it fixes the code for you.
The Detect & Heal Flow
PR Opened → ocr scan → Issues Found → ocr heal → Auto-Commit → PR Clean
This is the industry's first self-healing code review pipeline. Here's how to set it up.
GitHub Actions Setup
name: AI Code Review & Self-Heal
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Scan
run: npx @opencodereview/cli@latest scan ./src --threshold 70
- name: Heal
run: npx @opencodereview/cli@latest heal ./src
env:
OCR_PROVIDER: glm
OCR_API_KEY: ${{ secrets.OCR_API_KEY }}
- name: Commit fixes
run: |
git config --global user.name "OCR Bot"
git config --global user.email "[email protected]"
git add -A
git diff --cached --quiet || git commit -m "fix: OCR auto-heal"
git push
Why This Matters
Traditional CI/CD quality gates are binary — pass or fail. When code fails, a developer has to:
With Detect & Heal, steps 2-4 are automated. The AI that caused the issue also fixes it.
Supported Providers for Heal
| Provider | Cost | Quality |
|---|---|---|
| GLM (智谱) | Free | High |
| Ollama | Free | Good (local) |
| OpenAI | Paid | Excellent |
| DeepSeek | Paid | Very Good |
| Anthropic | Paid | Excellent |
Dry-Run Mode
Not ready for auto-commit? Preview fixes first:
ocr heal ./src --dry-run
This shows exactly what would change without modifying any files.
Results We've Seen
- •60-80% of AI-specific issues auto-healed successfully
- •Zero false fixes — heal validates its own patches
- •< 30s average heal time per scan
- •Teams report 2-3 fewer review rounds per PR
Related Articles
What Are AI Code Hallucinations and Why Traditional Tools Miss Them
AI code assistants like Copilot and Cursor can generate imports for packages that don't exist. Learn what hallucinated packages are, why they're dangerous, and how to detect them.
2026-03-20Open Code Review vs ESLint vs SonarQube: What Each Tool Actually Catches
A practical comparison of Open Code Review, ESLint, and SonarQube — what each tool catches, what it misses, and when to use which.
2026-03-15