feat: add customizable fallback chains and improved model matching (Fixes #1307)#1436
Open
wydrox wants to merge 5 commits intocode-yeongyu:devfrom
Open
feat: add customizable fallback chains and improved model matching (Fixes #1307)#1436wydrox wants to merge 5 commits intocode-yeongyu:devfrom
wydrox wants to merge 5 commits intocode-yeongyu:devfrom
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" }
]
}
}
}
```
Contributor
|
All contributors have signed the CLA. Thank you! ✅ |
There was a problem hiding this comment.
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.
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>
Suggested change
| model: z.string(), | |
| model: z.string().optional(), |
Author
|
recheck |
d9c33b4 to
c1125a3
Compare
Author
|
recheck |
Author
|
I have read the CLA Document and I hereby sign the CLA |
leoisadev1
pushed a commit
to leoisadev1/oh-my-opencode
that referenced
this pull request
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.