diff --git a/crates/goose-provider-types/src/formats/openai_responses.rs b/crates/goose-provider-types/src/formats/openai_responses.rs index 8abce8c65..cf01b0c76 100644 --- a/crates/goose-provider-types/src/formats/openai_responses.rs +++ b/crates/goose-provider-types/src/formats/openai_responses.rs @@ -1632,12 +1632,8 @@ mod tests { }); let lines = vec![ - format!( - r#"data: {{"type":"response.created","sequence_number":1,"response":{{"id":"resp_1","object":"response","created_at":1737368310,"status":"in_progress","model":"gpt-5","output":[]}}}}"# - ), - format!( - r#"data: {{"type":"response.output_text.delta","sequence_number":2,"item_id":"msg_1","output_index":1,"content_index":0,"delta":"Paris."}}"# - ), + r#"data: {"type":"response.created","sequence_number":1,"response":{"id":"resp_1","object":"response","created_at":1737368310,"status":"in_progress","model":"gpt-5","output":[]}}"#.to_string(), + r#"data: {"type":"response.output_text.delta","sequence_number":2,"item_id":"msg_1","output_index":1,"content_index":0,"delta":"Paris."}"#.to_string(), format!( r#"data: {{"type":"response.output_item.done","sequence_number":3,"output_index":0,"item":{}}}"#, serde_json::to_string(&reasoning_item)? diff --git a/crates/goose/src/agents/extension.rs b/crates/goose/src/agents/extension.rs index 8c4772e39..00b5f44a0 100644 --- a/crates/goose/src/agents/extension.rs +++ b/crates/goose/src/agents/extension.rs @@ -21,11 +21,11 @@ pub use crate::agents::platform_extensions::{ pub struct ProcessExit { stderr: String, #[source] - source: ClientInitializeError, + source: Box, } impl ProcessExit { - pub fn new(stderr: T, source: ClientInitializeError) -> Self + pub fn new(stderr: T, source: Box) -> Self where T: Into, { @@ -49,7 +49,7 @@ pub enum ExtensionError { #[error("IO error: {0}")] IoError(#[from] std::io::Error), #[error("failed to initialize MCP client: {0}")] - InitializeError(#[source] Box), + InitializeError(#[from] Box), #[error("{0}")] ProcessExit(#[source] Box), } diff --git a/crates/goose/src/agents/extension_manager/streamable_http.rs b/crates/goose/src/agents/extension_manager/streamable_http.rs index 9c88f9e85..e22846a0a 100644 --- a/crates/goose/src/agents/extension_manager/streamable_http.rs +++ b/crates/goose/src/agents/extension_manager/streamable_http.rs @@ -70,8 +70,10 @@ fn is_oauth_auth_failure(err: &ClientInitializeError) -> bool { || message.contains("Authorization required") } -fn should_attempt_oauth_fallback(res: &Result) -> bool { - res.as_ref().err().is_some_and(is_oauth_auth_failure) +fn should_attempt_oauth_fallback(res: &Result>) -> bool { + res.as_ref() + .err() + .is_some_and(|error| is_oauth_auth_failure(error)) } /// Extract the `WWW-Authenticate` challenge from a failed initialization, so @@ -101,8 +103,12 @@ fn auth_challenge_from_error(err: &ClientInitializeError) -> Option { None } -fn auth_challenge_from_result(res: &Result) -> Option { - res.as_ref().err().and_then(auth_challenge_from_error) +fn auth_challenge_from_result( + res: &Result>, +) -> Option { + res.as_ref() + .err() + .and_then(|error| auth_challenge_from_error(error)) } /// Extract the `WWW-Authenticate` challenge from a post-initialization request @@ -228,14 +234,14 @@ fn http_client( } fn should_retry_legacy_after_empty_discover( - result: &Result, + result: &Result>, capabilities: &super::super::mcp_client::GooseMcpClientCapabilities, ) -> bool { capabilities.protocol_version.is_none() && result.as_ref().is_err_and(|error| { error.to_string().contains("empty sse stream") || matches!( - error, + error.as_ref(), ClientInitializeError::ConnectionClosed(context) if context == "discover response" ) @@ -247,7 +253,7 @@ fn should_retry_legacy_after_empty_discover( async fn connect_with_legacy_retry( make_transport: impl Fn() -> T, ctx: ConnectContext, -) -> Result +) -> Result> where T: IntoTransport, E: std::error::Error + From + Send + Sync + 'static, @@ -741,7 +747,7 @@ mod tests { ), ), ); - assert!(should_attempt_oauth_fallback(&Err(err))); + assert!(should_attempt_oauth_fallback(&Err(Box::new(err)))); } #[test] @@ -751,7 +757,7 @@ mod tests { std::borrow::Cow::Borrowed("HTTP 401 Unauthorized"), ), ); - assert!(should_attempt_oauth_fallback(&Err(err))); + assert!(should_attempt_oauth_fallback(&Err(Box::new(err)))); } #[tokio::test] diff --git a/crates/goose/src/agents/mcp_client.rs b/crates/goose/src/agents/mcp_client.rs index 34e461250..8d1cf8478 100644 --- a/crates/goose/src/agents/mcp_client.rs +++ b/crates/goose/src/agents/mcp_client.rs @@ -507,7 +507,7 @@ impl McpClient { pub(crate) async fn connect( transport: T, ctx: ConnectContext, - ) -> Result + ) -> Result> where T: IntoTransport, E: std::error::Error + From + Send + Sync + 'static, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 100019730..8f624742d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.96.1" +channel = "1.99.0" profile = "default"