Auto-Fixing with Refine
Use refine to automatically address failed reviews on your branch.
roborev refine # Fix failed reviews using default agentroborev refine --agent claude-code # Use specific agent for addressing findingsroborev refine --max-iterations 5 # Limit fix attemptsroborev refine --quiet # Show elapsed time instead of agent outputroborev refine --reasoning thorough # Use thorough reasoning (slower, more accurate)roborev refine --since abc123 # Refine commits since a specific commitroborev refine --since HEAD~3 # Refine the last 3 commits (works on main branch)How It Works
flowchart TD
Start([refine]) --> Find[Find oldest failed review]
Find --> A{Found?}
A -->|No| Branch[Run whole-branch review]
Branch --> C{Pass?}
C -->|Yes| Done([Done - all reviews pass])
C -->|No| Fix
A -->|Yes| Fix[AI agent addresses findings]
Fix --> Commit[Commit fix]
Commit --> Wait[Wait for re-review]
Wait --> Pass{Pass?}
Pass -->|Yes| Find
Pass -->|No| MaxCheck{Max iterations?}
MaxCheck -->|No| Fix
MaxCheck -->|Yes| Fail([Exit - max reached])
Processing Order
- The loop processes commits oldest-first
- When a fix fails review, it keeps addressing that fix until it passes
- Passing reviews are automatically marked as addressed
- When no individual failed reviews remain, a whole-branch review runs
- If that passes, the refiner exits successfully
Options
| Flag | Description |
|---|---|
--agent <name> | Agent to use for fixes |
--max-iterations <n> | Maximum fix attempts per commit (default: 3) |
--quiet | Show elapsed time instead of agent output |
--reasoning <level> | Reasoning depth: fast, standard, thorough |
--since <commit> | Refine commits since a specific commit |
Requirements
- Clean working tree: No uncommitted changes
- Feature branch: By default, compares against main
- Use
--since: To refine specific commits on any branch, including main
Security Considerations
The refine command runs AI agents without sandboxing so they can install dependencies, run builds, and execute tests. This is safe for your own code, but use caution with untrusted sources:
| Scenario | Risk Level | Recommendation |
|---|---|---|
| Your own branches | Low | Safe to run directly |
| PRs from trusted contributors | Low-Medium | Review changes before refining |
| PRs from strangers / untrusted code | High | Use isolation (see below) |
Isolation Options for Untrusted Code
- Run in a container or VM
- Use a low-privilege user account
- Use a disposable cloud instance
See Also
- Agent Modes - Review vs agentic mode details
- Agent Skills - Fix findings interactively