You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add configurable model support for all agents (#126)
## Summary
Adds `--model` flag support to all agents (codex, claude-code, gemini,
copilot, opencode), allowing users to specify which model an agent
should use. This lays the groundwork for the more comprehensive
agent/model-per-reasoning-level configuration described in #125.
## Changes
### CLI
- Add `--model` flag to `review`, `refine`, and `run` commands
- Help text explains format varies by agent (e.g., opencode uses
`provider/model`)
### Configuration
- `default_model` in `~/.roborev/config.toml` - global default model
- `model` in `.roborev.toml` - per-repo model override
- Resolution priority: CLI flag > repo config > global config > agent
default
### Agent Interface
- All agents implement `WithModel(model string) Agent`
- Model passed to underlying CLI where supported (`--model`, `-m`, etc.)
### Database & Sync
- Added `model` column to Postgres schema (v1→v2 migration)
- Model included in job sync between SQLite and Postgres
- Model returned in job listing/detail API responses
- COALESCE backfill ensures existing jobs get model populated on upsert
### Schema Management
- Postgres schema now defined in `internal/storage/schemas/*.sql` files
- Single source of truth, easy to diff between versions
- v1→v2 migration tested with job data preservation
### Bug Fixes
- Fixed `OpenCodeAgent.WithReasoning` to preserve Model field
- Improved OpenCode tool-call filter documentation
## Relationship to #125
This PR provides the foundation for the model-per-reasoning-level
feature proposed in #125:
| This PR | Enables in #125 |
|---------|-----------------|
| `WithModel()` on all agents | Phase 2 model overrides |
| `default_model` / `model` config | Fallback when no per-reasoning
override |
| `model` column in database | Already stores resolved model per job |
| `ResolveModel()` function | Base for future
`ResolveReviewModel(reasoning, ...)` |
The database schema does not need further changes - the single `model`
column stores whichever model was resolved at enqueue time, regardless
of selection mechanism.
## Supersedes
Supersedes #124 (OpenCode tool-call filtering) - that fix is included
here along with improved documentation.
## Test Plan
- [x] Unit tests for `ResolveModel()` config resolution
- [x] Unit tests for `WithModel()` persistence across all agents
- [x] Unit tests for model flag generation in `buildArgs()`
- [x] Integration tests for Postgres v1→v2 migration
- [x] Integration tests for COALESCE model backfill (Postgres & SQLite)
- [x] All existing tests pass
---------
Co-authored-by: Cesar Delgado <beettlle@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments