-
Notifications
You must be signed in to change notification settings - Fork 0
ci: switch local OpenCode from GitHub Models to NVIDIA NIM #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f8d748
17fbd43
d3d9fc0
1be34db
d583202
367bd5d
6ca06d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| """Regression contract for the repository's NVIDIA NIM OpenCode configuration.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import json | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| def test_opencode_uses_the_canonical_nvidia_nim_contract() -> None: | ||
| """Require the reviewed NIM models, process credential alias, and option boundary.""" | ||
| repo_root = Path(__file__).resolve().parents[3] | ||
| opencode_text = (repo_root / "opencode.jsonc").read_text(encoding="utf-8") | ||
| config = json.loads(opencode_text) | ||
|
|
||
| assert config["model"] == "nvidia-nim/nvidia/llama-3.3-nemotron-super-49b-v1.5" | ||
| assert config["small_model"] == "nvidia-nim/meta/llama-3.3-70b-instruct" | ||
| assert config["enabled_providers"] == ["nvidia-nim"] | ||
| assert set(config["provider"]) == {"nvidia-nim"} | ||
|
|
||
| provider = config["provider"]["nvidia-nim"] | ||
| assert provider["options"]["baseURL"] == "https://integrate.api.nvidia.com/v1" | ||
| # Central workflows source GitHub Secret NVIDIA_NIM_API_KEY and intentionally | ||
| # expose it to this OpenCode-compatible client through the NVIDIA_API_KEY | ||
| # process alias. The repository config must consume the alias, not rename | ||
| # the organization secret contract. | ||
| assert provider["options"]["apiKey"] == "{env:NVIDIA_API_KEY}" | ||
|
|
||
| primary_model = provider["models"]["nvidia/llama-3.3-nemotron-super-49b-v1.5"] | ||
| assert "reasoningEffort" not in primary_model.get("options", {}) | ||
| assert "meta/llama-3.3-70b-instruct" in provider["models"] | ||
|
|
||
| for forbidden_token in ( | ||
| "github-models", | ||
| "STRIX_GITHUB_MODELS_TOKEN", | ||
| "COPILOT_GITHUB_TOKEN", | ||
| "openai/gpt-5", | ||
| "openai/o3", | ||
| "openai/o4-mini", | ||
| "models.github.ai", | ||
| ): | ||
| assert forbidden_token not in opencode_text |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5073,14 +5073,36 @@ def test_opencode_approval_write_failure_updates_overview_only() -> None: | |
| assert "source-backed repository findings" in policy | ||
|
|
||
|
|
||
| def test_opencode_uses_nvidia_nim_only() -> None: | ||
| """Ensure local OpenCode is NVIDIA NIM only and does not use GitHub Models.""" | ||
| repo_root = Path(__file__).resolve().parents[3] | ||
| opencode_text = (repo_root / "opencode.jsonc").read_text(encoding="utf-8") | ||
| opencode_config = json.loads(opencode_text) | ||
|
|
||
| assert opencode_config["model"] == "nvidia-nim/nvidia/llama-3.3-nemotron-super-49b-v1.5" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test still omits |
||
| assert opencode_config["enabled_providers"] == ["nvidia-nim"] | ||
| assert set(opencode_config["provider"]) == {"nvidia-nim"} | ||
|
|
||
| nim_provider = opencode_config["provider"]["nvidia-nim"] | ||
| assert nim_provider["options"]["baseURL"] == "https://integrate.api.nvidia.com/v1" | ||
| assert nim_provider["options"]["apiKey"] == "{env:NVIDIA_API_KEY}" | ||
| assert "nvidia/llama-3.3-nemotron-super-49b-v1.5" in nim_provider["models"] | ||
|
seonghobae marked this conversation as resolved.
|
||
|
|
||
| leftover_tokens = ( | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| "github-models", | ||
| "STRIX_GITHUB_MODELS_TOKEN", | ||
| "COPILOT_GITHUB_TOKEN", | ||
| "openai/gpt-5", | ||
| "models.github.ai", | ||
| ) | ||
| for leftover in leftover_tokens: | ||
| assert leftover not in opencode_text | ||
|
|
||
|
|
||
| def test_pr_review_merge_scheduler_uses_central_mutation_credential() -> None: | ||
| """Ensure mechanical PR queue handling uses the central mutation credential.""" | ||
| repo_root = Path(__file__).resolve().parents[3] | ||
| policy = central_required_workflow_policy_text() | ||
|
|
||
| opencode_config = (repo_root / "opencode.jsonc").read_text(encoding="utf-8") | ||
| assert '"openai/o3"' in opencode_config | ||
| assert '"openai/o4-mini"' in opencode_config | ||
| assert_local_review_workflows_removed() | ||
| assert "selected workflow mutation" in policy | ||
| assert "credential, not by a maintainer's local `gh` session" in policy | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.