diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py index 05dee5b342b4..1b3658677c0f 100644 --- a/agent/auxiliary_client.py +++ b/agent/auxiliary_client.py @@ -1066,7 +1066,10 @@ class _CodexCompletionsAdapter: _host_src = str(getattr(self._client, "base_url", "") or "") _is_xai = base_url_host_matches(_host_src, "x.ai") or base_url_host_matches(_host_src, "api.x.ai") - _is_github = base_url_host_matches(_host_src, "githubcopilot.com") + _is_github = ( + base_url_host_matches(_host_src, "githubcopilot.com") + or base_url_host_matches(_host_src, "models.github.ai") + ) _is_codex_backend = ( base_url_host_matches(_host_src, "chatgpt.com") and "/backend-api/codex" in _host_src.lower() diff --git a/tests/agent/test_auxiliary_client.py b/tests/agent/test_auxiliary_client.py index b047b0d2a5eb..72d39031ad33 100644 --- a/tests/agent/test_auxiliary_client.py +++ b/tests/agent/test_auxiliary_client.py @@ -4989,6 +4989,17 @@ class TestCodexAdapterPromptCacheKey: ]) assert "prompt_cache_retention" not in captured + def test_prompt_cache_retention_skipped_for_github_models_host(self): + """models.github.ai is a GitHub Responses host in the main transport + (agent/chat_completion_helpers.py) — the auxiliary path must exclude + it from cache-retention emission the same way as githubcopilot.com.""" + adapter, captured = self._build_adapter(base_url="https://models.github.ai/inference") + adapter.create(messages=[ + {"role": "system", "content": "SYS"}, + {"role": "user", "content": "hi"}, + ]) + assert "prompt_cache_retention" not in captured + class TestCodexAdapterGithubResponsesMessageIdDrop: """_CodexCompletionsAdapter must drop codex_message_items ``id`` when