diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index 47a6c7daa5..71a5ae41bf 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -748,7 +748,6 @@ fn default_network_proxy_config() -> NetworkProxyConfig { .iter() .map(|entry| (*entry).to_string()) .collect(), - prompt_on_block: true, poll_interval_ms: 1000, mitm_ca_cert_path: None, } @@ -783,9 +782,6 @@ fn resolve_network_proxy_config(cfg: &ConfigToml, codex_home: &Path) -> NetworkP resolved.no_proxy = normalize_no_proxy_entries(no_proxy); } ensure_default_no_proxy_entries(&mut resolved.no_proxy); - if let Some(prompt_on_block) = network_proxy.prompt_on_block { - resolved.prompt_on_block = prompt_on_block; - } if let Some(poll_interval_ms) = network_proxy.poll_interval_ms && poll_interval_ms > 0 { diff --git a/codex-rs/core/src/config/types.rs b/codex-rs/core/src/config/types.rs index c6842b2f4a..f83597fc67 100644 --- a/codex-rs/core/src/config/types.rs +++ b/codex-rs/core/src/config/types.rs @@ -451,7 +451,6 @@ pub struct NetworkProxyConfigToml { pub admin_url: Option, pub mode: Option, pub no_proxy: Option>, - pub prompt_on_block: Option, pub poll_interval_ms: Option, #[serde(default)] pub mitm: Option, @@ -473,7 +472,6 @@ pub struct NetworkProxyConfig { pub admin_url: String, pub mode: NetworkProxyMode, pub no_proxy: Vec, - pub prompt_on_block: bool, pub poll_interval_ms: i64, pub mitm_ca_cert_path: Option, } diff --git a/codex-rs/core/src/exec_env.rs b/codex-rs/core/src/exec_env.rs index d7e389c0bf..79cd9bbfc0 100644 --- a/codex-rs/core/src/exec_env.rs +++ b/codex-rs/core/src/exec_env.rs @@ -447,7 +447,6 @@ mod tests { admin_url: "http://localhost:8080".to_string(), mode: NetworkProxyMode::Full, no_proxy: vec!["localhost".to_string(), "127.0.0.1".to_string()], - prompt_on_block: true, poll_interval_ms: 1000, mitm_ca_cert_path: None, }; diff --git a/codex-rs/core/src/network_proxy.rs b/codex-rs/core/src/network_proxy.rs index d5bc05f897..6f0d1c1cd7 100644 --- a/codex-rs/core/src/network_proxy.rs +++ b/codex-rs/core/src/network_proxy.rs @@ -221,7 +221,7 @@ pub fn should_preflight_network( network_proxy: &NetworkProxyConfig, sandbox_policy: &SandboxPolicy, ) -> bool { - if !network_proxy.enabled || !network_proxy.prompt_on_block { + if !network_proxy.enabled { return false; } match sandbox_policy { diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index 8b63441aaf..33a68290b2 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -456,7 +456,7 @@ impl App { unix_socket_session_restore: HashSet::new(), }; - if app.config.network_proxy.enabled && app.config.network_proxy.prompt_on_block { + if app.config.network_proxy.enabled && app.config.sandbox_policy.has_full_network_access() { Self::spawn_network_proxy_poller( app.config.network_proxy.clone(), app.app_event_tx.clone(), @@ -1213,7 +1213,7 @@ impl App { } }, AppEvent::NetworkProxyApprovalRequest(request) => { - if !self.config.network_proxy.prompt_on_block { + if !self.config.network_proxy.enabled { return Ok(true); } let host = request.host.trim().to_string(); @@ -1252,7 +1252,7 @@ impl App { self.chat_widget.on_network_approval_request(request); } AppEvent::UnixSocketApprovalRequest(request) => { - if !self.config.network_proxy.prompt_on_block { + if !self.config.network_proxy.enabled { return Ok(true); } let socket_path = request.socket_path.trim().to_string(); @@ -1575,7 +1575,7 @@ impl App { } fn spawn_network_proxy_poller(network_proxy: NetworkProxyConfig, tx: AppEventSender) { - if !network_proxy.enabled || !network_proxy.prompt_on_block { + if !network_proxy.enabled { return; } let poll_interval_ms = if network_proxy.poll_interval_ms > 0 { diff --git a/docs/config.md b/docs/config.md index 1a6ee06ca5..659b5bb4b8 100644 --- a/docs/config.md +++ b/docs/config.md @@ -370,7 +370,6 @@ no_proxy = [ "172.16.0.0/12", "192.168.0.0/16", ] -prompt_on_block = true poll_interval_ms = 1000 ``` @@ -381,7 +380,7 @@ Notes: - When `proxy_url` points at localhost, Codex also assumes a SOCKS5 proxy on `localhost:8081` for `ALL_PROXY`, `GRPC_PROXY`, `FTP_PROXY`, `RSYNC_PROXY`, and (macOS only) `GIT_SSH_COMMAND`. - `no_proxy` entries bypass the proxy; defaults include localhost + private network ranges. Use sparingly because bypassed traffic is not filtered by the proxy policy. - `[network_proxy.policy]` can optionally allow localhost binding or Unix socket access (macOS only) when proxy-restricted network access is active. -- When `prompt_on_block = true`, Codex polls the proxy admin API (`/blocked`) and surfaces a prompt to allow for the session, allow always (add to allowlist), or deny (add to denylist). Allow/deny decisions update `~/.codex/config.toml` under `[network_proxy.policy]`, then Codex calls `/reload`. +- When enabled, Codex polls the proxy admin API (`/blocked`) and surfaces a prompt to allow for the session, allow always (add to allowlist), or deny (add to denylist). Allow/deny decisions update `~/.codex/config.toml` under `[network_proxy.policy]`, then Codex calls `/reload`. - On macOS, `network_proxy.policy.allow_unix_sockets` is useful for local IPC that relies on Unix domain sockets (most commonly the SSH agent). Entries can be: - absolute socket paths (or directories containing sockets), - `$SSH_AUTH_SOCK` / `${SSH_AUTH_SOCK}`, @@ -984,7 +983,6 @@ Valid values: | `network_proxy.admin_url` | string | Proxy admin API base URL (default: `http://127.0.0.1:8080`). | | `network_proxy.mode` | `limited` \| `full` | Default proxy mode for policy hints (default: `full`). | | `network_proxy.no_proxy` | array | Hosts/IPs that bypass the proxy (default includes localhost + private network ranges). | -| `network_proxy.prompt_on_block` | boolean | Poll `/blocked` and prompt on denied requests (default: true). | | `network_proxy.poll_interval_ms` | number | Admin poll interval in ms (default: 1000). | | `network_proxy.policy.allowed_domains` | array | Allowlist of domain patterns (denylist takes precedence). | | `network_proxy.policy.denied_domains` | array | Denylist of domain patterns (takes precedence over allowlist). | diff --git a/docs/example-config.md b/docs/example-config.md index a1505fb41d..ecfe1f3ed4 100644 --- a/docs/example-config.md +++ b/docs/example-config.md @@ -124,9 +124,7 @@ no_proxy = [ "172.16.0.0/12", "192.168.0.0/16", ] -# Poll proxy /blocked and prompt the user. Default: true -prompt_on_block = true -# Poll interval in milliseconds. Default: 1000 +# Poll interval (ms) for checking proxy /blocked. Default: 1000 poll_interval_ms = 1000 [network_proxy.policy] diff --git a/docs/network-proxy-quickstart.md b/docs/network-proxy-quickstart.md index c6d8f31458..9949f64b6e 100644 --- a/docs/network-proxy-quickstart.md +++ b/docs/network-proxy-quickstart.md @@ -27,7 +27,6 @@ enabled = true proxy_url = "http://127.0.0.1:3128" admin_url = "http://127.0.0.1:8080" mode = "limited" # or "full" -prompt_on_block = true poll_interval_ms = 1000 [network_proxy.policy] diff --git a/docs/sandbox.md b/docs/sandbox.md index 2cc2eb5747..2ef53f3109 100644 --- a/docs/sandbox.md +++ b/docs/sandbox.md @@ -61,7 +61,7 @@ Codex can optionally route outbound network traffic through a proxy and prompt y Key behaviors: - The OS sandbox is still the first line of defense. If network access is disabled, outbound requests are blocked at the OS level. -- When network is enabled and `network_proxy.prompt_on_block = true`, Codex polls the proxy admin API (`/blocked`) and immediately notifies you about blocked domains. +- When network is enabled and `network_proxy.enabled = true`, Codex polls the proxy admin API (`/blocked`) and immediately notifies you about blocked domains. - For exec commands that include HTTP/HTTPS URLs, Codex preflights the host against the proxy config and prompts before running the command. - Approvals update `~/.codex/config.toml` under `[network_proxy.policy]` and trigger a proxy reload. - You can choose to: