feat(opencode): update AI provider configurations and model settings - #289
Conversation
Summary of ChangesHello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the AI tooling setup by updating the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the OpenCode configuration by updating AI provider settings and model configurations for improved AI tooling capabilities. The changes focus on adding a specialized code review agent, updating default models, and configuring UI preferences.
- Added a dedicated code-reviewer agent with Claude Sonnet model and restricted file modification tools
- Updated primary model from "kimi-k2" to "grok-code" and added "small_model" configuration
- Added TUI scroll speed configuration for better user experience
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📝 WalkthroughSummary by CodeRabbit
WalkthroughUpdates the OpenCode configuration: changes the root model to "grok-code", adds a root small_model "kimi-k2", introduces an agent.code-reviewer with settings and disabled write/edit tools, and adds a root tui block with scroll_speed. Provider and plugin structure remain, with minor formatting tweaks. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant CLI as OpenCode CLI
participant Agent as Agent: code-reviewer
participant LLM as Model Provider
participant Tools as Tools (write/edit)
User->>CLI: invoke code-review
CLI->>Agent: start with prompt & config
Note over Agent: Uses model: "Claude Sonnet 4"<br/>Focus: security/perf/maintainability
Agent->>LLM: send review request
LLM-->>Agent: review analysis
Agent->>Tools: check permissions
alt Tools disabled
Note over Tools: write=false, edit=false
Agent-->>CLI: return read-only review
else Tools enabled
Agent->>Tools: apply changes
Tools-->>Agent: changes applied
Agent-->>CLI: review + edits
end
CLI-->>User: display results (TUI scroll_speed=3)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the opencode.jsonc configuration file, changing the default model, adding a new agent, and other settings. The changes are generally good, but I've identified a potential issue with how new models are specified. Both the new default model and the model for the code-reviewer agent are defined without an explicit link to a provider. This could cause the application to fail if it cannot automatically resolve them. My review includes suggestions to make these model configurations more explicit and robust, improving the maintainability of the file.
| "$schema": "https://opencode.ai/config.json", | ||
| "theme": "opencode", | ||
| "model": "kimi-k2", | ||
| "model": "grok-code", |
There was a problem hiding this comment.
The default model has been changed to grok-code. However, this model is not explicitly defined under any of the configured providers (lmstudio, ollama, openai, openrouter). This reliance on implicit model resolution can make the configuration fragile. If the tool fails to find a provider for grok-code, it could lead to a runtime failure. It would be more robust to explicitly define this model under its provider, for instance, in the openrouter.models section if it's an OpenRouter model.
| "code-reviewer": { | ||
| "description": "Reviews code for best practices and potential issues", | ||
| "model": "anthropic/claude-sonnet-4-20250514", | ||
| "prompt": "You are a code reviewer. Focus on security, performance, and maintainability.", | ||
| "tools": { | ||
| // Disable file modification tools for review-only agent | ||
| "write": false, | ||
| "edit": false | ||
| } | ||
| } |
There was a problem hiding this comment.
The model anthropic/claude-sonnet-4-20250514 is specified for the new code-reviewer agent without an explicit provider. This could lead to resolution issues if the tool cannot automatically determine which provider to use. To make the configuration more robust and self-documenting, I suggest explicitly defining the provider for this agent's model. Assuming openrouter is the intended provider, you could add a provider key.
"code-reviewer": {
"description": "Reviews code for best practices and potential issues",
"model": "anthropic/claude-sonnet-4-20250514",
"provider": "openrouter",
"prompt": "You are a code reviewer. Focus on security, performance, and maintainability.",
"tools": {
// Disable file modification tools for review-only agent
"write": false,
"edit": false
}
}
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
home-manager/modules/opencode/opencode.jsonc(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
home-manager/**
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Keep home-manager configurations under home-manager/
Files:
home-manager/modules/opencode/opencode.jsonc
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: e2e-run (NixOS, ubuntu-latest)
- GitHub Check: e2e-run (MacOS, macos-latest)
- GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
- GitHub Check: nix-linux
- GitHub Check: nix-nixos
- GitHub Check: nix-darwin
- GitHub Check: docker-build-push (linux/amd64, -amd64, amd64)
| "model": "grok-code", | ||
| "small_model": "kimi-k2", |
There was a problem hiding this comment.
Unmapped default model will break requests
The new default "model": "grok-code" is not declared under any provider block (lmstudio/ollama/openai/openrouter). With no matching provider config, OpenCode will fail resolving the default model and requests will error out. Either restore the previous default or add the corresponding provider/model mapping (e.g., via openrouter) before landing this change.
Summary
This update improves the AI tooling setup with better model availability and configuration options.
Summary by cubic
Switched the default model to grok-code, added a dedicated code-reviewer agent, and tuned the terminal UI scroll speed. Also set a small model fallback for lighter tasks.