Skip to content

Chore/bump openhands sdk 1.41.0 - #803

Open
cbagwell wants to merge 2 commits into
OpenHands:mainfrom
cbagwell:chore/bump-openhands-sdk-1.41.0
Open

cbagwell wants to merge 2 commits into
OpenHands:mainfrom
cbagwell:chore/bump-openhands-sdk-1.41.0

Conversation

@cbagwell

@cbagwell cbagwell commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

HUMAN: Newer SDK/LiteLLM would be nice to have access to. Tested with Toad for ACP changes and with https://mcp.deepwiki.com/mcp for MCP changes. Broken into 2 commits if prefer to only update to SDK 1.31.0 for now.

AGENT:

End-to-end verification performed:

  1. Dependency resolution & install: uv lock resolved cleanly, bumping
    openhands-sdk and openhands-tools to 1.41.0. uv sync installed
    the new versions with no errors. Verified the installed version reports
    1.41.0.

  2. Full test suite: uv run pytest -q → 1428 passed, 3 failed. The 3
    failures are a pre-existing asyncio.get_event_loop() test-isolation issue
    in tests/test_web_command.py (confirmed to fail identically on unmodified
    main under the same full-suite run, and to pass in isolation) — unrelated
    to the SDK version.

  3. MCP coercion runtime check: Verified at runtime that the migration
    helpers behave correctly:

    • Legacy {"mcpServers": ...} wrapper → flat dict[str, MCPServer]
    • fastmcp string auth "oauth"strategy='oauth2'
    • fastmcp bearer token "tok123"strategy='bearer' with secret value preserved
    • MCPServer dump round-trips cleanly via dump_mcp_config
    • getattr(server.auth, "strategy", None) returns None safely when auth is None

Why

openhands-sdk 1.28.1 is outdated. Along the upgrade path to 1.41.0, the SDK
introduced two API changes that require CLI code changes:

  • agent-client-protocol 0.10.x renamed/reshaped ACP schema types
    (AuthMethodAuthMethodAgent, new close_session, new kwargs) that the
    CLI's acp_impl must conform to.
  • SDK >= 1.32 changed Agent.mcp_config from an opaque
    {"mcpServers": ...} wrapper to a flat dict[str, MCPServer]. Every CLI
    code path reading or writing mcp_config needed updating, and persisted
    agents saved by older versions need coercion on load.

Summary

  • Bump openhands-sdk / openhands-tools from 1.28.1 to 1.41.0 and
    agent-client-protocol to >=0.10.1,<0.11.0; port acp_impl to the 0.10.x
    ACP API.
  • Migrate all mcp_config handling to the flat dict[str, MCPServer] format,
    including backward-compat coercion of legacy {"mcpServers": ...} persisted
    agents on load.
  • Migrate tests/fixtures to the flat format; add regression tests for legacy
    wrapper coercion, string auth, ACP header conversion, and the "Incoming on
    Restart" panel comparison.

Issue Number

#786

How to Test

git clone git@github.com:cbagwell/OpenHands-CLI.git
cd OpenHands-CLI
git checkout chore/bump-openhands-sdk-1.41.0
uv sync
uv run pytest -q

Expected: 1428 passed, 3 failed (the 3 test_web_command.py failures are
pre-existing event-loop isolation issues, not introduced by this PR — they
fail identically on main).

To specifically verify the MCP migration paths:

uv run pytest tests/settings/test_mcp_settings_reconciliation.py \
             tests/tui/panels/test_mcp_side_panel.py \
             tests/test_utils.py tests/acp/test_confirmation.py \
             tests/snapshots/test_app_snapshots.py -q

Expected: all pass.

Video/Screenshots

N/A — this is a dependency bump and internal API migration with no UI changes.
Snapshot tests (tests/snapshots/test_app_snapshots.py) confirm the TUI renders
identically before and after the migration.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

  • Backward compatibility: load_from_disk coerces pre-1.32 persisted
    {"mcpServers": ...} wrappers to the flat format at load, so existing users
    won't see a "corrupted file" error on upgrade. An uncoercible MCP config is
    dropped (not fatal); genuinely corrupted non-MCP fields still surface as
    corrupted. Covered by test_load_legacy_persisted_mcp_wrapper,
    test_load_persisted_mcp_with_fastmcp_string_auth,
    test_load_uncoercible_persisted_mcp_is_dropped, and
    test_load_non_mcp_validation_error_reports_corrupted.

cbagwell and others added 2 commits August 2, 2026 00:16
…rotocol 0.10.x

- Raise agent-client-protocol pin from >=0.8.1,<0.9.0 to >=0.10.1,<0.11.0
- Bump openhands-sdk and openhands-tools from 1.28.1 to 1.31.0
- Port acp_impl to the 0.10.x ACP API:
  * Replace AuthMethod with AuthMethodAgent
  * Add close_session to BaseOpenHandsACPAgent
  * Accept additional_directories/message_id kwargs per new ABC signatures
  * set_config_option value is now str | bool
  * list_sessions/fork_session/resume_session/new_session/prompt/load_session
    signatures aligned with the 0.10.x Agent interface
- Update tests for KillTerminalCommandResponse -> KillTerminalResponse

Co-authored-by: openhands <openhands@all-hands.dev>
…rmat

openhands-sdk >= 1.32 changed Agent.mcp_config from an opaque
{"mcpServers": ...} wrapper to a flat dict[str, MCPServer]. Update all CLI
code paths to the new format and coerce legacy persisted agents on load.
Bumps openhands-sdk/openhands-tools from 1.28.1 to 1.41.0 (1.41.0 has no
breaking API changes affecting the CLI's use of the SDK).

- openhands_cli/stores/agent_store.py: convert_mcp_servers helper builds
  dict[str, MCPServer] from fastmcp objects, raw dicts, or the legacy
  wrapped dict, delegating field filtering/transport normalization to the
  SDK's coerce_mcp_config; fastmcp-style string auth ("oauth"/bearer token)
  is translated to the SDK's credential union. load_from_disk coerces
  pre-1.32 persisted {"mcpServers": ...} wrappers before validation.
- openhands_cli/acp_impl/utils/mcp.py: strip ACP schema metadata
  (field_meta/type) and convert HTTP/SSE headers from EnvVariable arrays to
  dicts so ACP-provided servers validate as SDK MCPServer in setup.py.
- openhands_cli/setup.py: merge MCP servers using flat format.
- openhands_cli/tui/panels/mcp_side_panel.py: read flat agent.mcp_config,
  format MCPServer objects directly, and compare current vs incoming specs
  through the shared coercion pipeline; Incoming on Restart is unchanged.
- openhands_cli/mcp/mcp_display_utils.py: drop now-unused
  normalize_server_object helper.
- tests: migrate fixtures/assertions to flat format; add regression tests
  for legacy-wrapper coercion, string auth, ACP header conversion, and the
  Incoming on Restart comparison.

Co-authored-by: openhands <openhands@all-hands.dev>
@cbagwell
cbagwell force-pushed the chore/bump-openhands-sdk-1.41.0 branch from c122bdb to 4537d9e Compare August 9, 2026 01:53
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 40 days with no activity. Remove the stale label or leave a comment, otherwise it will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant