mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Connect Codex Desktop MCP over Unix sockets (#63497)
## Why An SSH forward can replace its Unix socket listener while the old keep-alive connection remains open. Reusing that connection can leave MCP requests waiting on the old listener. ## What changed Route `codex-desktop://<uuid>` endpoints to the corresponding Unix socket for local `codex_app` servers with explicit HTTP authorization. Allow `http_headers_helper` to supply supplemental headers while preserving the configured authorization. Socket requests bypass proxies, strip `Proxy-Authorization`, and disable redirects. Reuse pooled connections while the socket is unchanged and discard them when the listener is replaced or the socket disappears. ## Testing Add coverage for authenticated Desktop startup, rejection of helper-only authorization and other server names, and reconnection after socket replacement while the previous connection remains open. GitOrigin-RevId: a38e55d8cd726299506b487d1223fe64bd856e80
This commit is contained in:
@@ -79,6 +79,16 @@ pub(crate) struct RouteAwareHttpRequestRunner {
|
||||
}
|
||||
|
||||
impl RouteAwareHttpClient {
|
||||
/// HTTP over a local socket never follows redirects to another server.
|
||||
#[cfg(unix)]
|
||||
pub fn for_unix_socket(factory: HttpClientFactory, path: std::path::PathBuf) -> Self {
|
||||
let pool = RouteAwareClientPool::for_unix_socket(factory, path);
|
||||
Self {
|
||||
follow_redirects: pool.clone(),
|
||||
stop_redirects: pool,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(http_client_factory: HttpClientFactory) -> Self {
|
||||
Self {
|
||||
follow_redirects: RouteAwareClientPool::with_chatgpt_cloudflare_cookies_without_request_logging(
|
||||
|
||||
Reference in New Issue
Block a user