mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
refactor(exec-server): collapse managed network request state
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -191,9 +191,26 @@ fn exec_server_params_for_request(
|
||||
pipe_stdin: false,
|
||||
arg0: request.arg0.clone(),
|
||||
sandbox: request.exec_server_sandbox.clone(),
|
||||
enforce_managed_network: request.exec_server_enforce_managed_network,
|
||||
managed_network: request.exec_server_managed_network.clone(),
|
||||
network_proxy: request.exec_server_network_proxy.clone(),
|
||||
managed_network: exec_server_managed_network_for_request(request),
|
||||
}
|
||||
}
|
||||
|
||||
fn exec_server_managed_network_for_request(
|
||||
request: &ExecRequest,
|
||||
) -> codex_exec_server::ExecManagedNetwork {
|
||||
debug_assert!(
|
||||
request.exec_server_managed_network.is_none()
|
||||
|| request.exec_server_network_proxy.is_none(),
|
||||
"exec-server managed network sandbox facts and launch config must be mutually exclusive"
|
||||
);
|
||||
if let Some(network_proxy) = request.exec_server_network_proxy.clone() {
|
||||
codex_exec_server::ExecManagedNetwork::launch_proxy(network_proxy)
|
||||
} else if let Some(managed_network) = request.exec_server_managed_network.clone() {
|
||||
codex_exec_server::ExecManagedNetwork::existing_proxy(managed_network)
|
||||
} else if request.exec_server_enforce_managed_network {
|
||||
codex_exec_server::ExecManagedNetwork::enforce_without_proxy()
|
||||
} else {
|
||||
codex_exec_server::ExecManagedNetwork::disabled()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -183,8 +183,11 @@ fn exec_server_params_use_path_uri_and_env_policy_overlay_contract() {
|
||||
|
||||
assert_eq!(params.process_id.as_str(), "123");
|
||||
assert_eq!(params.cwd, request.cwd);
|
||||
assert!(params.enforce_managed_network);
|
||||
assert_eq!(params.managed_network, Some(managed_network));
|
||||
assert!(params.managed_network.enforce());
|
||||
assert_eq!(
|
||||
params.managed_network.sandbox_context(),
|
||||
Some(&managed_network)
|
||||
);
|
||||
assert!(params.env_policy.is_some());
|
||||
assert_eq!(
|
||||
params.env,
|
||||
|
||||
@@ -13,7 +13,9 @@ use codex_protocol::config_types::ShellEnvironmentPolicyInherit;
|
||||
use codex_shell_command::shell_detect::DetectedShell;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use serde::Deserialize;
|
||||
use serde::Deserializer;
|
||||
use serde::Serialize;
|
||||
use serde::Serializer;
|
||||
|
||||
use crate::ProcessId;
|
||||
|
||||
@@ -142,18 +144,165 @@ pub struct ExecParams {
|
||||
/// Portable sandbox intent. Concrete wrapper argv is resolved by the exec-server.
|
||||
#[serde(default)]
|
||||
pub sandbox: Option<FileSystemSandboxContext>,
|
||||
/// Whether the eventual executor-side sandbox must enforce managed networking.
|
||||
/// Managed-network intent. This serializes to the legacy `enforceManagedNetwork`,
|
||||
/// `managedNetwork`, and `networkProxy` fields, but Rust callers cannot set those
|
||||
/// independently.
|
||||
#[serde(flatten)]
|
||||
pub managed_network: ExecManagedNetwork,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ExecManagedNetwork {
|
||||
mode: ExecManagedNetworkMode,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
enum ExecManagedNetworkMode {
|
||||
Disabled,
|
||||
EnforceWithoutProxy,
|
||||
ExistingProxy(ManagedNetworkSandboxContext),
|
||||
LaunchProxy(Box<RemoteNetworkProxyLaunchConfig>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ExecManagedNetworkWire {
|
||||
#[serde(default)]
|
||||
pub enforce_managed_network: bool,
|
||||
/// Optional details for enforcing managed networking without a live proxy object.
|
||||
///
|
||||
/// When `enforce_managed_network` is true and these details are absent, the executor must
|
||||
/// continue to fail closed. This preserves compatibility with older clients.
|
||||
enforce_managed_network: bool,
|
||||
#[serde(default)]
|
||||
pub managed_network: Option<ManagedNetworkSandboxContext>,
|
||||
/// Optional instructions for starting an executor-local managed-network proxy.
|
||||
managed_network: Option<ManagedNetworkSandboxContext>,
|
||||
#[serde(default)]
|
||||
pub network_proxy: Option<RemoteNetworkProxyLaunchConfig>,
|
||||
network_proxy: Option<RemoteNetworkProxyLaunchConfig>,
|
||||
}
|
||||
|
||||
impl ExecManagedNetwork {
|
||||
pub fn disabled() -> Self {
|
||||
Self {
|
||||
mode: ExecManagedNetworkMode::Disabled,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enforce_without_proxy() -> Self {
|
||||
Self {
|
||||
mode: ExecManagedNetworkMode::EnforceWithoutProxy,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn existing_proxy(managed_network: ManagedNetworkSandboxContext) -> Self {
|
||||
Self {
|
||||
mode: ExecManagedNetworkMode::ExistingProxy(managed_network),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn launch_proxy(network_proxy: RemoteNetworkProxyLaunchConfig) -> Self {
|
||||
Self {
|
||||
mode: ExecManagedNetworkMode::LaunchProxy(Box::new(network_proxy)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_parts(
|
||||
enforce_managed_network: bool,
|
||||
managed_network: Option<ManagedNetworkSandboxContext>,
|
||||
network_proxy: Option<RemoteNetworkProxyLaunchConfig>,
|
||||
) -> Result<Self, String> {
|
||||
Self::try_from(ExecManagedNetworkWire {
|
||||
enforce_managed_network,
|
||||
managed_network,
|
||||
network_proxy,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn enforce(&self) -> bool {
|
||||
!matches!(self.mode, ExecManagedNetworkMode::Disabled)
|
||||
}
|
||||
|
||||
pub fn sandbox_context(&self) -> Option<&ManagedNetworkSandboxContext> {
|
||||
match &self.mode {
|
||||
ExecManagedNetworkMode::Disabled
|
||||
| ExecManagedNetworkMode::EnforceWithoutProxy
|
||||
| ExecManagedNetworkMode::LaunchProxy(_) => None,
|
||||
ExecManagedNetworkMode::ExistingProxy(managed_network) => Some(managed_network),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn launch_config(&self) -> Option<&RemoteNetworkProxyLaunchConfig> {
|
||||
match &self.mode {
|
||||
ExecManagedNetworkMode::Disabled
|
||||
| ExecManagedNetworkMode::EnforceWithoutProxy
|
||||
| ExecManagedNetworkMode::ExistingProxy(_) => None,
|
||||
ExecManagedNetworkMode::LaunchProxy(network_proxy) => Some(network_proxy.as_ref()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ExecManagedNetwork {
|
||||
fn default() -> Self {
|
||||
Self::disabled()
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<ExecManagedNetworkWire> for ExecManagedNetwork {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(wire: ExecManagedNetworkWire) -> Result<Self, Self::Error> {
|
||||
match (wire.enforce_managed_network, wire.managed_network, wire.network_proxy) {
|
||||
(_, Some(_), Some(_)) => Err(
|
||||
"`managedNetwork` sandbox facts and `networkProxy` launch config are mutually exclusive"
|
||||
.to_string(),
|
||||
),
|
||||
(_, None, Some(network_proxy)) => Ok(Self::launch_proxy(network_proxy)),
|
||||
(_, Some(managed_network), None) => Ok(Self::existing_proxy(managed_network)),
|
||||
(true, None, None) => Ok(Self::enforce_without_proxy()),
|
||||
(false, None, None) => Ok(Self::disabled()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ExecManagedNetwork> for ExecManagedNetworkWire {
|
||||
fn from(managed_network: &ExecManagedNetwork) -> Self {
|
||||
match &managed_network.mode {
|
||||
ExecManagedNetworkMode::Disabled => Self {
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
},
|
||||
ExecManagedNetworkMode::EnforceWithoutProxy => Self {
|
||||
enforce_managed_network: true,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
},
|
||||
ExecManagedNetworkMode::ExistingProxy(managed_network) => Self {
|
||||
enforce_managed_network: true,
|
||||
managed_network: Some(managed_network.clone()),
|
||||
network_proxy: None,
|
||||
},
|
||||
ExecManagedNetworkMode::LaunchProxy(network_proxy) => Self {
|
||||
enforce_managed_network: true,
|
||||
managed_network: None,
|
||||
network_proxy: Some((**network_proxy).clone()),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for ExecManagedNetwork {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
ExecManagedNetworkWire::from(self).serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for ExecManagedNetwork {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
ExecManagedNetworkWire::deserialize(deserializer)?
|
||||
.try_into()
|
||||
.map_err(serde::de::Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@@ -593,6 +742,7 @@ mod base64_bytes {
|
||||
mod tests {
|
||||
use super::EnvironmentInfo;
|
||||
use super::ExecExitedNotification;
|
||||
use super::ExecManagedNetwork;
|
||||
use super::ExecParams;
|
||||
use super::FsReadFileParams;
|
||||
use super::HttpRequestParams;
|
||||
@@ -610,7 +760,7 @@ mod tests {
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[test]
|
||||
fn exec_params_keeps_proxy_launch_separate_from_sandbox_facts() {
|
||||
fn exec_params_serializes_proxy_launch_as_legacy_wire_fields() {
|
||||
let cwd =
|
||||
PathUri::from_host_native_path(std::env::current_dir().expect("current directory"))
|
||||
.expect("cwd URI");
|
||||
@@ -624,12 +774,7 @@ mod tests {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: true,
|
||||
managed_network: Some(ManagedNetworkSandboxContext {
|
||||
loopback_ports: vec![43123, 48081],
|
||||
allow_local_binding: false,
|
||||
}),
|
||||
network_proxy: Some(
|
||||
managed_network: ExecManagedNetwork::launch_proxy(
|
||||
RemoteNetworkProxyLaunchConfig::new(
|
||||
RemoteNetworkProxyConfig::from_effective_config(&NetworkProxyConfig::default())
|
||||
.expect("supported remote config"),
|
||||
@@ -643,13 +788,8 @@ mod tests {
|
||||
};
|
||||
|
||||
let mut serialized = serde_json::to_value(¶ms).expect("serialize exec params");
|
||||
assert_eq!(
|
||||
serialized["managedNetwork"],
|
||||
serde_json::json!({
|
||||
"loopbackPorts": [43123, 48081],
|
||||
"allowLocalBinding": false,
|
||||
})
|
||||
);
|
||||
assert_eq!(serialized["enforceManagedNetwork"], serde_json::json!(true));
|
||||
assert_eq!(serialized["managedNetwork"], serde_json::json!(null));
|
||||
assert_eq!(
|
||||
serialized["networkProxy"]["auditMetadata"]["conversationId"],
|
||||
"conversation-1"
|
||||
@@ -658,19 +798,108 @@ mod tests {
|
||||
serde_json::from_value(serialized.clone()).expect("deserialize exec params");
|
||||
assert_eq!(round_trip, params);
|
||||
|
||||
serialized
|
||||
.as_object_mut()
|
||||
.expect("exec params object")
|
||||
.remove("managedNetwork");
|
||||
serialized
|
||||
.as_object_mut()
|
||||
.expect("exec params object")
|
||||
.remove("networkProxy");
|
||||
let legacy: ExecParams =
|
||||
serde_json::from_value(serialized).expect("deserialize legacy exec params");
|
||||
assert!(legacy.enforce_managed_network);
|
||||
assert_eq!(legacy.managed_network, None);
|
||||
assert_eq!(legacy.network_proxy, None);
|
||||
assert_eq!(
|
||||
legacy.managed_network,
|
||||
ExecManagedNetwork::enforce_without_proxy()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exec_params_serializes_existing_proxy_sandbox_facts_as_legacy_wire_fields() {
|
||||
let cwd =
|
||||
PathUri::from_host_native_path(std::env::current_dir().expect("current directory"))
|
||||
.expect("cwd URI");
|
||||
let sandbox_context = ManagedNetworkSandboxContext {
|
||||
loopback_ports: vec![43123, 48081],
|
||||
allow_local_binding: false,
|
||||
};
|
||||
let params = ExecParams {
|
||||
process_id: ProcessId::from("managed-network"),
|
||||
argv: vec!["true".to_string()],
|
||||
cwd,
|
||||
env_policy: None,
|
||||
env: HashMap::new(),
|
||||
tty: false,
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
managed_network: ExecManagedNetwork::existing_proxy(sandbox_context.clone()),
|
||||
};
|
||||
|
||||
let serialized = serde_json::to_value(¶ms).expect("serialize exec params");
|
||||
assert_eq!(
|
||||
serialized["managedNetwork"],
|
||||
serde_json::json!({
|
||||
"loopbackPorts": [43123, 48081],
|
||||
"allowLocalBinding": false,
|
||||
})
|
||||
);
|
||||
assert_eq!(serialized["networkProxy"], serde_json::json!(null));
|
||||
let round_trip: ExecParams =
|
||||
serde_json::from_value(serialized).expect("deserialize exec params");
|
||||
assert_eq!(round_trip, params);
|
||||
|
||||
let legacy = ExecManagedNetwork::from_parts(
|
||||
/*enforce_managed_network*/ false,
|
||||
Some(sandbox_context),
|
||||
/*network_proxy*/ None,
|
||||
)
|
||||
.expect("legacy managedNetwork facts imply enforcement");
|
||||
assert_eq!(legacy.enforce(), true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exec_params_defaults_missing_managed_network_fields_to_disabled() {
|
||||
let cwd =
|
||||
PathUri::from_host_native_path(std::env::current_dir().expect("current directory"))
|
||||
.expect("cwd URI");
|
||||
let params: ExecParams = serde_json::from_value(serde_json::json!({
|
||||
"processId": "legacy-without-managed-network",
|
||||
"argv": ["true"],
|
||||
"cwd": cwd,
|
||||
"env": {},
|
||||
"tty": false,
|
||||
"arg0": null,
|
||||
"sandbox": null
|
||||
}))
|
||||
.expect("deserialize legacy exec params");
|
||||
|
||||
assert_eq!(params.managed_network, ExecManagedNetwork::disabled());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exec_params_rejects_both_proxy_launch_and_existing_proxy_facts() {
|
||||
let cwd =
|
||||
PathUri::from_host_native_path(std::env::current_dir().expect("current directory"))
|
||||
.expect("cwd URI");
|
||||
let launch = RemoteNetworkProxyLaunchConfig::new(
|
||||
RemoteNetworkProxyConfig::from_effective_config(&NetworkProxyConfig::default())
|
||||
.expect("supported remote config"),
|
||||
)
|
||||
.for_execution("remote".to_string(), "execution-1".to_string());
|
||||
let result = serde_json::from_value::<ExecParams>(serde_json::json!({
|
||||
"processId": "invalid-managed-network",
|
||||
"argv": ["true"],
|
||||
"cwd": cwd,
|
||||
"env": {},
|
||||
"tty": false,
|
||||
"arg0": null,
|
||||
"sandbox": null,
|
||||
"enforceManagedNetwork": true,
|
||||
"managedNetwork": {
|
||||
"loopbackPorts": [43123],
|
||||
"allowLocalBinding": false,
|
||||
},
|
||||
"networkProxy": launch
|
||||
}));
|
||||
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1473,9 +1473,7 @@ mod tests {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: crate::protocol::ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.instrument(parent_span)
|
||||
.await
|
||||
|
||||
@@ -1174,9 +1174,7 @@ mod tests {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: crate::ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await
|
||||
.expect("start process");
|
||||
@@ -1215,9 +1213,7 @@ mod tests {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: Some(sandbox),
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: crate::ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await;
|
||||
let Err(err) = result else {
|
||||
|
||||
@@ -98,6 +98,7 @@ pub use protocol::EnvironmentInfo;
|
||||
pub use protocol::ExecClosedNotification;
|
||||
pub use protocol::ExecEnvPolicy;
|
||||
pub use protocol::ExecExitedNotification;
|
||||
pub use protocol::ExecManagedNetwork;
|
||||
pub use protocol::ExecOutputDeltaNotification;
|
||||
pub use protocol::ExecOutputStream;
|
||||
pub use protocol::ExecParams;
|
||||
|
||||
@@ -257,8 +257,8 @@ impl LocalProcess {
|
||||
) -> Result<(ExecResponse, watch::Sender<u64>, ExecProcessEventLog), JSONRPCErrorError> {
|
||||
let process_id = params.process_id.clone();
|
||||
let network_policy_decider = params
|
||||
.network_proxy
|
||||
.as_ref()
|
||||
.managed_network
|
||||
.launch_config()
|
||||
.is_some_and(|launch| launch.proxy.request_policy_decisions)
|
||||
.then(|| {
|
||||
self.inner
|
||||
@@ -1057,9 +1057,7 @@ mod tests {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: crate::ExecManagedNetwork::disabled(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ pub(crate) async fn prepare_exec_request(
|
||||
network_policy_decider: Option<Arc<dyn NetworkPolicyDecider>>,
|
||||
) -> Result<PreparedExecRequest, JSONRPCErrorError> {
|
||||
let (env, managed_network, network_proxy_handle) = prepare_managed_network(
|
||||
params.managed_network.as_ref(),
|
||||
params.network_proxy.as_ref(),
|
||||
params.managed_network.sandbox_context(),
|
||||
params.managed_network.launch_config(),
|
||||
env,
|
||||
network_policy_decider,
|
||||
)
|
||||
@@ -101,7 +101,7 @@ pub(crate) async fn prepare_exec_request(
|
||||
network_policy,
|
||||
SandboxablePreference::Require,
|
||||
sandbox_context.windows_sandbox_level,
|
||||
params.enforce_managed_network,
|
||||
params.managed_network.enforce(),
|
||||
);
|
||||
match sandbox {
|
||||
SandboxType::None => {
|
||||
@@ -140,7 +140,7 @@ pub(crate) async fn prepare_exec_request(
|
||||
},
|
||||
permissions: &permissions,
|
||||
sandbox,
|
||||
enforce_managed_network: params.enforce_managed_network,
|
||||
enforce_managed_network: params.managed_network.enforce(),
|
||||
environment_id: None,
|
||||
network: None,
|
||||
sandbox_policy_cwd,
|
||||
|
||||
@@ -17,6 +17,7 @@ use tokio::io::AsyncWriteExt;
|
||||
use tokio::time::timeout;
|
||||
|
||||
use super::prepare_exec_request;
|
||||
use crate::ExecManagedNetwork;
|
||||
use crate::ExecParams;
|
||||
#[cfg(unix)]
|
||||
use crate::ExecServerRuntimePaths;
|
||||
@@ -53,9 +54,7 @@ async fn sandbox_request_wraps_native_argv_on_executor() {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: Some(sandbox),
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
};
|
||||
|
||||
let prepared = prepare_exec_request(
|
||||
@@ -121,12 +120,10 @@ async fn sandbox_request_allows_prepared_managed_proxy_port() {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: Some(sandbox),
|
||||
enforce_managed_network: true,
|
||||
managed_network: Some(ManagedNetworkSandboxContext {
|
||||
managed_network: ExecManagedNetwork::existing_proxy(ManagedNetworkSandboxContext {
|
||||
loopback_ports: vec![43123],
|
||||
allow_local_binding: false,
|
||||
}),
|
||||
network_proxy: None,
|
||||
};
|
||||
|
||||
let prepared = prepare_exec_request(
|
||||
@@ -164,9 +161,7 @@ async fn native_request_preserves_native_launch_fields() {
|
||||
pipe_stdin: false,
|
||||
arg0: Some("custom-arg0".to_string()),
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
};
|
||||
|
||||
let prepared = prepare_exec_request(
|
||||
@@ -207,9 +202,7 @@ async fn remote_proxy_config_starts_executor_local_proxy() {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: Some(
|
||||
managed_network: ExecManagedNetwork::launch_proxy(
|
||||
RemoteNetworkProxyLaunchConfig::new(proxy_config)
|
||||
.for_execution("remote".to_string(), "execution-1".to_string()),
|
||||
),
|
||||
|
||||
@@ -10,6 +10,7 @@ use uuid::Uuid;
|
||||
use super::ExecServerHandler;
|
||||
use crate::ExecServerRuntimePaths;
|
||||
use crate::ProcessId;
|
||||
use crate::protocol::ExecManagedNetwork;
|
||||
use crate::protocol::ExecParams;
|
||||
use crate::protocol::InitializeParams;
|
||||
use crate::protocol::ReadParams;
|
||||
@@ -35,9 +36,7 @@ fn exec_params_with_argv(process_id: &str, argv: Vec<String>) -> ExecParams {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -745,9 +745,7 @@ mod tests {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: crate::protocol::ExecManagedNetwork::disabled(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use codex_exec_server::Environment;
|
||||
use codex_exec_server::ExecBackend;
|
||||
use codex_exec_server::ExecManagedNetwork;
|
||||
use codex_exec_server::ExecOutputStream;
|
||||
use codex_exec_server::ExecParams;
|
||||
use codex_exec_server::ExecProcess;
|
||||
@@ -82,9 +83,7 @@ async fn assert_exec_process_starts_and_exits(use_remote: bool) -> Result<()> {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), "proc-1");
|
||||
@@ -228,9 +227,7 @@ async fn assert_exec_process_streams_output(use_remote: bool) -> Result<()> {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -263,9 +260,7 @@ async fn assert_exec_process_pushes_events(use_remote: bool) -> Result<()> {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -314,9 +309,7 @@ async fn assert_exec_process_replays_events_after_close(use_remote: bool) -> Res
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -366,9 +359,7 @@ async fn assert_exec_process_retains_output_after_exit_until_streams_close(
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -443,9 +434,7 @@ async fn assert_exec_process_write_then_read(use_remote: bool) -> Result<()> {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -484,9 +473,7 @@ async fn assert_exec_process_write_then_read_without_tty(use_remote: bool) -> Re
|
||||
pipe_stdin: true,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -521,9 +508,7 @@ async fn assert_exec_process_rejects_write_without_pipe_stdin(use_remote: bool)
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -559,9 +544,7 @@ async fn assert_exec_process_signal_interrupts_process(use_remote: bool) -> Resu
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(session.process.process_id().as_str(), process_id);
|
||||
@@ -616,9 +599,7 @@ async fn assert_exec_process_signal_reports_unsupported_on_windows(use_remote: b
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -660,9 +641,7 @@ async fn assert_exec_process_preserves_queued_events_before_subscribe(
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -722,9 +701,7 @@ async fn remote_exec_process_recovers_after_transport_disconnect() -> Result<()>
|
||||
pipe_stdin: true,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use anyhow::Result;
|
||||
use base64::Engine as _;
|
||||
use base64::engine::general_purpose::STANDARD;
|
||||
use codex_api::AuthProvider;
|
||||
use codex_exec_server::ExecManagedNetwork;
|
||||
use codex_exec_server::ExecParams;
|
||||
use codex_exec_server::ExecResponse;
|
||||
use codex_exec_server::ExecServerClient;
|
||||
@@ -151,9 +152,7 @@ async fn remote_environment_routes_encrypted_exec_server_rpc() -> Result<()> {
|
||||
pipe_stdin: false,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(
|
||||
|
||||
@@ -33,6 +33,7 @@ use anyhow::anyhow;
|
||||
use codex_config::types::McpServerEnvVar;
|
||||
use codex_exec_server::ExecBackend;
|
||||
use codex_exec_server::ExecEnvPolicy;
|
||||
use codex_exec_server::ExecManagedNetwork;
|
||||
use codex_exec_server::ExecParams;
|
||||
use codex_exec_server::ExecProcess;
|
||||
use codex_protocol::config_types::ShellEnvironmentPolicyInherit;
|
||||
@@ -508,9 +509,7 @@ impl ExecutorStdioServerLauncher {
|
||||
pipe_stdin: true,
|
||||
arg0: None,
|
||||
sandbox: None,
|
||||
enforce_managed_network: false,
|
||||
managed_network: None,
|
||||
network_proxy: None,
|
||||
managed_network: ExecManagedNetwork::disabled(),
|
||||
})
|
||||
.await
|
||||
.map_err(io::Error::other)?;
|
||||
|
||||
Reference in New Issue
Block a user