Repository navigation
fix: accept slashes, tildes, and colons in fallback model IDs - #28
Closed
Oren-Schmerling wants to merge 1 commit into
Closed
Oren-Schmerling wants to merge 1 commit into
Oren-Schmerling wants to merge 1 commit into
Conversation
Oren-Schmerling
added a commit
to Oren-Schmerling/opencode-model-fallback
that referenced
this pull request
Oct 22, 2026
Author
|
Superseded by #29, which now includes the relaxed model-key regex. |
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.
Problem
MODEL_KEY_REonly accepts aproviderID/modelIDkey whose model ID matches[a-zA-Z0-9._-]. Real OpenCode model keys often contain more:openrouter/openrouter/freeopenrouter/~deepseek/deepseek-flash-latestopenrouter/anthropic/claude-3.5-sonnet:betaBecause one invalid entry rejects the agent's entire
fallbackModelsarray, affected agents end up with an empty chain (fallback.no-chain) and the session stops instead of falling back.Change
[a-zA-Z0-9._~\/:-]{1,200}in both validators (src/config/agent-loader.ts,src/config/schema.ts)./and rejoins the remainder, and health tracking keys on the full string.Notes
Related to #27, which relaxes the same regex for
/and:but rejects~and adds no tests. Happy to rebase, fold into #27, or close this if #27 is preferred.