Skip to content

feat(acp): add model selection support for session/new and session/set_model#7112

Merged
codefromthecrypt merged 1 commit intomainfrom
acp-models
Feb 10, 2026
Merged

feat(acp): add model selection support for session/new and session/set_model#7112
codefromthecrypt merged 1 commit intomainfrom
acp-models

Conversation

@codefromthecrypt
Copy link
Collaborator

@codefromthecrypt codefromthecrypt commented Feb 10, 2026

Summary

Add model selection support to the ACP server (goose acp). ACP clients like Zed show a model picker when the agent returns models in the session/new response, and switch models mid-session via session/set_model. This adds both so clients can see and switch between the configured provider's available models.

Clients that don't support model selection continue to work unchanged -- the models field is optional and session/set_model is never sent by those clients.

The sacp crate is at the latest version, v10.1.0, but is out-of-date and even main lacks model support. HACK comments apply until sorted.

Type of Change

  • Feature
  • Tests

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Manual: Zed 0.222.4 + goose (this branch):

  1. cargo build --release -p goose-cli
  2. Open Zed
  3. Click Zed, Settings, Open Settings File, enter below and Save
  "agent_servers": {
    "goose": {
      "type": "custom",
      "command": "/Users/codefromthecrypt/oss/goose/target/release/goose",
      "args": ["acp"],
      "env": {},
    },
  },
  1. Click the Agent (stars) icon in the bottom left, then Click + on New Thread and choose goose
  2. In the bottom left, click the model selector, and switch to a different model.
  3. Send a prompt and verify the agent responds using the new model

Integration tests (cargo test -p goose-acp --test server_test -- --nocapture):

  • test_model_list -- verifies session/new response includes SessionModelState with current model and full available model list
  • test_set_model -- switches to o4-mini, verifies the model change reaches the OpenAI API via exchange pattern matching

Related Issues

Screenshots/Demos

Screenshot 2026-02-10 at 11 21 00 AM Screenshot 2026-02-10 at 11 23 35 AM Screenshot 2026-02-10 at 11 22 25 AM Screenshot 2026-02-10 at 11 24 14 AM

Copilot AI review requested due to automatic review settings February 10, 2026 03:36
…t_model

Return available models in session/new and session/load responses so ACP
clients like Zed can show a model picker. Handle session/set_model to
switch models mid-session.

sacp v10.1.0 lacks typed support for session/set_model, so we route via
.otherwise() with UntypedMessage and deserialize into schema types.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds ACP model selection support to goose acp by surfacing provider model lists in session/new / session/load responses and handling session/set_model to switch models mid-session (with integration tests and fixtures to validate behavior).

Changes:

  • Include SessionModelState (models) in session/new and session/load responses using provider model discovery.
  • Add (temporary) untyped JSON handling for session/set_model to switch the provider/model during a session.
  • Add integration tests + OpenAI /v1/models fixture data to verify model listing and model switching behavior.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/goose/src/providers/openai.rs Adds gpt-5-nano to the known model/context-limit list.
crates/goose/src/providers/errors.rs Makes ProviderError clonable (used by new tests/mocks).
crates/goose-test-support/src/session.rs Introduces TEST_MODEL constant for tests/fixtures.
crates/goose-test-support/src/lib.rs Re-exports TEST_MODEL.
crates/goose-acp/tests/test_data/openai_models.json Adds fixture response for OpenAI model listing.
crates/goose-acp/tests/server_test.rs Registers new integration tests for model list and set_model.
crates/goose-acp/tests/fixtures/server.rs Captures NewSessionResponse.models and adds an untyped session/set_model sender for tests.
crates/goose-acp/tests/fixtures/mod.rs Mocks /v1/models and wires config to use TEST_MODEL; extends Session test trait.
crates/goose-acp/tests/common_tests/mod.rs Adds run_model_list + run_set_model common test helpers.
crates/goose-acp/src/server.rs Implements model state building, attaches models to responses, and adds session/set_model handling.
crates/goose-acp/Cargo.toml Enables schema feature (unstable_session_model) via direct dependency.
Cargo.lock Records the new dependency for goose-acp.

