The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(copilot): preserve Astra reasoning effort
Jash Lee7a597324a19e
diff --git a/agent/reasoning_params.py b/agent/reasoning_params.pyindex 072f4d05cc7..4fb54d5d827 100644--- a/agent/reasoning_params.py+++ b/agent/reasoning_params.py@@ -8,6 +8,7 @@ import timefrom agent.lazy_forward import forward as _forward, forward_static as _forward_staticfrom agent.message_sanitization import matches_reasoning_echo_family+from agent.reasoning_effort import clamp_effortfrom utils import base_url_host_matches# Static OpenRouter fallback when the live /v1/models capability cache is cold.@@ -153,9 +154,9 @@ class ReasoningParamsMixin:effort = str(cfg.get("effort", "medium")).strip().lower()if effort not in supported:- # Nearest-neighbour fallbacks: xhigh→high, minimal→low, else medium, else the first published level.- nearest = {"xhigh": "high", "minimal": "low"}.get(effort)- effort = nearest if nearest in supported else "medium" if "medium" in supported else supported[0]+ effort = clamp_effort(effort, supported)+ if effort not in supported:+ effort = "medium" if "medium" in supported else supported[0]return {"effort": effort}_build_assistant_message = _forward("agent.chat_completion_helpers", "build_assistant_message")diff --git a/agent/transports/codex.py b/agent/transports/codex.pyindex bc1b99dffd8..ab2f0e10158 100644--- a/agent/transports/codex.py+++ b/agent/transports/codex.py@@ -14,7 +14,7 @@ from agent.reasoning_effort import (CODEX_ASTRA_EFFORTS, CODEX_LEGACY_EFFORTS,XAI_GROK46_EFFORTS, XAI_LEGACY_EFFORTS, clamp_effort, is_astra_model,# Same declared vocabulary + shared clamp as the main Codex transport (agent.reasoning_effort):- # per-model — "max" is gpt-5.6-only, "minimal"/"ultra" always rejected (live-verified, #68365).+ # per-model — "max" availability varies; "minimal"/"ultra" require wire translation.codex_supported_efforts,)from agent.transports.base import ProviderTransportdiff --git a/hermes_cli/models.py b/hermes_cli/models.pyindex a1416c0458a..c06f2fcbce1 100644--- a/hermes_cli/models.py+++ b/hermes_cli/models.py@@ -2352,6 +2352,10 @@ def _github_reasoning_efforts_for_model_id(model_id: str) -> list[str]:if raw.startswith(("openai/o1", "openai/o3", "openai/o4", "o1", "o3", "o4")):return list(COPILOT_REASONING_EFFORTS_O_SERIES)normalized = normalize_copilot_model_id(model_id).lower()+ if normalized.startswith("gpt-6-astra"):+ from agent.reasoning_effort import CODEX_ASTRA_EFFORTS++ return list(CODEX_ASTRA_EFFORTS)if normalized.startswith("gpt-5"):return list(COPILOT_REASONING_EFFORTS_GPT5)return []diff --git a/tests/agent/transports/test_codex_transport.py b/tests/agent/transports/test_codex_transport.pyindex 1f0bc0366bf..139767cee4f 100644--- a/tests/agent/transports/test_codex_transport.py+++ b/tests/agent/transports/test_codex_transport.py@@ -35,6 +35,30 @@ class TestCodexTransportBasic:class TestCodexBuildKwargs:+ @pytest.mark.parametrize("model", ["gpt-6-astra", "openai/gpt-6-astra"])+ @pytest.mark.parametrize("effort, expected", [+ ("low", "low"), ("medium", "medium"), ("high", "high"),+ ("xhigh", "xhigh"), ("max", "max"), ("ultra", "max"),+ ("minimal", "low"), ("none", None),+ ])+ def test_astra_copilot_forwards_configured_reasoning(self, transport, model, effort, expected):+ from agent.reasoning_params import ReasoningParamsMixin+ from hermes_cli.config import get_config_path, load_config+ from hermes_constants import resolve_reasoning_config++ get_config_path().write_text(json.dumps({+ "model": {"default": model}, "agent": {"reasoning_effort": effort},+ }), encoding="utf-8")+ reasoning = resolve_reasoning_config(load_config(), model)+ agent = SimpleNamespace(model=model, reasoning_config=reasoning)+ kw = transport.build_kwargs(+ model=model, messages=[{"role": "user", "content": "Hi"}],+ provider="github-copilot", is_github_responses=True,+ reasoning_config=reasoning,+ github_reasoning_extra=ReasoningParamsMixin._github_models_reasoning_extra_body(agent),+ )+ assert kw.get("reasoning") == ({"effort": expected} if expected else None)+def test_astra_direct_request_applies_model_contract_after_overrides(self, transport):kw = transport.build_kwargs(model="gpt-6-astra",