Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/goose/src/acp/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3056,7 +3056,11 @@ impl GooseAcpAgent {
.get_goose_model()
.internal_err_ctx("Failed to resolve default model from config")?
} else if is_changing_provider {
ACP_CURRENT_MODEL.to_string()
crate::providers::get_from_registry(&resolved_provider_name)
.await
.ok()
.map(|entry| entry.metadata().default_model.clone())
.unwrap_or(ACP_CURRENT_MODEL.to_string())
} else {
current_model
};
Expand Down
16 changes: 15 additions & 1 deletion crates/goose/src/agents/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2897,7 +2897,7 @@ impl Agent {
.or_else(|| config.get_goose_provider().ok())
.ok_or_else(|| anyhow!("Could not configure agent: missing provider"))?;

let model_config = match session.model_config.clone() {
let mut model_config = match session.model_config.clone() {
Some(saved_config) => saved_config,
None => {
let model_name = config
Expand All @@ -2909,6 +2909,20 @@ impl Agent {
}
};

// if the saved model is the ACP sentinel "current", only preserve this if the provider
// uses this sentinel to indicate it's an ACP provider that manages its model
if model_config.model_name == crate::acp::ACP_CURRENT_MODEL {
if let Ok(entry) = crate::providers::get_from_registry(&provider_name).await {
if entry.metadata().default_model != crate::acp::ACP_CURRENT_MODEL {
model_config = crate::model_config::model_config_from_user_config(
&provider_name,
&entry.metadata().default_model,
)
.map_err(|e| anyhow!("Could not resolve default model: {}", e))?;
}
}
}

let extensions =
EnabledExtensionsState::extensions_or_default(Some(&session.extension_data), config);

Expand Down
Loading