Skip to content

ACP: deprecate the session/new _meta model-selection path (set_session_model is now universal) #3771

@simonrosenberg

Description

@simonrosenberg

Summary

Deprecate and eventually remove the ACP session/new _meta model-selection path — build_session_model_meta(), ACPProviderInfo.session_meta_key, and the new_session(**session_meta) spread in ACPAgent — now that set_session_model is the universal initial-model mechanism for every built-in ACP provider.

Background

Originally, claude-agent-acp selected its initial model via a session/new _meta payload ({"claudeCode": {"options": {"model": ...}}}), while codex/gemini used the set_session_model protocol call. #3654 flipped claude-code to supports_set_session_model=True, so _maybe_set_session_model() now issues set_session_model for all built-in providers (codex, gemini, claude-code).

As a result the _meta path is vestigial:

  • It is built only for claude-code (codex/gemini have session_meta_key=None).
  • On the pinned claude-agent-acp 0.30.0 it is a no-op — the payload only adds a picker option; set_session_model is what actually applies the model. Validated end-to-end in fix(acp): persist pre-session model switch instead of raising #3764 against the real CLI: a pre-run switch Opus→Haiku ran as Haiku and Opus→Sonnet ran as Sonnet, applied via set_session_model (the running model self-identified).
  • It is currently retained only as backward-compat for older claude CLIs (≤ 0.29.x) that still honor _meta (see tests/sdk/settings/test_acp_providers.py v0.29.0 case).

build_session_model_meta is also a public exported symbol (openhands.sdk and openhands.sdk.settings), so removal must go through the API-breakage deprecation runway (qualified feature name + removed_in), per the pattern in #3652.

Proposal

Once we're comfortable that no supported deployment runs claude-agent-acp < 0.30.0 (today CLAUDE_AGENT_ACP_VERSION = "0.30.0" and resolve_acp_command rewrites npx → the pinned binary, so prod runs 0.30.0; the only escape hatch is a caller-supplied acp_command):

  1. Deprecate build_session_model_meta() with a removed_in version (5-minor public-API runway).
  2. Set claude-code's session_meta_key=None; then remove the session_meta_key field from ACPProviderInfo.
  3. Drop the session_meta = build_session_model_meta(...) build and the new_session(**session_meta) spread in ACPAgent.init_state → plain new_session(cwd=..., mcp_servers=...).
  4. Update/remove the build_session_model_meta tests.

current_model_id already keys its honesty on the set_session_model call (not _meta) after the #3764 follow-up (override_applied = applied_via_call), so removing _meta is behavior-preserving for the pinned CLI.

Open question

Do we want to keep any support for claude-agent-acp ≤ 0.29.x (where _meta is the only working initial-model path and set_session_model on a fresh session may not be honored)? If not — drop it entirely. If yes — gate _meta behind a detected CLI version rather than carrying it unconditionally.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    acpAbout ACP

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions