mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
## What changed - Register an additional Cloud connection on supported macOS and Linux launches when `TuiMultiBackend` is enabled, using the selected ChatGPT account and local network policy. - Preserve backend settings and identify Cloud in connection controls and status. - Let Cloud supply the model when a thread opens, skip local skills requests and stale results, and allow resume without a local working-directory override. - Preserve Git metadata in Cloud thread snapshots and continue history hydration past empty filtered pages within the scan budget. - Report Cloud connection failures and require reopening Codex to reconnect. ## Testing Add regression coverage for Cloud model bootstrap, skipped skills requests, resume directory handling, history pagination through filtered pages, and Git metadata preservation. GitOrigin-RevId: 6717f0f5ad7708c5e9b5796d94711dd1eecc49bb
54 lines
2.3 KiB
Rust
54 lines
2.3 KiB
Rust
//! Applies the selected server's socket policy on initial connections and reconnects.
|
|
|
|
use crate::AppServerTarget;
|
|
#[cfg(windows)]
|
|
use crate::DEFAULT_IN_PROCESS_CHANNEL_CAPACITY;
|
|
use crate::connect_remote_app_server;
|
|
use codex_app_server_client::AppServerClient;
|
|
#[cfg(windows)]
|
|
use codex_app_server_client::RemoteAppServerClient;
|
|
#[cfg(windows)]
|
|
use codex_app_server_client::RemoteAppServerConnectArgs;
|
|
#[cfg(windows)]
|
|
use codex_app_server_client::RemoteAppServerEndpoint;
|
|
#[cfg(windows)]
|
|
use codex_utils_absolute_path::AbsolutePathBuf;
|
|
|
|
pub(crate) async fn connect(target: &AppServerTarget) -> color_eyre::Result<AppServerClient> {
|
|
match target {
|
|
AppServerTarget::Cloud => {
|
|
color_eyre::eyre::bail!("Reopen Codex to reconnect the cloud backend.");
|
|
}
|
|
AppServerTarget::Embedded => {
|
|
color_eyre::eyre::bail!("embedded sessions have no remote connection")
|
|
}
|
|
#[cfg(windows)]
|
|
AppServerTarget::LocalDaemon {
|
|
endpoint: RemoteAppServerEndpoint::UnixSocket { socket_path },
|
|
..
|
|
} => {
|
|
// Revalidate at the real connection, not just the earlier discovery probe.
|
|
let (socket_path, _directory) =
|
|
codex_uds::validate_private_socket_path(socket_path.as_path())?;
|
|
let app_server =
|
|
RemoteAppServerClient::connect_local_daemon(RemoteAppServerConnectArgs {
|
|
required_human_approval: true,
|
|
endpoint: RemoteAppServerEndpoint::UnixSocket {
|
|
socket_path: AbsolutePathBuf::from_absolute_path_checked(socket_path)?,
|
|
},
|
|
client_name: "codex-tui".to_string(),
|
|
client_version: env!("CARGO_PKG_VERSION").to_string(),
|
|
experimental_api: true,
|
|
mcp_server_openai_form_elicitation: false,
|
|
opt_out_notification_methods: Vec::new(),
|
|
channel_capacity: DEFAULT_IN_PROCESS_CHANNEL_CAPACITY,
|
|
})
|
|
.await?;
|
|
Ok(AppServerClient::Remote(app_server))
|
|
}
|
|
AppServerTarget::LocalDaemon { endpoint, .. } | AppServerTarget::Remote { endpoint } => {
|
|
connect_remote_app_server(endpoint.clone()).await
|
|
}
|
|
}
|
|
}
|