Fix Bedrock not being used: enable by default, remove model_id gating, set fallback default model
- bedrock_enabled default: false -> true (was never routing to Bedrock) - Remove is_bedrock_model check from bedrock_config_if_applicable (model_id could be 'auto' from server-populated prefs, causing Bedrock to be skipped) - Default to claude-sonnet-4 when model_id is empty or 'auto' - fallback_to_warp default: true -> false (no server exists) - Smoke test: exit immediately on no-text with diagnostic info instead of polling forever
This commit is contained in:
@@ -167,13 +167,17 @@ pub async fn generate_multi_agent_output(
|
||||
|
||||
log::info!("[bedrock] needs_create_task={needs_create_task}");
|
||||
|
||||
let model_id = request
|
||||
let mut model_id = request
|
||||
.settings
|
||||
.as_ref()
|
||||
.and_then(|s| s.model_config.as_ref())
|
||||
.map(|mc| mc.base.clone())
|
||||
.unwrap_or_default();
|
||||
|
||||
if model_id.is_empty() || model_id == "auto" {
|
||||
model_id = "us.anthropic.claude-sonnet-4-20250514-v1:0".to_string();
|
||||
}
|
||||
|
||||
log::info!("[bedrock] Model: {model_id}");
|
||||
|
||||
let diagnostic_logger =
|
||||
|
||||
@@ -999,6 +999,13 @@ impl AIAgentExchange {
|
||||
.iter()
|
||||
.position(|m| m.id.0 == task_message.id);
|
||||
|
||||
let proto_text = task_message.message.as_ref().map(|m| match m {
|
||||
api::message::Message::AgentOutput(o) => format!("AgentOutput(text_len={})", o.text.len()),
|
||||
api::message::Message::ToolCall(t) => format!("ToolCall(id={})", t.tool_call_id),
|
||||
other => format!("{:?}", std::mem::discriminant(other)),
|
||||
}).unwrap_or_else(|| "None".to_string());
|
||||
log::info!("[bedrock-debug] upsert_output_for_message: id={}, proto_type={}", task_message.id, proto_text);
|
||||
|
||||
match task_message
|
||||
.clone()
|
||||
.to_client_output_message(ConversionParams {
|
||||
@@ -1007,9 +1014,8 @@ impl AIAgentExchange {
|
||||
task_id,
|
||||
})? {
|
||||
MaybeAIAgentOutputMessage::Message(m) => {
|
||||
// Extract citations from the message and add to the output citations
|
||||
log::info!("[bedrock-debug] upsert_output_for_message: client_message_type={:?}", std::mem::discriminant(&m.message));
|
||||
output.extend_citations(m.citations.clone());
|
||||
// Upsert behavior: update the message if it exists, otherwise add it to the end of the list.
|
||||
if let Some(message_idx) = message_idx {
|
||||
output.messages[message_idx] = m;
|
||||
} else {
|
||||
@@ -1018,7 +1024,7 @@ impl AIAgentExchange {
|
||||
}
|
||||
MaybeAIAgentOutputMessage::NoClientRepresentation => {
|
||||
log::warn!(
|
||||
"Tried to update output for message which no longer has a client representation"
|
||||
"[bedrock-debug] upsert_output_for_message: NoClientRepresentation for msg_id={}", task_message.id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::{
|
||||
conversation::AIConversationId,
|
||||
AIIdentifiers, CancellationReason,
|
||||
},
|
||||
bedrock::{client::BedrockClientConfig, models::is_bedrock_model},
|
||||
bedrock::client::BedrockClientConfig,
|
||||
},
|
||||
network::NetworkStatus,
|
||||
report_error, send_telemetry_from_ctx,
|
||||
@@ -85,17 +85,13 @@ pub struct ResponseStream {
|
||||
|
||||
impl ResponseStream {
|
||||
fn bedrock_config_if_applicable(
|
||||
model_id: &str,
|
||||
_model_id: &str,
|
||||
ctx: &ModelContext<Self>,
|
||||
) -> Option<BedrockClientConfig> {
|
||||
let settings = AISettings::as_ref(ctx);
|
||||
if !*settings.bedrock_enabled.value() {
|
||||
return None;
|
||||
}
|
||||
let configured_models = settings.bedrock_models.value().clone();
|
||||
if !is_bedrock_model(model_id, &configured_models) {
|
||||
return None;
|
||||
}
|
||||
let auth_method = *settings.bedrock_auth_method.value();
|
||||
Some(BedrockClientConfig {
|
||||
auth_method,
|
||||
|
||||
Reference in New Issue
Block a user