You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 415b873
Browse filesBrowse the repository at this point in the historyBrowse files
feat(provider): configurable model fallback on transient errors and timeouts
Add a fallback chain to the Model schema so that when a provider returns a
transient error (rate limit, overload, 5xx, timeout), the processor tries
the next model in the chain before halting.
Schema (packages/core/src/v1/config/provider.ts):
- Add optional allback field (ordered string array of provider/model-id)
Resolver (packages/opencode/src/provider/fallback.ts):
- shouldFallback(): classifies errors as fallback-worthy (429, 500, 502,
503, 404, timeout, stream error). Excludes auth errors and context
overflow.
- resolveFallback(): resolves the next untried fallback model from config,
tracking tried entries in a Set to prevent infinite loops.
Processor (packages/opencode/src/session/processor.ts):
- After retry exhaustion, attemptFallback() checks shouldFallback on the
parsed error. If fallback-worthy and a fallback is configured, the
processor switches models and re-runs the stream. Resets ctx state
(currentText, reasoningMap, toolcalls, needsCompaction) before retry.
Also fixes pre-existing TS7006 in resource.node.ts (implicit any on
.then() callback parameters).
Closes#48991.
Co-Authored-By: zai-glm-52 <[email protected]>
Agent: @Feature-dev
Scope: #48991
0 commit comments