-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: add customizable fallback chains and improved model matching (Fixes #1307) #1436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat: add customizable fallback chains and improved model matching (Fixes #1307) #1436
Conversation
- Add fallback_chain config option to agents and categories schema
- Implement model ID normalization to match prefixed models (e.g., antigravity-*)
- Add getEffectiveFallbackChain and getEffectiveCategoryFallbackChain functions
- Update resolveVariantForModel to use user-defined fallback chains
- Fall back to user config variant when model-based resolution fails
- Add comprehensive tests for new functionality
This allows users to define custom fallback chains in oh-my-opencode.json:
```json
{
"agents": {
"sisyphus": {
"fallback_chain": [
{ "providers": ["google"], "model": "gemini-3-pro", "variant": "max" }
]
}
}
}
```
|
All contributors have signed the CLA. Thank you! ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 5 files
Confidence score: 3/5
- Potential user-facing regression:
src/config/schema.tsnow requiresmodelin fallback chain, which may reject previously valid provider-only configs at runtime/tests - Score reflects a medium-severity validation change that could block configuration usage, with uncertain confidence
- Pay close attention to
src/config/schema.ts- schema constraint may not match runtime expectations.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/config/schema.ts">
<violation number="1" location="src/config/schema.ts:106">
P2: Fallback chain schema requires `model`, but runtime logic/tests allow provider-only entries, so valid configs without a model will now be rejected.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| export const FallbackChainEntrySchema = z.object({ | ||
| providers: z.array(z.string()), | ||
| model: z.string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Fallback chain schema requires model, but runtime logic/tests allow provider-only entries, so valid configs without a model will now be rejected.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/config/schema.ts, line 106:
<comment>Fallback chain schema requires `model`, but runtime logic/tests allow provider-only entries, so valid configs without a model will now be rejected.</comment>
<file context>
@@ -101,6 +101,13 @@ export const BuiltinCommandNameSchema = z.enum([
+export const FallbackChainEntrySchema = z.object({
+ providers: z.array(z.string()),
+ model: z.string(),
+ variant: z.string().optional(),
+})
</file context>
| model: z.string(), | |
| model: z.string().optional(), |
|
recheck |
d9c33b4 to
c1125a3
Compare
|
recheck |
|
I have read the CLA Document and I hereby sign the CLA |
Replaces #1307.
Summary
This PR adds support for customizable fallback chains and improves model ID matching to handle prefixed models (like
antigravity-*).Changes in this PR (Fixes for #1307)
devbranch.FallbackChainSchemainsrc/config/schema.tsto deduplicate definitions.findVariantInChainnow strictly requires model match whenentry.modelis defined (prevents incorrect provider-only fallback).src/shared/agent-variant.test.tscovering model mismatches, chain ordering, and multi-provider entries.Original Description
model-requirements.tsantigravity-gemini-3-proSolution
oh-my-opencode.json.Testing
All tests pass, including new edge case tests for the logic fix.
Summary by cubic
Adds customizable fallback chains for agents and categories and improves model matching (handles prefixed IDs like antigravity-*). Fixes #1307 by allowing user-defined chains to override built-ins and ensuring precise variant selection.
New Features
Bug Fixes
Written for commit c1125a3. Summary will update on new commits.