From 06e4e1221e49d2c7470a76a0cc7de3f25f2bf68e Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Wed, 1 Jul 2026 02:08:27 +0900 Subject: [PATCH] Raise OpenCode reasoning variants --- .github/workflows/opencode-review.yml | 35 ++++++++++++++++++++++++++ opencode.jsonc | 35 ++++++++++++++++++++++++++ tests/test_opencode_agent_contract.py | 36 +++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) diff --git a/.github/workflows/opencode-review.yml b/.github/workflows/opencode-review.yml index c351fe065..9cc5d93da 100644 --- a/.github/workflows/opencode-review.yml +++ b/.github/workflows/opencode-review.yml @@ -1871,6 +1871,11 @@ jobs: "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -1883,6 +1888,11 @@ jobs: "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -1895,6 +1905,11 @@ jobs: "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -1907,6 +1922,11 @@ jobs: "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 128000, "output": 4096 @@ -1927,6 +1947,11 @@ jobs: "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -1939,6 +1964,11 @@ jobs: "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -1951,6 +1981,11 @@ jobs: "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 diff --git a/opencode.jsonc b/opencode.jsonc index 70f113c69..5345a3d33 100644 --- a/opencode.jsonc +++ b/opencode.jsonc @@ -129,6 +129,11 @@ "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -141,6 +146,11 @@ "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -153,6 +163,11 @@ "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -165,6 +180,11 @@ "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 128000, "output": 4096 @@ -185,6 +205,11 @@ "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -197,6 +222,11 @@ "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 @@ -209,6 +239,11 @@ "options": { "reasoningEffort": "high" }, + "variants": { + "high": { + "reasoningEffort": "high" + } + }, "limit": { "context": 200000, "output": 100000 diff --git a/tests/test_opencode_agent_contract.py b/tests/test_opencode_agent_contract.py index 591e9fcc9..9f7282c8f 100644 --- a/tests/test_opencode_agent_contract.py +++ b/tests/test_opencode_agent_contract.py @@ -1,4 +1,5 @@ import json +import re from pathlib import Path @@ -50,9 +51,44 @@ def test_code_reviewer_subagent_contract_is_configured(): for model_name in high_reasoning_models: assert models[model_name]["reasoning"] is True assert models[model_name]["options"]["reasoningEffort"] == "high" + assert models[model_name]["variants"]["high"]["reasoningEffort"] == "high" for model_name, model_config in models.items(): if model_config.get("reasoning") is True: assert model_config["options"]["reasoningEffort"] == "high", model_name + assert model_config["variants"]["high"]["reasoningEffort"] == "high", model_name + + +def test_opencode_model_pool_sets_high_effort_for_capable_candidates(): + """Guard every review-pool candidate against silent reasoning-effort drift.""" + config = json.loads(Path("opencode.jsonc").read_text(encoding="utf-8")) + workflow = Path(".github/workflows/opencode-review.yml").read_text(encoding="utf-8") + models = config["provider"]["github-models"]["models"] + candidates_match = re.search(r'OPENCODE_MODEL_CANDIDATES: "([^"]+)"', workflow) + + assert candidates_match is not None + candidates = candidates_match.group(1).split() + candidate_models = [candidate.removeprefix("github-models/") for candidate in candidates] + + assert set(candidate_models) == set(models) + + def is_reasoning_capable(model_name: str) -> bool: + return ( + model_name.startswith("openai/gpt-5") + or model_name.startswith("openai/o3") + or model_name.startswith("openai/o4") + or model_name.startswith("deepseek/deepseek-r1") + ) + + for model_name in candidate_models: + model_config = models[model_name] + if is_reasoning_capable(model_name): + assert model_config["reasoning"] is True, model_name + assert model_config["options"]["reasoningEffort"] == "high", model_name + assert model_config["variants"]["high"]["reasoningEffort"] == "high", model_name + else: + assert model_config.get("reasoning") is not True, model_name + assert "reasoningEffort" not in model_config.get("options", {}), model_name + assert "variants" not in model_config, model_name def test_code_reviewer_prompt_preserves_review_only_policy():