agent_servers: Include result text in Claude error messages (#35156)

This will better surfaces issues that are classified as "success" but
actually have a more meaningful error message attached.

Release Notes:

- N/A
This commit is contained in:
Ben Brandt 2025-07-27 15:58:02 +02:00 committed by GitHub
parent a5b7cfd128
commit c995d45bd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -414,11 +414,19 @@ impl ClaudeAgentSession {
}
}
SdkMessage::Result {
is_error, subtype, ..
is_error,
subtype,
result,
..
} => {
if let Some(end_turn_tx) = end_turn_tx.borrow_mut().take() {
if is_error {
end_turn_tx.send(Err(anyhow!("Error: {subtype}"))).ok();
end_turn_tx
.send(Err(anyhow!(
"Error: {}",
result.unwrap_or_else(|| subtype.to_string())
)))
.ok();
} else {
end_turn_tx.send(Ok(())).ok();
}