fix(retry): guard claude-code fallback to anthropic provider only

Prevent _tryClaudeCodeFallback from firing for non-Anthropic providers
that may produce similar error text, avoiding unintended provider drift.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeremy 2026-04-08 07:31:32 -05:00
parent ea456d4cdb
commit 3ea46099d0

View file

@ -477,6 +477,10 @@ export class RetryHandler {
const currentModel = this._deps.getModel();
if (!currentModel) return false;
// Only attempt claude-code fallback when the current provider is anthropic.
// Other providers may produce similar error text but should not be rerouted.
if (currentModel.provider !== "anthropic") return false;
// Find the same model ID under the claude-code provider
const ccModel = this._deps.modelRegistry.find("claude-code", currentModel.id);
if (!ccModel) return false;