Fix agent run completion and follow-up handling
Ensure parallel tool results finish before follow-ups, preserve warping status across exchanges, clean up streams before crosscheck reviews, and restore terminal focus when conversations complete. Remove temporary debug logging.
This commit is contained in:
@@ -828,19 +828,6 @@ impl Task {
|
||||
.apply()
|
||||
.map_err(UpdateTaskError::from)?;
|
||||
|
||||
let text_len = updated_message
|
||||
.message
|
||||
.as_ref()
|
||||
.map(|m| match m {
|
||||
api::message::Message::AgentOutput(o) => o.text.len(),
|
||||
_ => 0,
|
||||
})
|
||||
.unwrap_or(0);
|
||||
log::info!(
|
||||
"[bedrock-debug] append_to_message_content: accumulated text_len={}",
|
||||
text_len
|
||||
);
|
||||
|
||||
let id = self.id.clone();
|
||||
let exchange_to_update = self
|
||||
.exchange_mut(exchange_id)
|
||||
@@ -1069,34 +1056,11 @@ 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(conversion_params)?
|
||||
{
|
||||
MaybeAIAgentOutputMessage::Message(m) => {
|
||||
log::info!(
|
||||
"[bedrock-debug] upsert_output_for_message: client_message_type={:?}",
|
||||
std::mem::discriminant(&m.message)
|
||||
);
|
||||
output.extend_citations(m.citations.clone());
|
||||
if let Some(message_idx) = message_idx {
|
||||
output.messages[message_idx] = m;
|
||||
@@ -1104,11 +1068,7 @@ impl AIAgentExchange {
|
||||
output.messages.push(m);
|
||||
}
|
||||
}
|
||||
MaybeAIAgentOutputMessage::NoClientRepresentation => {
|
||||
log::warn!(
|
||||
"[bedrock-debug] upsert_output_for_message: NoClientRepresentation for msg_id={}", task_message.id
|
||||
);
|
||||
}
|
||||
MaybeAIAgentOutputMessage::NoClientRepresentation => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user