Skip to content

fix(strix): route direct-OpenAI fallback models to the OpenAI platform endpoint - #1295

Open
seonghobae wants to merge 10 commits into
mainfrom
fix/strix-cross-provider-openai-base
Open

fix(strix): route direct-OpenAI fallback models to the OpenAI platform endpoint#1295
seonghobae wants to merge 10 commits into
mainfrom
fix/strix-cross-provider-openai-base

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

resolved_llm_api_base_for_model() inherited the primary provider's LLM_API_BASE_FILE for every non-Vertex model. Observed failure chain on every org PR scanned today (e.g., bandscope PR #968 strix job 97343250198):

  1. Primary nvidia_nim/nvidia/nemotron-3-super-120b-a12b → HTTP 429 (thundering herd: ~123 open PRs each triggering required Strix scans).
  2. Fallback nvidia_nim/nvidia/llama-3.3-nemotron-super-49b-v1.5 → same 429 (same quota pool).
  3. Final fallback openai-direct/gpt-5.6-luna → gate mapped model to openai/gpt-5.6-luna with the OpenAI key but kept LLM_API_BASE=https://integrate.api.nvidia.com/v1 → NVIDIA answered 404 page not found.
  4. Scan failed closed; 41+ PRs blocked on a pure infrastructure bug.

Fix

