fix(strix): route direct-OpenAI fallbacks through the OpenAI API base - #1324
fix(strix): route direct-OpenAI fallbacks through the OpenAI API base#1324seonghobae wants to merge 9 commits into
Conversation
0c6b9a6 mapped the openai-direct prefix and routed the OpenAI key, but the child scan still read LLM_API_BASE_FILE -- the primary provider's endpoint. Observed on LineageWeave#570 (run 32701426812): after both NVIDIA models 429'd, the openai-direct/gpt-5.6-luna fallback reached integrate.api.nvidia.com with an unknown model path and died in 4s with '404 page not found'. When the candidate is explicit-openai and STRIX_OPENAI_FALLBACK_API_BASE_FILE is configured, select that file as the api-base source, exactly mirroring the existing GitHub Models cross-provider routing. Key routing was already correct.
…oint contract Adds a regression contract for the openai-direct fallback API-base fix: override file routes to https://api.openai.com/v1, absence resolves no override (litellm default endpoint) so explicit OpenAI models can never inherit a foreign primary gateway, NVIDIA/GitHub Models primaries keep their bases, and non-https overrides fail configuration. Also records the doctoring evidence and CHANGELOG entry for the routing fix.
|
Warning Review limit reachedNext included review available in 51 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughStrix 직접 OpenAI 폴백 모델의 API 기본 URL resolver를 변경했습니다. 워크플로는 OpenAI 엔드포인트를 임시 파일로 제공하고 환경 변수로 전달합니다. 모델 이름과 관련 계약 테스트를 ChangesStrix OpenAI 폴백 라우팅
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The change routes direct-OpenAI fallbacks to the OpenAI API base and provisions the required workflow configuration; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant OpenAIFallbackCredentials
participant StrixWorkflow
participant StrixQuickGate
participant resolved_llm_api_base_for_model
participant OpenAIEndpoint
OpenAIFallbackCredentials->>StrixWorkflow: https://api.openai.com/v1 임시 파일 생성
StrixWorkflow->>StrixQuickGate: STRIX_OPENAI_FALLBACK_API_BASE_FILE 전달
StrixQuickGate->>resolved_llm_api_base_for_model: openai-direct/gpt-5.4와 파일 경로 전달
resolved_llm_api_base_for_model->>OpenAIEndpoint: 전용 기본 URL로 폴백 요청 라우팅
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 81.25% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 7 files. (5 skipped: 4 unsupported, 1 too large.) ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 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 |
….4 contract The model rename in a724582 missed two test expectations that still asserted the nonexistent gpt-5.6-luna default and fallback names; align them with the shipped gpt-5.4 contract so required CI passes.
…dispatch chain The a724582 rename updated strix.yml and the smoke contract but left the opencode-review-dispatch workflow, its agent-contract tests, the failed-check fallback-findings marker, and the pinned review-dispatch blob SHAs asserting the retired model name, so required CI failed with three missing-string markers. Align every remaining reference with the shipped gpt-5.4 direct-OpenAI contract and refresh the paired blob SHAs.
Temporary required-context adjustment:
|
…sition-prior calibration sources - JS workspaces measured 100% on 2026-08-25 (desktop + shared-types); the gap is the 90% gate threshold, not current coverage. Backlog item reworded accordingly. - Add finding (k): central Strix provider-routing outage (openai-direct fallback inherited the NVIDIA NIM API base) and its root-cause fix tracked in ContextualWisdomLab/.github#1324; dependency CVEs unified under canonical owner #783. - Expand (c) with a literature-grounded calibration method for HMM chord transition priors and add APA 7th entries (Burgoyne et al. 2011; Harte 2010; Logan & Chu 2000; Pauwels & Peeters 2013).
…rimary; dedupe CHANGELOG - CodeRabbit major: the github_models primary's STRIX_FALLBACK_MODELS chain ends in openai-direct/gpt-5.4, but 'Prepare GitHub Models fallback credentials' excluded the github_models mode, so that fallback could not authenticate or route after primary exhaustion. Include github_models in the provisioning step. - Devin bug: remove the four accidentally duplicated [Unreleased] bullets from CHANGELOG.md, keeping a single copy before '### Added'. - Add markdownlint MD040 language to the doctoring evidence fence.
…me Luna comment - Devin bug: the CHANGELOG dedup accidentally removed the four legitimate [Unreleased] bullets entirely; restore them once alongside the two Strix entries so pending history is not dropped. - Devin bug: the OPENCODE_MODEL_CANDIDATES rationale comment still named the retired 'GPT-5.6 Luna' slot with stale pricing; rewrite it for the valid gpt-5.4 direct-OpenAI contract.
| if is_explicit_openai_model "$model" && [ -z "${STRIX_OPENAI_FALLBACK_API_BASE_FILE:-}" ]; then | ||
| # Without workflow provisioning, an explicit direct-OpenAI model must | ||
| # still not inherit a foreign primary base: resolve no override so | ||
| # litellm defaults to https://api.openai.com/v1. | ||
| return 0 | ||
| fi | ||
|
|
||
| local api_base_file="$LLM_API_BASE_FILE" | ||
| local api_base_file_name="LLM_API_BASE_FILE" | ||
| if is_github_models_model "$model" && [ -n "${STRIX_GITHUB_MODELS_API_BASE_FILE:-}" ]; then | ||
| if is_explicit_openai_model "$model" && [ -n "${STRIX_OPENAI_FALLBACK_API_BASE_FILE:-}" ]; then | ||
| # Cross-provider fallback: openai-direct/* candidates must reach the | ||
| # direct OpenAI API even when the primary provider selected a | ||
| # different LLM_API_BASE_FILE endpoint (e.g. NVIDIA NIM). Without | ||
| # this the fallback hits the primary gateway and 404s. | ||
| api_base_file="$STRIX_OPENAI_FALLBACK_API_BASE_FILE" | ||
| api_base_file_name="STRIX_OPENAI_FALLBACK_API_BASE_FILE" | ||
| elif is_github_models_model "$model" && [ -n "${STRIX_GITHUB_MODELS_API_BASE_FILE:-}" ]; then | ||
| # Cross-provider fallback: when the active primary provider uses a | ||
| # different API base (for example OpenRouter), github_models/* fallback | ||
| # attempts must still route through the GitHub Models inference endpoint. |
There was a problem hiding this comment.
📝 Info: Direct-OpenAI base resolution verified sound
The new branches in resolved_llm_api_base_for_model route explicit openai-direct/* fallbacks correctly: with STRIX_OPENAI_FALLBACK_API_BASE_FILE set they use api.openai.com; absent, they early-return no override so litellm defaults to OpenAI. The workflow writes the base file inside the same guard as the fallback key, so key and base stay paired. The explicit-openai and github-models classes are disjoint, so no branch conflict.
(Refers to this code)
Was this helpful? React with 👍 or 👎 to provide feedback.
Current-head repair\n\nFixed the exact failure from runs 32834671068 and 32834671065: now pins the SHA-256 blob hash of the exact at this PR head ().\n\nLocal verification at the predecessor exact head passed: 102 tests, 1 skipped; ; . Please re-review the new exact head and rerun required Checks. |
Current-head repairFixed the exact failure from runs 32834671068 and 32834671065: Local verification at the predecessor exact head passed: 102 tests, 1 skipped; |
There was a problem hiding this comment.
📝 Info: OpenAI fallback still fails when its key is absent
When the primary is NVIDIA NIM / OpenRouter / GitHub Models and no OpenAI key exists, the workflow writes neither the fallback key nor base file (strix.yml). The openai-direct/gpt-5.4 fallback then resolves to the default OpenAI endpoint but keeps the primary provider's key (strix_quick_gate.sh), so it fails auth. This is not a regression and is documented as by-design fail-closed behavior.
(Refers to this code)
Was this helpful? React with 👍 or 👎 to provide feedback.
| # github_models is included because its STRIX_FALLBACK_MODELS chain | ||
| # ends in openai-direct/gpt-5.4, which needs the direct-OpenAI key and | ||
| # API base to authenticate and route after the primary is exhausted. | ||
| if: steps.gate.outputs.provider_mode == 'openai_direct' || steps.gate.outputs.provider_mode == 'openrouter' || steps.gate.outputs.provider_mode == 'nvidia_nim' || steps.gate.outputs.provider_mode == 'github_models' |
There was a problem hiding this comment.
📝 Info: github_models fallback chain now reachable
Adding github_models to the fallback-credentials step (strix.yml) plus the explicit-OpenAI base routing makes the openai-direct/gpt-5.4 fallback for a GitHub Models primary reachable; previously it would have inherited the GitHub Models base and tripped the compatibility guard at strix_quick_gate.sh.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Superseded by replacement PR #1331, rebased onto current protected main with the direct-OpenAI API-base repair and current gpt-5.4 contract. |
Problem
Required-CI evidence (ContextualWisdomLab/bandscope#1021 strix run 32800796577, 2026-08-25): with
provider_mode=nvidia_nim, the workflow setsLLM_API_BASE_FILE=https://integrate.api.nvidia.com/v1, and the gate reused that base for the contracted final fallbackopenai-direct/gpt-5.4. litellm sent OpenAI requests to the NVIDIA NIM edge, whose gateway answered a plain-text404 page not found. The scan produced no vulnerability report artifact, so required CI failed closed on every org PR during NIM provider exhaustion.Fix
strix_quick_gate.sh— explicit direct-OpenAI fallback models resolve their API base throughSTRIX_OPENAI_FALLBACK_API_BASE_FILEwhen provisioned; without provisioning they resolve no override so litellm defaults tohttps://api.openai.com/v1. Primary-provider models keep existing resolution. Non-https overrides fail configuration (exit 2).strix.yml— provisions$RUNNER_TEMP/openai_fallback_api_base.txtalongside the OpenAI fallback key file and passes it into the gate environment.Verification
bash scripts/ci/strix_required_workflow_smoke.sh: passed.bash -n scripts/ci/strix_quick_gate.sh: clean.Expected effect
After merge, strix PR scans fall back to a reachable OpenAI endpoint when NIM exhausts, restoring authoritative complete scans (or genuine findings) instead of provider-unavailable failures across the org's PR queues.
Summary by CodeRabbit
버그 수정
변경 사항
문서
테스트