Skip to content

Conversation

@beettlle
Copy link
Contributor

Summary

  • Introduces a new function filterOpencodeToolCallLines to clean up the output from the OpenCode CLI by removing JSON lines that represent tool calls, which are not needed for the review process.
  • Adds a helper function isOpencodeToolCallLine to identify these JSON lines.

Changes

  • Updated the Review method to utilize the new filtering function on the command output before returning the result.

Test plan

  • Verify that the output from OpenCodeAgent.Review no longer includes tool-call JSON lines.

Generated with Cursor

## Summary
- Introduces a new function `filterOpencodeToolCallLines` to clean up the output from the OpenCode CLI by removing JSON lines that represent tool calls, which are not needed for the review process.
- Adds a helper function `isOpencodeToolCallLine` to identify these JSON lines.

## Changes
- Updated the `Review` method to utilize the new filtering function on the command output before returning the result.

## Test plan
- [ ] Verify that the output from `OpenCodeAgent.Review` no longer includes tool-call JSON lines.

Generated with [Cursor](https://cursor.com)
@wesm
Copy link
Collaborator

wesm commented Jan 25, 2026

Thank you. I'll push some more commits here -- I'm also going to add some configuration options for opencode (e.g. model selection in .roborev.toml or config.toml)

@beettlle
Copy link
Contributor Author

I'm getting other errors with OpenCode now. Will keep looking a this later.

My use case is, I use Cursor and want to use roborev with a local Ollama model for reviews to save some money. My MacPro can run qwen2.5-coder:32b with 32k context window without breaking a sweat.

@wesm
Copy link
Collaborator

wesm commented Jan 25, 2026

Makes sense. I have a couple inference servers on my tailnet I can use for testing so I can work on ollama support after I get #126 merged and cut the 0.17.0 release

wesm added a commit that referenced this pull request Jan 25, 2026
## 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>
@wesm
Copy link
Collaborator

wesm commented Jan 25, 2026

This was included in #126

@wesm wesm closed this Jan 25, 2026
@wesm wesm mentioned this pull request Jan 25, 2026
@beettlle
Copy link
Contributor Author

In case it's useful, this is the opencode.json that I have that got it to, mostly, work.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "ollama/roborev-coder",
  "permission": {
    "*": "deny",
    "read": "allow",
    "edit": "allow",
    "bash": "allow",
    "grep": "allow",
    "glob": "allow",
    "list": "allow",
    "webfetch": "deny",
    "task": "deny",
    "todoread": "deny",
    "todowrite": "deny"
  },
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "roborev-coder": {
          "name": "roborev-coder (local)"
        }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants