Skip to content

feat(review): add keyless OmniRoute free-gateway provider to the OpenCode review pool - #675

Closed
seonghobae wants to merge 2 commits into
mainfrom
claude/contextualwisdomlab-audit-governance-fb7470
Closed

feat(review): add keyless OmniRoute free-gateway provider to the OpenCode review pool#675
seonghobae wants to merge 2 commits into
mainfrom
claude/contextualwisdomlab-audit-governance-fb7470

Conversation

@seonghobae

@seonghobae seonghobae commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

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

  • Add the omniroute OpenAI-compatible provider with model combo.
  • Add omniroute/combo only to the public-repository candidate segment.
  • Skip OmniRoute when vars.OMNIROUTE_API_BASE_URL is unset.
  • Keep the hour-class bounded free-provider timeout and continue to later
    candidates on an unavailable OmniRoute deployment.
  • Pin provider, model, ordering, environment wiring, public-only scope, and
    missing-variable behavior in contract and runner tests.

Activation evidence

Activation remains intentionally disabled: the organization variable
OMNIROUTE_API_BASE_URL is not set.

Live read-only probes against the documented Fly deployment found:

  • /v1/models returns HTTP 200 and a 75-model catalog.
  • The previous auto model is rejected as ambiguous, so the branch now uses the
    catalog's combo alias.
  • A combo request currently fails because the deployment's selected upstream
    credentials are invalid.

Set OMNIROUTE_API_BASE_URL only after that deployment can complete a real
tool-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,103
    central CI statements covered (100%).
  • interrogate -c pyproject.toml scripts/ci — 100%.
  • actionlint and shell syntax checks passed.
  • CodeGraph was synchronized and used for the merged provider and runner paths.

Tracked in organization Project #1 as In Progress / Ops / dot-github.

Summary by CodeRabbit

  • 새 기능

    • OpenCode 모델 선택지에 OmniRoute의 combo 모델이 추가되었습니다.
    • OmniRoute API URL과 선택적 API 키 설정을 지원합니다.
    • API URL이 없는 경우 해당 모델을 자동으로 건너뜁니다.
    • OmniRoute 모델 실행에 별도 시간 제한이 적용됩니다.
  • 테스트

    • OmniRoute 설정, 모델 선택, 실행 시간 제한 동작에 대한 검증이 강화되었습니다.

…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
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

이 PR은 OpenCode 리뷰 워크플로와 모델 풀 실행 스크립트에 OmniRoute 제공자를 추가한다. combo 모델 구성, 환경 변수 기반 API 자격 증명, 기본 URL 미설정 시 건너뛰기 로직, 실행 시간 상한 적용을 포함한다. 관련 계약 테스트와 러너 테스트도 확장한다.

Changes

OmniRoute 제공자 및 모델 풀 통합

Layer / File(s) Summary
워크플로 제공자 구성 및 후보 순서
.github/workflows/opencode-review-dispatch.yml
활성 제공자 목록에 omniroute를 추가한다. 환경 변수 기반 OMNIROUTE_API_BASE_URL, OMNIROUTE_API_KEY를 사용하는 omniroute 제공자와 combo 모델을 구성한다. 모델 풀 실행 단계에 해당 환경 변수를 전달하고, 공개 저장소 후보 목록에 omniroute/combo를 추가한다.
모델 풀 실행 스크립트의 OmniRoute 후보 판별 및 상한
scripts/ci/run_opencode_review_model_pool.sh
is_omniroute_candidate 함수를 추가해 omniroute/* 후보를 인식한다. OMNIROUTE_API_BASE_URL 미설정 시 해당 후보를 건너뛴다. cap_model_run_timeout이 omniroute/* 후보에도 opencode-free/* 실행 시간 상한을 적용한다.
Strix 게이트 검증 스크립트 확장
scripts/ci/test_strix_quick_gate.sh
OmniRoute provider, 조직 변수 기반 API base URL, 선택적 secret API key 설정 검증을 추가한다. 공개 저장소용 조기 후보에 keyless OmniRoute 조합을 추가하고, 기본 URL 미설정 시 게이트웨이 건너뛰기를 검증한다.
에이전트 계약 테스트에 OmniRoute 검증 추가
tests/test_opencode_agent_contract.py
omniroute/combo 후보와 여러 nvidia-nim 모델 검증을 추가한다. 생성된 설정의 Omniroute baseURL·API 키·도구 호출 지원·컨텍스트 및 출력 제한을 검증한다. 워크플로 설정과 모델 풀 실행기의 기본 URL 미설정 오류 메시지도 검증한다.
모델 풀 러너 테스트에 OmniRoute 케이스 추가
tests/test_opencode_model_pool_runner.py
기본 URL 미설정 시 후보를 건너뛰고 풀이 소진되는 테스트를 추가한다. URL 설정 상태에서 정지한 후보가 3초 런타임 상한을 적용받는 테스트를 추가한다.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 OpenCode 리뷰 모델 풀에 keyless OmniRoute 무료 게이트웨이 제공자를 추가하는 주요 변경을 정확히 설명합니다.
✨ 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 claude/contextualwisdomlab-audit-governance-fb7470

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

…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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd8929 and 6aad197.

📒 Files selected for processing (5)
  • .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
  • tests/test_opencode_model_pool_runner.py

Comment on lines +799 to +816
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
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Comment on lines +818 to +834
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Copy link
Copy Markdown
Contributor Author

Closing until the provider is operational. The PR is intentionally inert because OMNIROUTE_API_BASE_URL is unset, and the documented live combo request still fails on invalid upstream credentials. It also retains two unresolved runtime-contract review threads. Carrying an unreachable, unverified provider in the high-trust review pool adds maintenance and attack surface without improving queue reliability. Recreate a focused PR after a real tool-calling request succeeds, then include skip-to-next-candidate and actual timeout-interruption tests.

@seonghobae seonghobae closed this Aug 3, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in naruon Platform Roadmap Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants