The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(acp): copilot_acp_client alias keeps the gh copilot extension diagnosis
Teknium9fe658073ee8
diff --git a/agent/copilot_acp_client.py b/agent/copilot_acp_client.pyindex 47023c34013..812db882a9e 100644--- a/agent/copilot_acp_client.py+++ b/agent/copilot_acp_client.py@@ -6,8 +6,8 @@ import former module helpers (``ACP_MARKER_BASE_URL``, ``_build_subprocess_env````_acp_supported``, ``_model_selection_request``, ``_effective_timeout``) and patch``subprocess.Popen`` through it. So the module keeps its whole former surface: theCopilot-flavoured names keep their former defaults (launch env vars, the ``copilot-acp``-placeholder, the ``copilotEnablement`` model filter, the ``gh copilot`` extension banner-helpers), and the generic rest is served from :mod:`agent.acp_client`. The first access of+placeholder, the ``copilotEnablement`` model filter, the deprecated ``gh copilot`` extension+diagnosis), and the generic rest is served from :mod:`agent.acp_client`. The first access ofany of these names warns once per process. Remove no sooner than two minor releases after thedeprecation (the plugin compat contract in ``plugins/AGENTS.md``)."""@@ -54,7 +54,7 @@ def _is_gh_extension_banner(stderr_text: str) -> bool:class _DeprecatedCopilotACPClient(ACPClient):- """ACPClient with the historical launch defaults, labels and model filter."""+ """ACPClient with the historical launch defaults, labels, model filter and early-exit diagnosis."""default_command = "copilot"default_args = ("--acp", "--stdio")@@ -71,6 +71,9 @@ class _DeprecatedCopilotACPClient(ACPClient):def model_entry_disabled(self, entry: dict[str, Any]) -> bool:return _copilot_disabled(entry)+ def early_exit_error(self, stderr_text: str) -> str | None:+ return _GH_EXTENSION_ERROR + stderr_text if _is_gh_extension_banner(stderr_text) else None+_DeprecatedCopilotACPClient.__name__ = _DeprecatedCopilotACPClient.__qualname__ = "CopilotACPClient"diff --git a/tests/agent/test_copilot_acp_alias_compat.py b/tests/agent/test_copilot_acp_alias_compat.pyindex 563ac4c85d2..3f322b736eb 100644--- a/tests/agent/test_copilot_acp_alias_compat.py+++ b/tests/agent/test_copilot_acp_alias_compat.py@@ -167,6 +167,16 @@ def test_cursor_acp_pinned_import_shape(agent, tmp_path):assert methods().count("session/set_model") == 1+def test_alias_keeps_the_former_gh_extension_diagnosis(tmp_path):+ from agent.copilot_acp_client import CopilotACPClient++ script = tmp_path / "old_gh_copilot.py"+ script.write_text("import sys; print('gh-copilot has been deprecated', file=sys.stderr); sys.exit(1)\n", encoding="utf-8")+ client = CopilotACPClient(command=sys.executable, args=[str(script)], acp_cwd=str(tmp_path))+ with pytest.raises(RuntimeError, match="deprecated `gh copilot` extension"):+ client.list_models(timeout_seconds=30)++# Every top-level name agent/copilot_acp_client.py had before the deprecation (0c771d7a5ba)._FORMER_SURFACE = ("ACP_MARKER_BASE_URL", "Any", "Callable", "CopilotACPClient", "Iterator", "Path", "SimpleNamespace",