fix: 8531 - elicitation fixes (#8999)

Signed-off-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
Alex Hancock
2026-05-05 14:47:25 -04:00
committed by GitHub
parent dd95b7bb85
commit cadae27bb0
9 changed files with 128 additions and 30 deletions
+11 -10
View File
@@ -1042,18 +1042,19 @@ impl Agent {
if let ActionRequiredData::ElicitationResponse { id, user_data } =
&action_required.data
{
if let Err(e) = ActionRequiredManager::global()
// Surface stale/cancelled/timed-out elicitations as a hard
// error so callers (e.g. the HTTP handler) can propagate
// failure to the client instead of silently reporting
// success while the blocked tool call stays unblocked.
// The success path returns an empty stream; an Err here
// makes the contract: Ok(empty) on accept, Err on reject.
ActionRequiredManager::global()
.submit_response(id.clone(), user_data.clone())
.await
{
let error_text = format!("Failed to submit elicitation response: {}", e);
error!(error_text);
return Ok(Box::pin(stream::once(async {
Ok(AgentEvent::Message(
Message::assistant().with_text(error_text),
))
})));
}
.map_err(|e| {
error!("Failed to submit elicitation response: {}", e);
anyhow!("Failed to submit elicitation response: {}", e)
})?;
session_manager
.add_message(&session_config.id, &user_message)
.await?;