Explicit direct-OpenAI models (openai_direct/*, openai-direct/*) now resolve to no custom API base so litellm uses the OpenAI platform endpoint with STRIX_OPENAI_FALLBACK_KEY. Vertex and GitHub Models routing/guards unchanged.

Verification

  • pytest tests/test_strix_backend_unavailable_after_exempted_finding.py tests/test_strix_model_behavior_error.py tests/test_strix_nvidia_nim_not_found_fallback.py: 28 passed.
  • Functional probe: with LLM_API_BASE_FILE=https://integrate.api.nvidia.com/v1, resolved_llm_api_base_for_model 'openai-direct/gpt-5.6-luna' now returns empty base (OpenAI default) while NIM primaries keep the NIM base.

Security Notes

  • No new trust boundaries: fallback key handling unchanged; only API-base resolution changed for an already-gated model prefix.
  • Fail-closed semantics preserved: provider outages still fail non-passing.

Open in Devin Review

Summary by CodeRabbit

  • 버그 수정
    • 직접 OpenAI 모델이 선택된 경우 기본 OpenAI 엔드포인트를 올바르게 사용하도록 개선했습니다.
    • 대체 모델이 NVIDIA NIM, OpenRouter 또는 GitHub Models 엔드포인트로 잘못 연결되는 문제를 해결했습니다.
    • 대체 모델별 전용 인증 정보를 올바르게 사용하고, 불필요하게 기본 인증 정보가 전달되지 않도록 수정했습니다.
    • 대체 모델 설정 오류 발생 시 다음 대체 모델로 정상 진행하며, 사용 가능한 대체 모델이 없을 때 명확한 오류를 표시합니다.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 30 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83a451bf-6864-4f0b-97ca-da2bf3054686

📥 Commits

Reviewing files that changed from the base of the PR and between 0a4fbca and cdf1518.

📒 Files selected for processing (4)
  • docs/adr/0002-product-technical-gap-baseline.md
  • docs/product-technical-gap-baseline.md
  • scripts/ci/strix_quick_gate.sh
  • scripts/ci/test_strix_quick_gate.sh
📝 Walkthrough

Walkthrough

직접 OpenAI 폴백은 주 모델 제공자에 따라 OpenAI 엔드포인트와 전용 키를 선택합니다. 전용 키가 없으면 동일 제공자의 주 키를 재사용하거나 폴백을 건너뜁니다. 제공자 구성 오류가 발생하면 다음 폴백을 시도합니다.

Changes

직접 OpenAI 폴백 처리

Layer / File(s) Summary
OpenAI 라우팅 및 자격 증명
scripts/ci/strix_quick_gate.sh
NVIDIA NIM, OpenRouter, GitHub Models에서 직접 OpenAI 폴백으로 전환할 때 OpenAI 엔드포인트를 사용합니다. 다른 제공자의 주 모델에서는 STRIX_OPENAI_FALLBACK_KEY를 요구합니다. 직접 OpenAI 주 모델에서는 전용 키가 없을 때 주 키를 재사용합니다.
폴백 구성 오류 처리
scripts/ci/strix_quick_gate.sh
폴백 제공자 구성 오류를 기록한 뒤 다음 폴백 모델을 시도합니다. 모든 폴백이 구성 오류로 실패하면 구성 오류를 반환합니다.
폴백 동작 검증
scripts/ci/test_strix_quick_gate.sh
동일 제공자 및 교차 제공자 키 전달, API base 보존, GitHub Models API base 누락, NVIDIA NIM quota 이후 후속 폴백 선택을 검증합니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: 🔵 Low · up to 0a4fb

The PR changes direct-OpenAI fallback routing, but its test scenario does not provide the fallback credential or verify that the inherited NVIDIA endpoint is removed, so a routing regression could pass validation. The change is mergeable with explicit owner follow-up to add those success-path assertions.

Sequence Diagram(s)

sequenceDiagram
  participant PrimaryProvider
  participant StrixQuickGate
  participant OpenAIFallback
  participant NextFallback
  PrimaryProvider->>StrixQuickGate: quota 또는 실행 오류
  StrixQuickGate->>OpenAIFallback: 직접 OpenAI 폴백 구성 및 키 확인
  OpenAIFallback-->>StrixQuickGate: 제공자 구성 오류
  StrixQuickGate->>NextFallback: 다음 폴백 모델 시도
  NextFallback-->>StrixQuickGate: 실행 결과 반환
Loading

Suggested reviewers: actions

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 직접 OpenAI 폴백 모델을 OpenAI 플랫폼 엔드포인트로 라우팅하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/strix-cross-provider-openai-base

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.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

seonghobae commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the exact-head finding on new head 2485eacba4fa15565947f7f476bad8cc00c969ca: when the primary provider is not direct OpenAI and STRIX_OPENAI_FALLBACK_KEY_FILE is absent, a direct-OpenAI fallback now returns configuration failure before child launch instead of inheriting the primary provider key. Same-provider direct-OpenAI chains continue to reuse their own key.

Added an integration regression scenario proving the NVIDIA-NIM rate-limit path performs one primary call, never invokes direct OpenAI without its credential, and fails closed. Local filtered scenario exited 0; bash -n and git diff --check passed. Please review the new exact head and use only its regenerated protected Checks.

seonghobae and others added 2 commits August 24, 2026 02:20
…m endpoint

resolved_llm_api_base_for_model() inherited the primary provider's
LLM_API_BASE_FILE for every non-Vertex model. When NVIDIA NIM rate-limited
(HTTP 429) and the chain fell back to openai-direct/gpt-5.6-luna, the gate
sent an OpenAI model and key to https://integrate.api.nvidia.com/v1, which
answered '404 page not found' and failed the whole scan closed.

Explicit direct-OpenAI models (openai_direct/* and openai-direct/*) now
resolve to no custom API base, so litellm uses the OpenAI platform endpoint
with STRIX_OPENAI_FALLBACK_KEY. GitHub Models base guards are unchanged.
@seonghobae
seonghobae force-pushed the fix/strix-cross-provider-openai-base branch from 2485eac to 3d18db7 Compare August 24, 2026 09:20
devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head validation update

  • Exact head: 26ab3e7310ac4a23f307500f592961318ef9a4d4
  • Base: 613a33e0cb1c6db9790fae99f6253445712ac37a
  • Root fixes:
    • an invalid cross-provider direct-OpenAI fallback is skipped so later configured fallbacks remain eligible;
    • a dedicated OpenAI fallback key takes precedence only for fallback candidates, while the primary keeps its primary key;
    • a configured API base is preserved for same-provider direct-OpenAI scans and bypassed only for cross-provider routing.
  • Focused regression cases passed:
    • nvidia-nim-quota-openai-direct-fallback-missing-key
    • same-provider-direct-openai-fallback-key
    • preserve-existing-direct-openai-api-base
  • bash -n scripts/ci/strix_quick_gate.sh scripts/ci/test_strix_quick_gate.sh: passed
  • git diff --check: passed
  • ShellCheck completed with pre-existing warnings only; no new warning was introduced.
  • All current review findings are resolved or outdated and dispositioned. No prior approval is being reused after the rebase and new push.
  • Hosted required Checks were regenerated for this exact head and are currently pending; this is not a merge attestation.

Please perform a new independent substantive review of the complete exact-head diff above.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head review loop

  • Pull request: fix(strix): route direct-OpenAI fallback models to the OpenAI platform endpoint #1295
  • Exact head reviewed: 9482635445eaa1b12426c57b7919e5774df04b38
  • Valid check failure fixed: the exact-head Strix quick-gate fixture still expected the pre-change behavior to abort on an invalid direct-OpenAI fallback. The implementation now skips that invalid candidate and continues to the next configured fallback; the fixture now asserts exit 0, two calls, and the later DeepSeek fallback.
  • The GitHub Models missing-base fixture now asserts the implementation's fail-closed configuration result rather than the removed legacy error text.
  • Verification: git diff --check — passed; bash -n scripts/ci/strix_quick_gate.sh scripts/ci/test_strix_quick_gate.sh — passed.
  • The exact live PR head 26ab3e7310ac4a23f307500f592961318ef9a4d4 was re-read immediately before the normal push; the new head is 9482635445eaa1b12426c57b7919e5774df04b38.

Please rerun the exact-head required Checks and current-head review. No merge is requested until the hosted gates and eligible approval are present.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae enabled auto-merge (squash) August 24, 2026 11:05
devin-ai-integration[bot]

This comment was marked as resolved.

@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 11:13
@seonghobae
seonghobae enabled auto-merge (squash) August 24, 2026 11:19
coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head validation

  • Exact head: d376c33a3fdf013c588ab7fd30971f54f9dcee1b
  • Exact base: 613a33e0cb1c6db9790fae99f6253445712ac37a
  • Fixed the fallback-attempt accounting so multiple configuration failures are compared with the number of distinct attempted fallbacks, not the boolean “fallback tried” flag.
  • Added exact shell regressions for: all configured fallbacks invalid; mixed configuration-failure plus retryable fallback; and a dedicated NVIDIA NIM → direct OpenAI fallback asserting the dedicated OpenAI key and <unset> API base.
  • all-fallbacks-invalid: exit 0 from the harness.
  • mixed-fallback-config-and-retryable: exit 0 from the harness.
  • nvidia-nim-quota-openai-direct-fallback-success: exit 0 from the harness.
  • bash -n and git diff --check: pass.
  • Python targeted contract tests: 79 passed.

The Devin notes are informational: PR-mode fail-closed classification intentionally returns the PR failure code before the later non-PR configuration-only exit-code branch; the new counter and fallback continuation are covered. Please refresh substantive review and approval for this exact head. Hosted required checks remain pending, so this stays on the protected normal path.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact current head d376c33a3fdf013c588ab7fd30971f54f9dcee1b was fetched from refs/pull/1295/head and verified locally.

Targeted evidence:

  • python3 -m pytest -q tests/test_strix_nvidia_nim_not_found_fallback.py tests/test_strix_backend_unavailable_after_exempted_finding.py tests/test_strix_model_behavior_error.py: 28 passed.
  • bash scripts/ci/test_strix_quick_gate.sh is still running; its emitted negative-case diagnostics are expected assertions from the shell contract suite, not a final failure.

The motivating DiskSage PR #246 Strix failure was provider infrastructure evidence failure: NVIDIA NIM and direct OpenAI fallback both returned 404/no report, so the gate correctly failed closed. This PR’s dedicated direct-OpenAI routing and fallback configuration tests cover that path. No secrets or provider calls were made locally.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact pushed head is now cdf15180c37c3bbcb1e5fe2c48ece5ce006a6606.

Added synchronized control-plane evidence:

  • ADR-0002 amendment records that openai-direct/<model> fallbacks use the OpenAI platform endpoint and remain fail-closed on provider 404/no structured report.
  • docs/product-technical-gap-baseline.md records the same exact-head gap closure and keeps hosted Checks authoritative.

Verification on this exact worktree:

  • focused Strix provider tests: 28 passed
  • bash -n scripts/ci/strix_quick_gate.sh scripts/ci/test_strix_quick_gate.sh: passed
  • git diff --check: passed

PR remains open and blocked pending new-head hosted Checks and independent protected approvals.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread scripts/ci/strix_quick_gate.sh
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