Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(providers): preserve fallback base URLs - #1345

Open
cmondragon023 wants to merge 1 commit into
rohitg00:mainfrom
cmondragon023:codex/fix-fallback-provider-base-url
Open

fix(providers): preserve fallback base URLs#1345
cmondragon023 wants to merge 1 commit into
rohitg00:mainfrom
cmondragon023:codex/fix-fallback-provider-base-url

Conversation

@cmondragon023

@cmondragon023 cmondragon023 commented Sep 6, 2026

Copy link
Copy Markdown

Summary

  • resolve OPENAI_BASE_URL and ANTHROPIC_BASE_URL independently for fallback providers
  • avoid inheriting the primary provider's endpoint when building a different fallback
  • add regression coverage for both provider directions and the unset fallback URL case

Verification

  • npx vitest run test/fallback-model-resolution.test.ts — 8 tests passed
  • npm test — full non-integration suite passed outside the restricted sandbox
  • npm run build
  • git diff --check upstream/main...HEAD

Closes #1338

Summary by CodeRabbit

  • Bug Fixes
    • Fallback OpenAI and Anthropic providers now use their respective environment-configured endpoints.
    • Fallback providers no longer inherit an unrelated primary provider endpoint.
    • Provider endpoint selection is now handled consistently when switching to fallback models.

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

@cmondragon023 is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 89f3b3c9-4f80-4749-894e-904b64207ec1

📥 Commits

Reviewing files that changed from the base of the PR and between e04ba88 and afb3a2e.

📒 Files selected for processing (2)
  • src/providers/index.ts
  • test/fallback-model-resolution.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Fallback provider creation now resolves OpenAI and Anthropic base URLs from their environment variables. Tests capture provider constructor values and verify configured and absent fallback base URL behavior.

Changes

Fallback base URL resolution

Layer / File(s) Summary
Resolve fallback base URLs
src/providers/index.ts
The provider-specific helper reads OPENAI_BASE_URL or ANTHROPIC_BASE_URL. Fallback configurations use the resolved base URL.
Validate fallback base URLs
test/fallback-model-resolution.test.ts
Mocks capture base URLs. Tests preserve the new environment variables and verify provider-specific resolution and non-inheritance from the primary provider.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to afb3a

Fallback OpenAI and Anthropic providers now use their own configured endpoints instead of inheriting the primary provider endpoint, with coverage for configured and absent overrides. The change is ready to merge.

Suggested reviewers: rohitg00

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving provider-specific base URLs for fallback providers.
Linked Issues check ✅ Passed The implementation resolves OPENAI_BASE_URL and ANTHROPIC_BASE_URL per fallback provider and passes the result into the fallback configuration. The added tests cover both providers and the unset URL c…
Out of Scope Changes check ✅ Passed The changes are limited to fallback base URL resolution and regression tests. They directly support the linked issue and do not introduce unrelated scope.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

fix(providers): createFallbackProvider drops baseURL — custom-endpoint fallbacks (DeepSeek/Kimi/etc.) hit the wrong API host

1 participant