Skip to content

Commit 7ff6bc9

Browse files
committed
refactor(extensions): skip OAuth retry for UDS connections
oauth_flow() uses a standard reqwest::Client over TCP, so it can't reach authorization servers through a Unix domain socket. Replace the doomed retry with a clear warning log, which also removes the duplicated header construction that the retry path required.
1 parent 061cda9 commit 7ff6bc9

1 file changed

Lines changed: 6 additions & 46 deletions

File tree

crates/goose/src/agents/extension_manager.rs

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -581,53 +581,13 @@ async fn create_unix_socket_http_client(
581581
.await;
582582

583583
if should_attempt_oauth_fallback(&client_res) {
584-
match oauth_flow(&uri.to_string(), &name.to_string()).await {
585-
Ok(auth_manager) => {
586-
let retry_client = UnixSocketHttpClient::new(socket_path, uri);
587-
let auth_client = rmcp::transport::AuthClient::new(retry_client, auth_manager);
588-
589-
let mut retry_headers = std::collections::HashMap::<HeaderName, HeaderValue>::new();
590-
retry_headers.insert(
591-
HeaderName::from_static("user-agent"),
592-
GOOSE_USER_AGENT
593-
.to_str()
594-
.unwrap_or("goose")
595-
.parse()
596-
.unwrap_or_else(|_| HeaderValue::from_static("goose")),
597-
);
598-
// Re-add non-auth headers; AuthClient handles Authorization
599-
for (key, value) in headers {
600-
if key.eq_ignore_ascii_case("authorization") {
601-
continue;
602-
}
603-
if let (Ok(hn), Ok(hv)) =
604-
(HeaderName::try_from(key), value.parse::<HeaderValue>())
605-
{
606-
retry_headers.insert(hn, hv);
607-
}
608-
}
609-
610-
let retry_config = StreamableHttpClientTransportConfig::with_uri(uri)
611-
.custom_headers(retry_headers);
612-
let transport =
613-
StreamableHttpClientTransport::with_client(auth_client, retry_config);
614-
Ok(Box::new(
615-
McpClient::connect(
616-
transport,
617-
timeout_duration,
618-
provider,
619-
client_name,
620-
capabilities,
621-
roots_dir.to_path_buf(),
622-
)
623-
.await?,
624-
))
625-
}
626-
Err(_) => Ok(Box::new(client_res?)),
627-
}
628-
} else {
629-
Ok(Box::new(client_res?))
584+
tracing::warn!(
585+
"Extension '{}' returned 401 over Unix domain socket transport; \
586+
OAuth is not supported for UDS connections",
587+
name,
588+
);
630589
}
590+
Ok(Box::new(client_res?))
631591
}
632592

633593
impl ExtensionManager {

0 commit comments

Comments
 (0)