Lightweight coding agent that runs in your terminal
Rust
Separate Windows sandbox implementations from legacy setup modes (#45737)
iceweasel-oaifbad00774bba
diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.jsonindex 813df4d7f3..2863a575a9 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json@@ -9876,7 +9876,7 @@},"allowedWindowsSandboxImplementations": {"items": {- "$ref": "#/definitions/v2/WindowsSandboxSetupMode"+ "$ref": "#/definitions/v2/WindowsSandboxImplementation"},"type": ["array",@@ -25791,6 +25791,14 @@},"type": "object"},+ "WindowsSandboxImplementation": {+ "enum": [+ "elevated",+ "unelevated",+ "mxc"+ ],+ "type": "string"+ },"WindowsSandboxReadiness": {"enum": ["ready",diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.jsonindex 0e4c577b0c..c0787c3bfb 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json@@ -5756,7 +5756,7 @@},"allowedWindowsSandboxImplementations": {"items": {- "$ref": "#/definitions/WindowsSandboxSetupMode"+ "$ref": "#/definitions/WindowsSandboxImplementation"},"type": ["array",@@ -23505,6 +23505,14 @@},"type": "object"},+ "WindowsSandboxImplementation": {+ "enum": [+ "elevated",+ "unelevated",+ "mxc"+ ],+ "type": "string"+ },"WindowsSandboxReadiness": {"enum": ["ready",diff --git a/codex-rs/app-server-protocol/schema/json/v2/ConfigRequirementsReadResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ConfigRequirementsReadResponse.jsonindex e707867d44..7bf114cb95 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ConfigRequirementsReadResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ConfigRequirementsReadResponse.json@@ -453,7 +453,7 @@},"allowedWindowsSandboxImplementations": {"items": {- "$ref": "#/definitions/WindowsSandboxSetupMode"+ "$ref": "#/definitions/WindowsSandboxImplementation"},"type": ["array",@@ -1085,10 +1085,11 @@],"type": "string"},- "WindowsSandboxSetupMode": {+ "WindowsSandboxImplementation": {"enum": ["elevated",- "unelevated"+ "unelevated",+ "mxc"],"type": "string"}diff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zstindex 79d6a3dfb1..7b2430db77 100644Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst differdiff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zstindex 14bdda9860..e720fc5288 100644Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst differdiff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ConfigRequirements.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ConfigRequirements.tsindex c1fe73f083..b40f98df61 100644--- a/codex-rs/app-server-protocol/schema/typescript/v2/ConfigRequirements.ts+++ b/codex-rs/app-server-protocol/schema/typescript/v2/ConfigRequirements.ts@@ -15,7 +15,7 @@ import type { InAppBrowserRequirements } from "./InAppBrowserRequirements";import type { ModelsRequirements } from "./ModelsRequirements";import type { ResidencyRequirement } from "./ResidencyRequirement";import type { SandboxMode } from "./SandboxMode";-import type { WindowsSandboxSetupMode } from "./WindowsSandboxSetupMode";+import type { WindowsSandboxImplementation } from "./WindowsSandboxImplementation";export type ConfigRequirements = {/*** Exact provider selection required by managed policy.@@ -27,4 +27,4 @@ modelProviders: { [key in string]?: JsonValue } | null, /*** Effective login methods after managed, forced-login, and workspace restrictions.* An empty list permits no login method. Older servers may omit this field.*/-allowedLoginMethods: Array<ForcedLoginMethod> | null, cliAuthCredentialsStore: CliAuthCredentialsStoreMode | null, chatgptBaseUrl: string | null, additionalDeveloperInstructions: string | null, allowedApprovalPolicies: Array<AskForApproval> | null, allowedSandboxModes: Array<SandboxMode> | null, allowedWindowsSandboxImplementations: Array<WindowsSandboxSetupMode> | null, allowedPermissionProfiles: { [key in string]?: boolean } | null, defaultPermissions: string | null, allowedWebSearchModes: Array<WebSearchMode> | null, allowManagedHooksOnly: boolean | null, allowBrowserAndComputerUse: boolean | null, allowAppshots: boolean | null, allowRemoteControl: boolean | null, computerUse: ComputerUseRequirements | null, browserUse: BrowserUseRequirements | null, inAppBrowser: InAppBrowserRequirements | null, featureRequirements: { [key in string]?: boolean } | null, enforceResidency: ResidencyRequirement | null, autoReview: AutoReviewRequirements | null, models: ModelsRequirements | null, sqliteHome: PathUri | null, logDir: PathUri | null, modelCatalogJson: PathUri | null, checkForUpdateOnStartup: boolean | null, allowLoginShell: boolean | null, feedback: FeedbackRequirements | null, windowsSandboxPrivateDesktop: boolean | null};+allowedLoginMethods: Array<ForcedLoginMethod> | null, cliAuthCredentialsStore: CliAuthCredentialsStoreMode | null, chatgptBaseUrl: string | null, additionalDeveloperInstructions: string | null, allowedApprovalPolicies: Array<AskForApproval> | null, allowedSandboxModes: Array<SandboxMode> | null, allowedWindowsSandboxImplementations: Array<WindowsSandboxImplementation> | null, allowedPermissionProfiles: { [key in string]?: boolean } | null, defaultPermissions: string | null, allowedWebSearchModes: Array<WebSearchMode> | null, allowManagedHooksOnly: boolean | null, allowBrowserAndComputerUse: boolean | null, allowAppshots: boolean | null, allowRemoteControl: boolean | null, computerUse: ComputerUseRequirements | null, browserUse: BrowserUseRequirements | null, inAppBrowser: InAppBrowserRequirements | null, featureRequirements: { [key in string]?: boolean } | null, enforceResidency: ResidencyRequirement | null, autoReview: AutoReviewRequirements | null, models: ModelsRequirements | null, sqliteHome: PathUri | null, logDir: PathUri | null, modelCatalogJson: PathUri | null, checkForUpdateOnStartup: boolean | null, allowLoginShell: boolean | null, feedback: FeedbackRequirements | null, windowsSandboxPrivateDesktop: boolean | null};diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/WindowsSandboxImplementation.ts b/codex-rs/app-server-protocol/schema/typescript/v2/WindowsSandboxImplementation.tsnew file mode 100644index 0000000000..8859663ea4--- /dev/null+++ b/codex-rs/app-server-protocol/schema/typescript/v2/WindowsSandboxImplementation.ts@@ -0,0 +1,5 @@+// GENERATED CODE! DO NOT MODIFY BY HAND!++// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.++export type WindowsSandboxImplementation = "elevated" | "unelevated" | "mxc";diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/codex-rs/app-server-protocol/schema/typescript/v2/index.tsindex e5b2a0c7a3..7e563b483f 100644--- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts+++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts@@ -616,6 +616,7 @@ export type { TurnsPage } from "./TurnsPage";export type { UserInput } from "./UserInput";export type { WarningNotification } from "./WarningNotification";export type { WebSearchAction } from "./WebSearchAction";+export type { WindowsSandboxImplementation } from "./WindowsSandboxImplementation";export type { WindowsSandboxReadiness } from "./WindowsSandboxReadiness";export type { WindowsSandboxReadinessResponse } from "./WindowsSandboxReadinessResponse";export type { WindowsSandboxSetupCompletedNotification } from "./WindowsSandboxSetupCompletedNotification";diff --git a/codex-rs/app-server-protocol/src/protocol/v2/config.rs b/codex-rs/app-server-protocol/src/protocol/v2/config.rsindex 160b758317..54c6c91cd3 100644--- a/codex-rs/app-server-protocol/src/protocol/v2/config.rs+++ b/codex-rs/app-server-protocol/src/protocol/v2/config.rs@@ -4,7 +4,7 @@ use super::AskForApproval;use super::BrowserUseConfig;use super::ComputerUseConfig;use super::SandboxMode;-use super::WindowsSandboxSetupMode;+use super::WindowsSandboxImplementation;use super::shared::default_enabled;use crate::JsonSchema;use crate::TS;@@ -423,7 +423,7 @@ pub struct ConfigRequirements {#[experimental("configRequirements/read.allowedApprovalsReviewers")]pub allowed_approvals_reviewers: Option<Vec<ApprovalsReviewer>>,pub allowed_sandbox_modes: Option<Vec<SandboxMode>>,- pub allowed_windows_sandbox_implementations: Option<Vec<WindowsSandboxSetupMode>>,+ pub allowed_windows_sandbox_implementations: Option<Vec<WindowsSandboxImplementation>>,pub allowed_permission_profiles: Option<BTreeMap<String, bool>>,pub default_permissions: Option<String>,pub allowed_web_search_modes: Option<Vec<WebSearchMode>>,diff --git a/codex-rs/app-server-protocol/src/protocol/v2/windows_sandbox.rs b/codex-rs/app-server-protocol/src/protocol/v2/windows_sandbox.rsindex 1cc240a95e..99df51f41c 100644--- a/codex-rs/app-server-protocol/src/protocol/v2/windows_sandbox.rs+++ b/codex-rs/app-server-protocol/src/protocol/v2/windows_sandbox.rs@@ -21,6 +21,15 @@ pub enum WindowsSandboxSetupMode {Unelevated,}+#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]+#[serde(rename_all = "camelCase")]+#[ts(rename_all = "camelCase", export_to = "v2/")]+pub enum WindowsSandboxImplementation {+ Elevated,+ Unelevated,+ Mxc,+}+#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]#[serde(rename_all = "camelCase")]#[ts(export_to = "v2/")]diff --git a/codex-rs/app-server/README.md b/codex-rs/app-server/README.mdindex 3af8716a16..362b1fe968 100644--- a/codex-rs/app-server/README.md+++ b/codex-rs/app-server/README.md@@ -245,3 +245,16 @@ The experimental `account/read.workspaceRouting` response field returns the seleApp-server discovers routing for saved ChatGPT logins at startup and for new logins or workspace switches. After requirements and routing are ready, it sends the existing `account/updated` notification. Newly initialized connections also receive this notification once saved-workspace routing is ready, including when discovery finished before the connection initialized. Clients then reread `configRequirements/read` and `account/read`. Saved ChatGPT credentials without a selected workspace ID retain their account information and return `workspaceRouting: null`; app-server does not guess a workspace from the backend's default account. Discovery failures for a selected workspace, including missing or null fields from older backends, return an `account/read` error. They never produce a successful unrestricted result. A later read retries failed discovery. Logout clears the cached routing, and results from earlier authentication owners are discarded. Token refreshes for the same known user and workspace invalidate cached routing without cancelling discovery or failing sign-in. Configuration is reloaded after discovery; a changed backend, model provider, or required backend rejects the result so the next read discovers against current configuration. Account notifications recheck the auth owner generation after waiting for outbound queue capacity. Superseded sign-in attempts emit a failed `account/login/completed` event instead of silently dropping completion. Notifications remain snapshots: clients reread current account and requirements state rather than treating a queued notification as authorization.The origin of a required `chatgpt_base_url` must match the discovered origin by scheme, host, and effective port. The base URL's API path is not part of this comparison. Either origin alone is sufficient. If requirements specify no base URL and discovery explicitly returns `NO_CONSTRAINT`, the effective `chatgpt_base_url` supplies the origin, including its existing default. `backendOrigin` is always a resolved origin; `accountRoutingOverride` preserves `NO_CONSTRAINT` when the backend explicitly returns it. Discovering an origin does not change API paths or apply routing headers to requests.++## Windows sandbox implementation selection++`windowsSandbox/setupStart` and `windowsSandbox/readiness` apply only to the+legacy `elevated` and `unelevated` backends. Clients resolve the desired sandbox+implementation from configuration. When it is `mxc`, they skip both methods;+`allowedWindowsSandboxImplementations` can allow `mxc` independently of the+legacy setup modes. Non-Windows hosts report `notConfigured` for the legacy+readiness API.++MXC uses the standard `command/exec` streaming and process-control path, including+ConPTY when `tty` is enabled. The buffered legacy Windows sandbox restrictions on+process control and custom output caps do not apply to MXC.diff --git a/codex-rs/app-server/src/request_processors/config_processor.rs b/codex-rs/app-server/src/request_processors/config_processor.rsindex 77730bc619..b6b5348ede 100644--- a/codex-rs/app-server/src/request_processors/config_processor.rs+++ b/codex-rs/app-server/src/request_processors/config_processor.rs@@ -41,7 +41,7 @@ use codex_app_server_protocol::NetworkRequirements;use codex_app_server_protocol::NetworkUnixSocketPermission;use codex_app_server_protocol::NewThreadModelDefaults;use codex_app_server_protocol::SandboxMode;-use codex_app_server_protocol::WindowsSandboxSetupMode;+use codex_app_server_protocol::WindowsSandboxImplementation;use codex_config::ConfigRequirementsToml;use codex_config::HookEventsToml;use codex_config::HookHandlerConfig as CoreHookHandlerConfig;@@ -470,10 +470,10 @@ fn map_requirements_to_api(.into_iter().map(|implementation| match implementation {codex_config::types::WindowsSandboxModeToml::Elevated => {- WindowsSandboxSetupMode::Elevated+ WindowsSandboxImplementation::Elevated}codex_config::types::WindowsSandboxModeToml::Unelevated => {- WindowsSandboxSetupMode::Unelevated+ WindowsSandboxImplementation::Unelevated}}).collect()@@ -854,7 +854,7 @@ mod tests {use codex_app_server_protocol::ComputerUseWindowsExeRequirement;use codex_app_server_protocol::ComputerUseWindowsRequirements;use codex_app_server_protocol::FeedbackRequirements;- use codex_app_server_protocol::WindowsSandboxSetupMode;+ use codex_app_server_protocol::WindowsSandboxImplementation;use codex_config::AllowDenyRequirementToml;use codex_config::AutoReviewRequirementsToml;use codex_config::BrowserUseAccessApprovalLifetimeToml;@@ -1110,8 +1110,8 @@ mod tests {assert_eq!(mapped.allowed_windows_sandbox_implementations,Some(vec![- WindowsSandboxSetupMode::Elevated,- WindowsSandboxSetupMode::Unelevated,+ WindowsSandboxImplementation::Elevated,+ WindowsSandboxImplementation::Unelevated,]));assert_eq!(mapped.windows_sandbox_private_desktop, Some(false));diff --git a/sdk/python/src/openai_codex/generated/v2_all.py b/sdk/python/src/openai_codex/generated/v2_all.pyindex 80839540a3..5b8e03a633 100644--- a/sdk/python/src/openai_codex/generated/v2_all.py+++ b/sdk/python/src/openai_codex/generated/v2_all.py@@ -6423,6 +6423,12 @@ class WebSearchToolConfig(BaseModel):location: WebSearchLocation | None = None+class WindowsSandboxImplementation(Enum):+ elevated = "elevated"+ unelevated = "unelevated"+ mxc = "mxc"++class WindowsSandboxReadiness(Enum):ready = "ready"not_configured = "notConfigured"@@ -11312,7 +11318,8 @@ class ConfigRequirements(BaseModel):list[WebSearchMode] | None, Field(alias="allowedWebSearchModes")] = Noneallowed_windows_sandbox_implementations: Annotated[- list[WindowsSandboxSetupMode] | None, Field(alias="allowedWindowsSandboxImplementations")+ list[WindowsSandboxImplementation] | None,+ Field(alias="allowedWindowsSandboxImplementations"),] = Noneauto_review: Annotated[AutoReviewRequirements | None, Field(alias="autoReview")] = Nonebrowser_use: Annotated[BrowserUseRequirements | None, Field(alias="browserUse")] = None