Preserve Connector transport failure chain
This commit is contained in:
parent
1e57bfacaa
commit
377be331b9
1 changed files with 27 additions and 1 deletions
|
|
@ -238,7 +238,7 @@ where
|
|||
provider: provider.to_string(),
|
||||
sequence: 0,
|
||||
payload: EpiphanyModelStreamPayload::Failed {
|
||||
message: error.to_string(),
|
||||
message: format!("{error:#}"),
|
||||
},
|
||||
}],
|
||||
}
|
||||
|
|
@ -280,3 +280,29 @@ fn hex_digest(digest: [u8; 32]) -> String {
|
|||
}
|
||||
value
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn failed_transport_event_preserves_the_bounded_error_chain() {
|
||||
let events = collect_transport_events(
|
||||
async {
|
||||
Err(anyhow!("socket timed out"))
|
||||
.context("Connector client could not read its response")
|
||||
},
|
||||
"request-1",
|
||||
"openai-codex",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(events.len(), 1);
|
||||
let EpiphanyModelStreamPayload::Failed { message } = &events[0].payload else {
|
||||
panic!("transport failure must project one failed event");
|
||||
};
|
||||
assert_eq!(
|
||||
message,
|
||||
"Connector client could not read its response: socket timed out"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue