feat(review): add keyless OmniRoute free-gateway provider to the OpenCode review pool - #675
feat(review): add keyless OmniRoute free-gateway provider to the OpenCode review pool#675seonghobae wants to merge 2 commits into
Conversation
…Code review pool The central OpenCode review pool depends on provider keys / free tiers that can lapse (GitHub Models retirement, unset OPENAI/OPENROUTER secrets), which starves the pool of any working model and leaves every PR's opencode-review unable to produce approval evidence. Add OmniRoute — the org's free OpenAI-compatible gateway — as a keyless recovery path that needs no per-provider secret. - enabled_providers gains "omniroute"; a new "omniroute" provider block (@ai-sdk/openai-compatible, model "auto", tool_call, 200000/32768 limit) resolves its base URL from the org variable OMNIROUTE_API_BASE_URL and an optional OMNIROUTE_API_KEY secret — keyless by default. - omniroute/auto is appended to the public-only segment of OPENCODE_MODEL_CANDIDATES (never the private-repo segment): a free gateway with best-effort upstreams must not see private-repo code, matching the existing opencode-free gating. - run_opencode_review_model_pool.sh skips omniroute candidates when OMNIROUTE_API_BASE_URL is unset (fail-safe fall-through) and caps its runtime with the bounded free-provider failover window. - Contract tests (test_opencode_agent_contract.py, test_opencode_model_pool_runner.py, test_strix_quick_gate.sh) updated to pin the new provider, candidate, env wiring, and skip behavior. Activation requires the org to set vars.OMNIROUTE_API_BASE_URL to its OmniRoute deployment; OmniRoute should front at least one tool-calling-capable upstream so the reviewer can emit a structured verdict. Verified: coverage run -m pytest tests -> 712 passed, coverage 100% (fail_under=100), interrogate 100%, scripts/ci/test_strix_quick_gate.sh PASS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wtuYFp4E22QnEU1bFMhsr
📝 WalkthroughWalkthrough이 PR은 OpenCode 리뷰 워크플로와 모델 풀 실행 스크립트에 OmniRoute 제공자를 추가한다. combo 모델 구성, 환경 변수 기반 API 자격 증명, 기본 URL 미설정 시 건너뛰기 로직, 실행 시간 상한 적용을 포함한다. 관련 계약 테스트와 러너 테스트도 확장한다. ChangesOmniRoute 제공자 및 모델 풀 통합
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant Workflow as opencode-review-dispatch.yml
participant Runner as run_opencode_review_model_pool.sh
participant OmniRoute as OmniRoute API
Workflow->>Runner: OMNIROUTE_API_BASE_URL, OMNIROUTE_API_KEY 전달
Runner->>Runner: is_omniroute_candidate로 후보 판별
alt 기본 URL 미설정
Runner->>Runner: 후보 건너뛰고 다음 후보로 이동
else 기본 URL 설정됨
Runner->>Runner: cap_model_run_timeout으로 실행 시간 상한 적용
Runner->>OmniRoute: combo 모델 요청 실행
OmniRoute-->>Runner: 응답 또는 타임아웃
end
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…omlab-audit-governance-fb7470 # Conflicts: # .github/workflows/opencode-review-dispatch.yml # scripts/ci/run_opencode_review_model_pool.sh # scripts/ci/test_strix_quick_gate.sh # tests/test_opencode_agent_contract.py
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_opencode_model_pool_runner.py`:
- Around line 818-834: Update test_omniroute_runtime_cap_preserves_queue_budget
to set FAKE_OPENCODE_HANG_SECONDS to a value longer than the configured 3-second
cap, ensuring the fake OpenCode process is actually interrupted by that cap.
Preserve the existing return-code and runtime-cap assertions, and verify the run
proceeds to the next candidate as expected.
- Around line 799-816: Update test_omniroute_candidate_requires_base_url to
include an additional runnable model candidate after omniroute/combo, while
keeping OMNIROUTE_API_BASE_URL empty. Assert that the fallback candidate is
attempted and recorded in the output, and retain the existing assertion that the
keyless OmniRoute candidate is skipped.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bd5c023c-4853-4839-b91e-60c02939a7ec
📒 Files selected for processing (5)
.github/workflows/opencode-review-dispatch.ymlscripts/ci/run_opencode_review_model_pool.shscripts/ci/test_strix_quick_gate.shtests/test_opencode_agent_contract.pytests/test_opencode_model_pool_runner.py
| def test_omniroute_candidate_requires_base_url(tmp_path: Path) -> None: | ||
| """The keyless OmniRoute gateway is skipped when its base URL is not configured.""" | ||
| result = run_failed_model( | ||
| tmp_path, | ||
| model_candidates="omniroute/combo", | ||
| extra_env={"OMNIROUTE_API_BASE_URL": ""}, | ||
| ) | ||
|
|
||
| assert result.returncode == 1 | ||
| assert ( | ||
| "Skipping OpenCode omniroute/combo because OMNIROUTE_API_BASE_URL is not " | ||
| "configured; falling back to the next provider-qualified candidate." | ||
| ) in result.stdout | ||
| assert ( | ||
| "OpenCode model pool exhausted before producing a valid control conclusion." | ||
| in result.stdout | ||
| ) | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
다음 후보 실행을 검증하세요.
현재 후보 목록에는 omniroute/combo만 있습니다. 따라서 러너가 건너뛴 후 즉시 종료해도 이 테스트는 통과합니다.
omniroute/combo 뒤에 실행 가능한 후보를 추가하세요. 그 후보의 시도가 로그에 기록되는지 확인하세요.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/test_opencode_model_pool_runner.py` around lines 799 - 816, Update
test_omniroute_candidate_requires_base_url to include an additional runnable
model candidate after omniroute/combo, while keeping OMNIROUTE_API_BASE_URL
empty. Assert that the fallback candidate is attempted and recorded in the
output, and retain the existing assertion that the keyless OmniRoute candidate
is skipped.
| def test_omniroute_runtime_cap_preserves_queue_budget(tmp_path: Path) -> None: | ||
| """A stalled keyless OmniRoute gateway cannot consume a full paid-provider slot.""" | ||
| result = run_failed_model( | ||
| tmp_path, | ||
| extra_env={ | ||
| "OMNIROUTE_API_BASE_URL": "https://omniroute.example/v1", | ||
| "OPENCODE_FREE_RUN_TIMEOUT_SECONDS": "3", | ||
| "OPENCODE_RUN_TIMEOUT_SECONDS": "9", | ||
| }, | ||
| model_candidates="omniroute/combo", | ||
| ) | ||
|
|
||
| assert result.returncode == 1 | ||
| assert ( | ||
| "OpenCode omniroute/combo runtime cap selected 3s " | ||
| "instead of 9s because this provider has a bounded failover window." | ||
| ) in result.stdout |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
실제 타임아웃을 발생시키세요.
이 테스트는 FAKE_OPENCODE_HANG_SECONDS를 설정하지 않습니다. 가짜 opencode는 즉시 실패하므로 3초 제한이 실제 실행을 중단하는지 검증하지 않습니다.
가짜 제공자를 3초보다 길게 대기시키세요. 3초 타임아웃 결과와 다음 후보로의 진행을 확인하세요.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/test_opencode_model_pool_runner.py` around lines 818 - 834, Update
test_omniroute_runtime_cap_preserves_queue_budget to set
FAKE_OPENCODE_HANG_SECONDS to a value longer than the configured 3-second cap,
ensuring the fake OpenCode process is actually interrupted by that cap. Preserve
the existing return-code and runtime-cap assertions, and verify the run proceeds
to the next candidate as expected.
|
Closing until the provider is operational. The PR is intentionally inert because |
Problem
The central OpenCode review pool needs an additional public-repository fallback
when provider keys or free tiers are unavailable. OmniRoute exposes an
OpenAI-compatible gateway, but it must never receive private-repository source
and it must fail closed when the organization has not explicitly activated a
deployment.
Change
omnirouteOpenAI-compatible provider with modelcombo.omniroute/comboonly to the public-repository candidate segment.vars.OMNIROUTE_API_BASE_URLis unset.candidates on an unavailable OmniRoute deployment.
missing-variable behavior in contract and runner tests.
Activation evidence
Activation remains intentionally disabled: the organization variable
OMNIROUTE_API_BASE_URLis not set.Live read-only probes against the documented Fly deployment found:
/v1/modelsreturns HTTP 200 and a 75-model catalog.automodel is rejected as ambiguous, so the branch now uses thecatalog's
comboalias.comborequest currently fails because the deployment's selected upstreamcredentials are invalid.
Set
OMNIROUTE_API_BASE_URLonly after that deployment can complete a realtool-calling request. Until then this PR is inert and does not alter current
review routing.
Verification
Current head
6aad197:python3 -m pytest tests— 741 passed.coverage run -m pytest tests && coverage report— 741 passed; 6,103/6,103central CI statements covered (100%).
interrogate -c pyproject.toml scripts/ci— 100%.actionlintand shell syntax checks passed.Tracked in organization Project #1 as In Progress / Ops / dot-github.
Summary by CodeRabbit
새 기능
combo모델이 추가되었습니다.테스트