fix(chat): preserve OpenRouter routing in native passthrough - #1859
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughOpenAI Chat passthrough requests now resolve OpenRouter routing from the provider and model ID. The adapter adds the resolved provider payload when applicable. Tests cover routing precedence, aliases, non-OpenRouter requests, and API-key rotation. ChangesOpenRouter passthrough routing
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change makes native Chat passthrough honor configured OpenRouter routing and preserves that policy during key rotation; focused regressions and static checks pass, and no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
8829d46 to
10357d5
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
10357d5 to
3c76372
Compare
3c76372 to
660c8ee
Compare
|
Exact head is now Author validation is complete: the focused OpenRouter routing suite passes 31/31 on Bun 1.3.14 and Bun 1.4.0-canary.1; typecheck passes on both runtimes; privacy scan and diff check pass. The key-rotation regression now uses an isolated temporary OpenCodex home. CodeRabbit reviewed the exact head with no actionable comments, all review threads are resolved (0 outstanding), and the readiness checklist is 4/4 with the PR Ready. Maintainer action requested: approve the fork-gated Cross-platform CI run 32077523324 and React Doctor run 32077523311, then provide the required human review. |
|
Validation before merge: scratch-worktree merge onto current |
Summary
providerrouting in native Chat Completions passthrough requestsproviderobject cannot override configurationThe ordinary OpenAI Chat adapter already serialized
openRouterRoutingandmodelOpenRouterRouting, but the native/v1/chat/completionspath did not. As a result, OpenRouter could ignore an operator'sonlyorallow_fallbacks: falsepolicy and route prompts, history, tools, or media to a backend outside the configured set.This is a cross-provider privacy and routing-policy fix. It does not change destinations, authentication headers, API-key handling, or the Responses path.
The configuration is already documented; this patch makes the native Chat path honor the existing contract, so no documentation change is required.
Verification
Exact current range:
4ef1fcacfaf96e6ee7a9a19b9c483923db4a2474→660c8ee74f8a0b70f6a4361fb3a936c7559789b2.tests/openrouter-provider-routing.test.ts— 31 pass, 0 fail, 41 assertions.privacy:scanandgit diff --checkpassed.dev; the follow-up test-only commit gives key rotation a temporaryOPENCODEX_HOMEand retrying Windows cleanup.dev, driven by this host's Windows safe-path/service state, missing subprocessbun/GUI dependency resolution, and existing 5-second timeout cases; no fix(chat): preserve OpenRouter routing in native passthrough #1859 changed-path regression failed. Maintained cross-platform CI remains the authoritative repository-wide baseline.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
New Features
Bug Fixes
Tests