model_id: &str,
) -> Result<SetSessionModelResponse, sacp::Error> {
let model_config = goose::model::ModelConfig::new(model_id).map_err(|e| {
sacp::Error::internal_error().data(format!("Invalid model config: {}", e))
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModelConfig::new(model_id) failing is a client input error, but this is currently returned as internal_error; returning invalid_params (and similarly mapping “unknown session” to invalid_params) will give ACP clients correct feedback when they select an unsupported model or bad session id.

Suggested change
sacp::Error::internal_error().data(format!("Invalid model config: {}", e))
sacp::Error::invalid_params().data(format!("Invalid model config: {}", e))

Copilot uses AI. Check for mistakes.
@codefromthecrypt
Copy link
Collaborator Author

Aside: Copilot reviews are getting worse lately only 2/5 comments valid and another pr 2/4

Copy link
Collaborator

@michaelneale michaelneale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah copilot was so believable but yeah, nice one.

@codefromthecrypt codefromthecrypt added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit 49ad115 Feb 10, 2026
20 checks passed
@codefromthecrypt codefromthecrypt deleted the acp-models branch February 10, 2026 05:41
zanesq added a commit that referenced this pull request Feb 10, 2026
…tensions-deeplinks

* 'main' of github.com:block/goose:
  [docs] update authors.yaml file (#7114)
  Implement manpage generation for goose-cli (#6980)
  docs: tool output optimization (#7109)
  Fix duplicated output in Code Mode by filtering content by audience (#7117)
  Enable tom (Top Of Mind) platform extension by default (#7111)
  chore: added notification for canary build failure (#7106)
  fix: fix windows bundle random failure and optimise canary build (#7105)
  feat(acp): add model selection support for session/new and session/set_model (#7112)
  fix: isolate claude-code sessions via stream-json session_id (#7108)
  ci: enable agentic provider live tests (claude-code, codex, gemini-cli) (#7088)
  docs: codex subscription support (#7104)
  chore: add a new scenario (#7107)
  fix: Goose Desktop missing Calendar and Reminders entitlements (#7100)
  Fix 'Edit In Place' and 'Fork Session' features (#6970)
  Fix: Only send command content to command injection classifier (excluding part of tool call dict) (#7082)
  Docs: require auth optional for custom providers (#7098)
  fix: improve text-muted contrast for better readability (#7095)
  Always sync bundled extensions (#7057)
tlongwell-block added a commit that referenced this pull request Feb 10, 2026
* origin/main:
  feat: add AGENT=goose environment variable for cross-tool compatibility (#7017)
  fix: strip empty extensions array when deeplink also (#7096)
  [docs] update authors.yaml file (#7114)
  Implement manpage generation for goose-cli (#6980)
  docs: tool output optimization (#7109)
  Fix duplicated output in Code Mode by filtering content by audience (#7117)
  Enable tom (Top Of Mind) platform extension by default (#7111)
  chore: added notification for canary build failure (#7106)
  fix: fix windows bundle random failure and optimise canary build (#7105)
  feat(acp): add model selection support for session/new and session/set_model (#7112)
  fix: isolate claude-code sessions via stream-json session_id (#7108)
  ci: enable agentic provider live tests (claude-code, codex, gemini-cli) (#7088)
  docs: codex subscription support (#7104)
  chore: add a new scenario (#7107)
  fix: Goose Desktop missing Calendar and Reminders entitlements (#7100)
  Fix 'Edit In Place' and 'Fork Session' features (#6970)
  Fix: Only send command content to command injection classifier (excluding part of tool call dict) (#7082)

# Conflicts:
#	crates/goose/src/agents/extension.rs
jh-block added a commit that referenced this pull request Feb 10, 2026
* origin/main: (30 commits)
  docs: GCP Vertex AI org policy filtering & update OnboardingProviderSetup component (#7125)
  feat: replace subagent and skills with unified summon extension (#6964)
  feat: add AGENT=goose environment variable for cross-tool compatibility (#7017)
  fix: strip empty extensions array when deeplink also (#7096)
  [docs] update authors.yaml file (#7114)
  Implement manpage generation for goose-cli (#6980)
  docs: tool output optimization (#7109)
  Fix duplicated output in Code Mode by filtering content by audience (#7117)
  Enable tom (Top Of Mind) platform extension by default (#7111)
  chore: added notification for canary build failure (#7106)
  fix: fix windows bundle random failure and optimise canary build (#7105)
  feat(acp): add model selection support for session/new and session/set_model (#7112)
  fix: isolate claude-code sessions via stream-json session_id (#7108)
  ci: enable agentic provider live tests (claude-code, codex, gemini-cli) (#7088)
  docs: codex subscription support (#7104)
  chore: add a new scenario (#7107)
  fix: Goose Desktop missing Calendar and Reminders entitlements (#7100)
  Fix 'Edit In Place' and 'Fork Session' features (#6970)
  Fix: Only send command content to command injection classifier (excluding part of tool call dict) (#7082)
  Docs: require auth optional for custom providers (#7098)
  ...
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
…t_model (block#7112)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
…t_model (block#7112)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
…t_model (block#7112)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants