Skip to content

ACP claude-code initial model selection via session _meta is silently ignored by claude-agent-acp 0.30.0 #3654

Closed

Description

@simonrosenberg

Summary

claude-agent-acp@0.30.0 (the Dockerfile-pinned CLI) does not apply the _meta {"claudeCode": {"options": {"model": ...}}} initial-model selection that the SDK's claude-code init path relies on. The requested model is registered as a "Custom model" picker option, but the session keeps currentModelId="default" and every turn runs on the CLI's default model (currently Opus). The SDK therefore silently ignores acp_model for claude-code at session creation — including the curated defaults shipped in #3653.

Evidence (from the #3651 audit, raw JSON-RPC against the pinned CLI)

  • session/new with _meta: {"claudeCode": {"options": {"model": "claude-haiku-4-5"}}} → response models.currentModelId stays "default"; the subsequent prompt's usage_update reports a 1,000,000-token context and Opus-level cost — i.e. the turn ran on default Opus, not Haiku.
  • A bogus ID (claude-bogus-9-9) in _meta "succeeds" silently: registered as a custom option, session runs on default, prompt completes. No error is ever surfaced.
  • session/set_model on the same CLI both validates (claude-bogus-9-9 → -32603 "It may not exist or you may not have access to it") and applies (after set_model("claude-haiku-4-5"), config_option_update shows currentValue="claude-haiku-4-5" and usage telemetry shows the 200k Haiku context). All 6 curated Claude models pass end-to-end via this path.

Where the SDK goes wrong

  • ACP_PROVIDERS["claude-code"] has supports_set_session_model=False + session_meta_key="claudeCode", so _maybe_set_session_model() deliberately skips the protocol call at init ("claude already received the model in new_session()") — but it didn't.
  • ACPAgent.current_model_id is overridden by self.acp_model when set, so downstream clients report the chosen model while the session actually runs default — the UI lies.

Proposed fix

Flip claude-code to supports_set_session_model=True so the init path issues the one-shot session/set_model (the same call the runtime switch and the resume-reapply path already use, and the path the audit validated end-to-end for every curated model). Keep session_meta_key — sending the same model via _meta stays harmless and keeps working if a future CLI honours it.

Behavioural consequence (desired): an invalid/inaccessible acp_model now fails session init loudly with the CLI's -32603 instead of silently running on default — matching codex/gemini behaviour.

Refs

Activity

  1. simonrosenberg commented on Jun 11, 2026

    @simonrosenberg
    MemberAuthor

    Version-currency check: the pinned claude-agent-acp@0.30.0 is well behind — npm latest is 0.44.0 (2026-06-09; the project ships ~2–3 releases/week). Probed 0.44.0 with the same harness:

    • session/set_model is REMOVED → -32601 "Method not found": session/set_model, and session/new no longer returns a models block. Model selection moved to the generic config-options surface: the config_option_update carries {"id": "model", ...} with the live lineup, and switching is presumably session/set_config_option(configId="model").
    • The _meta bug persists on 0.44.0: requesting claude-haiku-4-5 via _meta registers it as a picker option but currentValue stays on the account default. So bumping the pin would not have fixed ACP claude-code initial model selection via session _meta is silently ignored by claude-agent-acp 0.30.0 #3654.
    • The 0.44.0 lineup confirms current IDs: default = "Opus 4.8 with 1M context", claude-fable-5[1m] ("Fable 5 · most capable"), sonnet (4.6), haiku (4.5).

    Implications:

    1. fix(sdk): apply claude-code initial ACP model via set_session_model (claude-agent-acp ignores _meta) #3655 stays as-is — it targets the Dockerfile-pinned 0.30.0, where set_session_model is the validated path (and the same call the runtime-switch and resume-reapply paths already use today).
    2. Any future pin bump past the set_model removal will break all three set_session_model call sites with -32601. The SDK already has a set_config_option(config_id="model") fallback for unknown providers — a follow-up should extend that fallback to known providers on -32601, which would make the SDK work on both old and new CLI generations. Happy to file/implement that as a separate issue when a bump is planned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

acp

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions