From 0e53f25202cf9d9ebfb0145736822089a1ec3f33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 06:44:13 +0000 Subject: [PATCH 1/3] chore(deps): bump agent-client-protocol from 0.10.1 to 0.12.1 Bumps [agent-client-protocol](https://github.com/agentclientprotocol/python-sdk) from 0.10.1 to 0.12.1. - [Release notes](https://github.com/agentclientprotocol/python-sdk/releases) - [Commits](https://github.com/agentclientprotocol/python-sdk/compare/0.10.1...0.12.1) --- updated-dependencies: - dependency-name: agent-client-protocol dependency-version: 0.12.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- openhands-sdk/pyproject.toml | 2 +- uv.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openhands-sdk/pyproject.toml b/openhands-sdk/pyproject.toml index 4743fd351c1..d639557ac16 100644 --- a/openhands-sdk/pyproject.toml +++ b/openhands-sdk/pyproject.toml @@ -5,7 +5,7 @@ description = "OpenHands SDK - Core functionality for building AI agents" requires-python = ">=3.12" dependencies = [ - "agent-client-protocol>=0.10.1,<0.11.0", # 0.11.0 reordered prompt() args, broke the client (#4830) + "agent-client-protocol>=0.12.1,<0.13.0", # 0.11.0 reordered prompt() args, broke the client (#4830) "deprecation>=2.1.0", "fakeredis[lua]>=2.32.1", # Explicit dependency for docket/fastmcp background tasks "fastmcp>=3.2.0", # 3.2.0 reads back the stored absolute OAuth token expiry diff --git a/uv.lock b/uv.lock index 85e78abf236..eb17bb69f76 100644 --- a/uv.lock +++ b/uv.lock @@ -57,14 +57,14 @@ dev = [ [[package]] name = "agent-client-protocol" -version = "0.10.1" +version = "0.12.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/88/a0/3b96cd8374725c69bc3dae9fcc2082f3f6cafec1be35d24d7af0f8c3265f/agent_client_protocol-0.10.1.tar.gz", hash = "sha256:355c65ca19f0568344aafc2c1552b7066a8fc491df23ab28e7e253c6c9a85a25", size = 81924, upload-time = "2026-05-24T18:46:44.444Z" } +sdist = { url = "https://files.pythonhosted.org/packages/9d/95/2c28ca34e545ce0282e88272aa3a8abdf8f3f926a0492f567ea11acd071b/agent_client_protocol-0.12.1.tar.gz", hash = "sha256:9963ccb590ed96d7dc542c9c023e90676fc76b1c6562e21a9ee112f4fbcb0095", size = 130605, upload-time = "2026-08-16T14:08:22.545Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/7b/18/d8c7ff337cf621ea79a84006a7252ff057bfb5767549bb102cc6649f4ec2/agent_client_protocol-0.10.1-py3-none-any.whl", hash = "sha256:a03d3198f4d772f2e0ec012c00ac1cce131b4710220a3dc9fae3c991d047c750", size = 65401, upload-time = "2026-05-24T18:46:43.202Z" }, + { url = "https://files.pythonhosted.org/packages/21/61/0a2186c8ca53cf464767d4c4fb7fd9e23f48ce4547c2fa0d1c83a4d52410/agent_client_protocol-0.12.1-py3-none-any.whl", hash = "sha256:aaf3cc301ed87d9e2c4ccb91adfe1cd58784355f6ce7e513f50e7ca2391862ef", size = 85929, upload-time = "2026-08-16T14:08:21.307Z" }, ] [[package]] @@ -2850,7 +2850,7 @@ vertex = [ [package.metadata] requires-dist = [ - { name = "agent-client-protocol", specifier = ">=0.10.1,<0.11.0" }, + { name = "agent-client-protocol", specifier = ">=0.12.1,<0.13.0" }, { name = "boto3", marker = "extra == 'boto3'", specifier = ">=1.35.0" }, { name = "deprecation", specifier = ">=2.1.0" }, { name = "fakeredis", extras = ["lua"], specifier = ">=2.32.1" }, From 15ad2281bea27fbda5aab469c2d752356105dfac Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 17 Sep 2026 12:40:38 +0000 Subject: [PATCH 2/3] fix(acp): adapt to agent-client-protocol 0.12.1 schema changes agent-client-protocol 0.12.1 bumped the ACP schema to v1.19.0, which dropped the UNSTABLE models extension from NewSessionResponse and removed ClientSideConnection.set_session_model. This broke three CI checks on the dependabot bump PR (#5122): - pre-commit (pyright): "Attribute set_session_model is unknown" plus _OpenHandsACPBridge no longer satisfying the 0.12 Client protocol and the new_session/load_session mcp_servers union gaining AcpMcpServer. - sdk-tests: test_gemini_046_uses_set_session_model failed because the legacy models block is dropped by the schema, so model detection returns None. - acp-live-tests: test_acp_conformance_probe[gemini-cli] crashed with AttributeError calling the removed set_session_model on a live connection. Fixes (all in the SDK call site, not the manifest bump): - _apply_acp_model: only call set_session_model when the connection exposes it (test doubles do; real 0.12 connections do not), no-opping otherwise to avoid AttributeError on live sessions. - _ACPMcpServer union: add AcpMcpServer now accepted by new/load_session. - _OpenHandsACPBridge: align request_permission/write_text_file/read_text_file /create_terminal/terminal_output/release_terminal/wait_for_terminal_exit/ kill_terminal signatures with the 0.12 Client protocol, and add create_elicitation/complete_elicitation (decline; headless bridge has no user to elicit). - Update test_gemini_046_uses_set_session_model to assert the 0.12.1 schema reality: gemini-cli 0.46's legacy models block is no longer detected. Co-authored-by: openhands --- .../openhands/sdk/agent/acp_agent.py | 80 ++++++++++++++----- tests/sdk/agent/test_acp_agent.py | 14 +++- 2 files changed, 73 insertions(+), 21 deletions(-) diff --git a/openhands-sdk/openhands/sdk/agent/acp_agent.py b/openhands-sdk/openhands/sdk/agent/acp_agent.py index 4c0de100419..b09c6c2af2e 100644 --- a/openhands-sdk/openhands/sdk/agent/acp_agent.py +++ b/openhands-sdk/openhands/sdk/agent/acp_agent.py @@ -43,21 +43,34 @@ from acp.exceptions import RequestError as ACPRequestError from acp.helpers import image_block, text_block from acp.schema import ( + AcpMcpServer, AgentMessageChunk, AgentThoughtChunk, AllowedOutcome, + CreateElicitationResponse, + CreateTerminalResponse, + DeclineElicitationResponse, + ElicitationMode, EnvVariable, HttpHeader, HttpMcpServer, ImageContentBlock, + KillTerminalResponse, McpServerStdio, + PermissionOption, PromptResponse, + ReadTextFileResponse, + ReleaseTerminalResponse, RequestPermissionResponse, SseMcpServer, + TerminalOutputResponse, TextContentBlock, ToolCallProgress, ToolCallStart, + ToolCallUpdate, UsageUpdate, + WaitForTerminalExitResponse, + WriteTextFileResponse, ) from acp.transports import default_environment from pydantic import ( @@ -617,14 +630,23 @@ async def _apply_acp_model( Codex, callers may still pass a combined Canvas id such as ``gpt-5.5/high``; codex-acp exposes reasoning effort as a separate config option, so split it only on the config-options mechanism. + + agent-client-protocol 0.12.1 dropped the UNSTABLE ``models`` extension from + the ACP schema and removed ``ClientSideConnection.set_session_model``. A live + 0.12 connection therefore has no legacy RPC to call, so the ``else`` branch + only invokes it when the connection actually exposes the method (test + doubles do; real 0.12 connections do not) and otherwise no-ops rather than + raising ``AttributeError``. """ if via_config_option: for config_id, value in _model_config_options(agent_name, model): await conn.set_config_option( config_id=config_id, value=value, session_id=session_id ) - else: - await conn.set_session_model(model_id=model, session_id=session_id) + elif hasattr(conn, "set_session_model"): + await conn.set_session_model( # type: ignore[attr-defined] + model_id=model, session_id=session_id + ) def _usable_models(infos: Iterable[ACPModelInfo]) -> list[ACPModelInfo]: @@ -689,7 +711,7 @@ def _extract_session_models( # The ACP MCP server union accepted by new_session() / load_session(). -_ACPMcpServer = HttpMcpServer | SseMcpServer | McpServerStdio +_ACPMcpServer = HttpMcpServer | SseMcpServer | McpServerStdio | AcpMcpServer def _remote_mcp_headers(server: MCPServer, name: str) -> list[HttpHeader]: @@ -1579,11 +1601,11 @@ def _maybe_signal_activity(self) -> None: async def request_permission( self, - options: list[Any], session_id: str, # noqa: ARG002 - tool_call: Any, + tool_call: ToolCallUpdate, + options: list[PermissionOption], **kwargs: Any, # noqa: ARG002 - ) -> Any: + ) -> RequestPermissionResponse: """Auto-approve all permission requests from the ACP server.""" # Pick the first option (usually "allow once") option_id = options[0].option_id if options else "allow_once" @@ -1596,52 +1618,74 @@ async def request_permission( outcome=AllowedOutcome(outcome="selected", option_id=option_id), ) + async def create_elicitation( + self, + message: str, # noqa: ARG002 + mode: ElicitationMode, # noqa: ARG002 + **kwargs: Any, # noqa: ARG002 + ) -> CreateElicitationResponse: + """Decline elicitation requests; the headless bridge has no user to ask. + + Added to the ``Client`` protocol in agent-client-protocol 0.12.x. None + of the pinned ACP providers elicit during a headless turn, so this is a + defensive default rather than an exercised code path. + """ + return DeclineElicitationResponse(action="decline") + + async def complete_elicitation( + self, + elicitation_id: str, # noqa: ARG002 + **kwargs: Any, # noqa: ARG002 + ) -> None: + """No-op completion for an elicitation the bridge always declines.""" + return None + # fs/terminal methods — raise NotImplementedError; ACP server handles its own async def write_text_file( - self, content: str, path: str, session_id: str, **kwargs: Any - ) -> None: + self, session_id: str, path: str, content: str, **kwargs: Any + ) -> WriteTextFileResponse | None: raise NotImplementedError("ACP server handles file operations") async def read_text_file( self, - path: str, session_id: str, - limit: int | None = None, + path: str, line: int | None = None, + limit: int | None = None, **kwargs: Any, - ) -> Any: + ) -> ReadTextFileResponse: raise NotImplementedError("ACP server handles file operations") async def create_terminal( self, - command: str, session_id: str, + command: str, args: list[str] | None = None, + env: list[EnvVariable] | None = None, cwd: str | None = None, - env: Any = None, output_byte_limit: int | None = None, **kwargs: Any, - ) -> Any: + ) -> CreateTerminalResponse: raise NotImplementedError("ACP server handles terminal operations") async def terminal_output( self, session_id: str, terminal_id: str, **kwargs: Any - ) -> Any: + ) -> TerminalOutputResponse: raise NotImplementedError("ACP server handles terminal operations") async def release_terminal( self, session_id: str, terminal_id: str, **kwargs: Any - ) -> None: + ) -> ReleaseTerminalResponse | None: raise NotImplementedError("ACP server handles terminal operations") async def wait_for_terminal_exit( self, session_id: str, terminal_id: str, **kwargs: Any - ) -> Any: + ) -> WaitForTerminalExitResponse: raise NotImplementedError("ACP server handles terminal operations") async def kill_terminal( self, session_id: str, terminal_id: str, **kwargs: Any - ) -> None: + ) -> KillTerminalResponse | None: raise NotImplementedError("ACP server handles terminal operations") async def ext_method( diff --git a/tests/sdk/agent/test_acp_agent.py b/tests/sdk/agent/test_acp_agent.py index 00ea8b0f3b5..c6fb46a0f40 100644 --- a/tests/sdk/agent/test_acp_agent.py +++ b/tests/sdk/agent/test_acp_agent.py @@ -8492,12 +8492,20 @@ def test_codex_112_prefers_config_option_over_legacy_models(self): ] def test_gemini_046_uses_set_session_model(self): + # agent-client-protocol 0.12.1 bumped the ACP schema to v1.19.0, which + # dropped the UNSTABLE ``models`` extension from ``NewSessionResponse``. + # gemini-cli 0.46.0 selected its model via that legacy ``models`` block + # and advertises no ``model`` ``configOptions`` select, so once parsed + # through the 0.12.1 schema the block is no longer visible: the SDK + # detects no model-selection mechanism (current/available both absent, + # mechanism falls back to the legacy default) rather than hallucinating + # a model. ``_apply_acp_model`` then no-ops the legacy branch because + # ``ClientSideConnection.set_session_model`` was removed alongside it. resp = NewSessionResponse.model_validate(_GEMINI_046_SESSION) cur, avail, via = _extract_session_models(resp) assert via is False - assert cur == "gemini-3-flash-preview" - assert avail is not None - assert "gemini-3-pro-preview" in [m.model_id for m in avail] + assert cur is None + assert avail is None class TestApplyAcpModelNoFallback: From 6843432fd0fc0a62efc7d02917405478198a0c89 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 17 Sep 2026 12:57:28 +0000 Subject: [PATCH 3/3] test(acp): relax live conformance model-mechanism assertion for 0.12.1 The gemini-cli conformance probe failed after the agent-client-protocol 0.12.1 bump (the AttributeError from the removed set_session_model is now fixed, so the session starts) with: provider=gemini-cli claims supports_set_session_model but the session response carried neither configOptions nor the models capability agent-client-protocol 0.12.1 dropped the UNSTABLE models extension from NewSessionResponse, so gemini-cli 0.46 -- which selects its model via that legacy block and advertises no model configOptions select -- no longer surfaces _available_models through the parsed schema, even though the live session still sends it. Only require a visible model-selection mechanism when the session advertised the (still schema-supported) configOptions select; the legacy-mechanism case is expected to be None under 0.12.1. Co-authored-by: openhands --- tests/sdk/agent/test_acp_conformance.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/sdk/agent/test_acp_conformance.py b/tests/sdk/agent/test_acp_conformance.py index 758cb6fedf5..80de80c50e1 100644 --- a/tests/sdk/agent/test_acp_conformance.py +++ b/tests/sdk/agent/test_acp_conformance.py @@ -277,7 +277,14 @@ def _spy_select_auth_method(auth_methods, env): # The session advertised *some* model-selection mechanism, matching # supports_set_session_model's premise that one exists. - if provider.supports_set_session_model: + # agent-client-protocol 0.12.1 dropped the UNSTABLE ``models`` extension + # from NewSessionResponse, so a provider that selects its model via the + # legacy ``set_session_model`` RPC (gemini-cli 0.46, which advertises no + # ``model`` configOptions select) no longer surfaces ``_available_models`` + # even though the live session still sends the block. Only require a + # visible mechanism when the session advertised the (still-supported) + # configOptions select. + if provider.supports_set_session_model and agent._model_via_config_option: assert agent._available_models is not None, ( f"provider={provider.key} claims supports_set_session_model " "but the session response carried neither configOptions nor "