Skip to content

fix(model-fallback): apply transformModelForProvider in getNextFallback#2113

Open
east-shine wants to merge 2 commits intocode-yeongyu:devfrom
east-shine:fix/model-fallback-transform-missing
Open

fix(model-fallback): apply transformModelForProvider in getNextFallback#2113
east-shine wants to merge 2 commits intocode-yeongyu:devfrom
east-shine:fix/model-fallback-transform-missing

Conversation

@east-shine
Copy link

@east-shine east-shine commented Feb 25, 2026

Summary

getNextFallback() in the model-fallback hook returns raw model names from the hardcoded fallback chain without calling transformModelForProvider(). This causes fallback to fail silently for providers that require different model name formats:

  • github-copilot: expects dot notation (claude-sonnet-4.6), but the chain stores hyphens (claude-sonnet-4-6)
  • google: expects -preview suffix (gemini-3-pro-preview), but the chain stores plain names (gemini-3-pro)

Root Cause

The background-agent retry handler (src/features/background-agent/fallback-retry-handler.ts:94) correctly calls transformModelForProvider() before returning the fallback model. However, the sync chat.message hook in model-fallback/hook.ts was missing this call — a copy-paste omission.

Before (broken):

return {
  providerID,
  modelID: fallback.model,  // raw name → github-copilot and google reject it
  variant: fallback.variant,
}

After (fixed):

return {
  providerID,
  modelID: transformModelForProvider(providerID, fallback.model),
  variant: fallback.variant,
}

Affected Providers

Provider Raw Model Name Expected by API Transform Applied
github-copilot claude-sonnet-4-6 claude-sonnet-4.6 Hyphen → dot
github-copilot gemini-3-pro gemini-3-pro-preview Add -preview suffix
google gemini-3-pro gemini-3-pro-preview Add -preview suffix
google gemini-3-flash gemini-3-flash-preview Add -preview suffix
anthropic claude-opus-4-6 claude-opus-4-6 No transform needed

Changes

  • src/hooks/model-fallback/hook.ts: Import transformModelForProvider and apply it in getNextFallback() return value
  • src/hooks/model-fallback/hook.test.ts: Add tests verifying model name transformation for both github-copilot (claude-sonnet-4-6claude-sonnet-4.6) and google (gemini-3-progemini-3-pro-preview) providers through the fallback chain

Scope

This fix targets only the hardcoded agent fallback chain (model-fallback hook). The runtime-fallback hook (auto-retry.ts) uses user-configured fallback_models where users specify provider-correct names directly, so no change is needed there.

Testing

  • ✅ TypeScript typecheck passes (tsc --noEmit)
  • ✅ All 5 model-fallback hook tests pass (including the new github-copilot and google transform tests)

The getNextFallback function returned raw model names from the
hardcoded fallback chain without transforming them for the target
provider. For example, github-copilot requires dot notation
(claude-sonnet-4.6) but the fallback chain stores hyphen notation
(claude-sonnet-4-6).

The background-agent retry handler already calls
transformModelForProvider correctly, but the sync chat.message
hook in model-fallback was missing it — a copy-paste omission.

Add transformModelForProvider call in getNextFallback and a test
verifying github-copilot model name transformation.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@east-shine
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Feb 25, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Surgical bug fix ensuring model ID format consistency across providers, with comprehensive test coverage for the transformation logic.

google provider에서 gemini-3-pro → gemini-3-pro-preview 변환이
getNextFallback를 통해 정상 적용되는지 검증하는 테스트 추가.
기존 github-copilot 테스트와 동일한 패턴으로 작성.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant