Separate Windows sandbox implementations from legacy setup modes (#45737)

## Why

`allowedWindowsSandboxImplementations` uses the legacy setup-mode type, which cannot represent `mxc`.

## What changed

- Introduce `WindowsSandboxImplementation` with `elevated`, `unelevated`, and `mxc` variants for configuration requirements, and update the generated schemas and TypeScript and Python types.
- Keep `WindowsSandboxSetupMode` limited to `elevated` and `unelevated`, and update the requirements mapping and its test assertions to use the new type.
- Document that clients selecting `mxc` skip the legacy setup and readiness APIs and use the standard `command/exec` streaming and process-control path.

GitOrigin-RevId: c926e853f0bbdb29d4b437866c284c1394a7ea13
This commit is contained in:
iceweasel-oai authored and copyberry committed 2026-09-15 17:17:07 +00:00
1 parent eeded5ba1a
commit fbad00774b
13 files changed
+68 -16

No files matched your search

@@ -9876,7 +9876,7 @@
}, },
"allowedWindowsSandboxImplementations": { "allowedWindowsSandboxImplementations": {
"items": { "items": {
"$ref": "#/definitions/v2/WindowsSandboxSetupMode" "$ref": "#/definitions/v2/WindowsSandboxImplementation"
}, },
"type": [ "type": [
"array", "array",
@@ -25791,6 +25791,14 @@
}, },
"type": "object" "type": "object"
}, },
"WindowsSandboxImplementation": {
"enum": [
"elevated",
"unelevated",
"mxc"
],
"type": "string"
},
"WindowsSandboxReadiness": { "WindowsSandboxReadiness": {
"enum": [ "enum": [
"ready", "ready",
@@ -5756,7 +5756,7 @@
}, },
"allowedWindowsSandboxImplementations": { "allowedWindowsSandboxImplementations": {
"items": { "items": {
"$ref": "#/definitions/WindowsSandboxSetupMode" "$ref": "#/definitions/WindowsSandboxImplementation"
}, },
"type": [ "type": [
"array", "array",
@@ -23505,6 +23505,14 @@
}, },
"type": "object" "type": "object"
}, },
"WindowsSandboxImplementation": {
"enum": [
"elevated",
"unelevated",
"mxc"
],
"type": "string"
},
"WindowsSandboxReadiness": { "WindowsSandboxReadiness": {
"enum": [ "enum": [
"ready", "ready",
@@ -453,7 +453,7 @@
}, },
"allowedWindowsSandboxImplementations": { "allowedWindowsSandboxImplementations": {
"items": { "items": {
"$ref": "#/definitions/WindowsSandboxSetupMode" "$ref": "#/definitions/WindowsSandboxImplementation"
}, },
"type": [ "type": [
"array", "array",
@@ -1085,10 +1085,11 @@
], ],
"type": "string" "type": "string"
}, },
"WindowsSandboxSetupMode": { "WindowsSandboxImplementation": {
"enum": [ "enum": [
"elevated", "elevated",
"unelevated" "unelevated",
"mxc"
], ],
"type": "string" "type": "string"
} }
@@ -15,7 +15,7 @@ import type { InAppBrowserRequirements } from "./InAppBrowserRequirements";
import type { ModelsRequirements } from "./ModelsRequirements"; import type { ModelsRequirements } from "./ModelsRequirements";
import type { ResidencyRequirement } from "./ResidencyRequirement"; import type { ResidencyRequirement } from "./ResidencyRequirement";
import type { SandboxMode } from "./SandboxMode"; import type { SandboxMode } from "./SandboxMode";
import type { WindowsSandboxSetupMode } from "./WindowsSandboxSetupMode"; import type { WindowsSandboxImplementation } from "./WindowsSandboxImplementation";
export type ConfigRequirements = {/** export type ConfigRequirements = {/**
* Exact provider selection required by managed policy. * 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. * Effective login methods after managed, forced-login, and workspace restrictions.
* An empty list permits no login method. Older servers may omit this field. * 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};
@@ -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";
@@ -616,6 +616,7 @@ export type { TurnsPage } from "./TurnsPage";
export type { UserInput } from "./UserInput"; export type { UserInput } from "./UserInput";
export type { WarningNotification } from "./WarningNotification"; export type { WarningNotification } from "./WarningNotification";
export type { WebSearchAction } from "./WebSearchAction"; export type { WebSearchAction } from "./WebSearchAction";
export type { WindowsSandboxImplementation } from "./WindowsSandboxImplementation";
export type { WindowsSandboxReadiness } from "./WindowsSandboxReadiness"; export type { WindowsSandboxReadiness } from "./WindowsSandboxReadiness";
export type { WindowsSandboxReadinessResponse } from "./WindowsSandboxReadinessResponse"; export type { WindowsSandboxReadinessResponse } from "./WindowsSandboxReadinessResponse";
export type { WindowsSandboxSetupCompletedNotification } from "./WindowsSandboxSetupCompletedNotification"; export type { WindowsSandboxSetupCompletedNotification } from "./WindowsSandboxSetupCompletedNotification";
@@ -4,7 +4,7 @@ use super::AskForApproval;
use super::BrowserUseConfig; use super::BrowserUseConfig;
use super::ComputerUseConfig; use super::ComputerUseConfig;
use super::SandboxMode; use super::SandboxMode;
use super::WindowsSandboxSetupMode; use super::WindowsSandboxImplementation;
use super::shared::default_enabled; use super::shared::default_enabled;
use crate::JsonSchema; use crate::JsonSchema;
use crate::TS; use crate::TS;
@@ -423,7 +423,7 @@ pub struct ConfigRequirements {
#[experimental("configRequirements/read.allowedApprovalsReviewers")] #[experimental("configRequirements/read.allowedApprovalsReviewers")]
pub allowed_approvals_reviewers: Option<Vec<ApprovalsReviewer>>, pub allowed_approvals_reviewers: Option<Vec<ApprovalsReviewer>>,
pub allowed_sandbox_modes: Option<Vec<SandboxMode>>, 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 allowed_permission_profiles: Option<BTreeMap<String, bool>>,
pub default_permissions: Option<String>, pub default_permissions: Option<String>,
pub allowed_web_search_modes: Option<Vec<WebSearchMode>>, pub allowed_web_search_modes: Option<Vec<WebSearchMode>>,
@@ -21,6 +21,15 @@ pub enum WindowsSandboxSetupMode {
Unelevated, 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)] #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")] #[ts(export_to = "v2/")]
+13
View File
@@ -245,3 +245,16 @@ The experimental `account/read.workspaceRouting` response field returns the sele
App-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. App-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. 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.
@@ -41,7 +41,7 @@ use codex_app_server_protocol::NetworkRequirements;
use codex_app_server_protocol::NetworkUnixSocketPermission; use codex_app_server_protocol::NetworkUnixSocketPermission;
use codex_app_server_protocol::NewThreadModelDefaults; use codex_app_server_protocol::NewThreadModelDefaults;
use codex_app_server_protocol::SandboxMode; 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::ConfigRequirementsToml;
use codex_config::HookEventsToml; use codex_config::HookEventsToml;
use codex_config::HookHandlerConfig as CoreHookHandlerConfig; use codex_config::HookHandlerConfig as CoreHookHandlerConfig;
@@ -470,10 +470,10 @@ fn map_requirements_to_api(
.into_iter() .into_iter()
.map(|implementation| match implementation { .map(|implementation| match implementation {
codex_config::types::WindowsSandboxModeToml::Elevated => { codex_config::types::WindowsSandboxModeToml::Elevated => {
WindowsSandboxSetupMode::Elevated WindowsSandboxImplementation::Elevated
} }
codex_config::types::WindowsSandboxModeToml::Unelevated => { codex_config::types::WindowsSandboxModeToml::Unelevated => {
WindowsSandboxSetupMode::Unelevated WindowsSandboxImplementation::Unelevated
} }
}) })
.collect() .collect()
@@ -854,7 +854,7 @@ mod tests {
use codex_app_server_protocol::ComputerUseWindowsExeRequirement; use codex_app_server_protocol::ComputerUseWindowsExeRequirement;
use codex_app_server_protocol::ComputerUseWindowsRequirements; use codex_app_server_protocol::ComputerUseWindowsRequirements;
use codex_app_server_protocol::FeedbackRequirements; 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::AllowDenyRequirementToml;
use codex_config::AutoReviewRequirementsToml; use codex_config::AutoReviewRequirementsToml;
use codex_config::BrowserUseAccessApprovalLifetimeToml; use codex_config::BrowserUseAccessApprovalLifetimeToml;
@@ -1110,8 +1110,8 @@ mod tests {
assert_eq!( assert_eq!(
mapped.allowed_windows_sandbox_implementations, mapped.allowed_windows_sandbox_implementations,
Some(vec![ Some(vec![
WindowsSandboxSetupMode::Elevated, WindowsSandboxImplementation::Elevated,
WindowsSandboxSetupMode::Unelevated, WindowsSandboxImplementation::Unelevated,
]) ])
); );
assert_eq!(mapped.windows_sandbox_private_desktop, Some(false)); assert_eq!(mapped.windows_sandbox_private_desktop, Some(false));
@@ -6423,6 +6423,12 @@ class WebSearchToolConfig(BaseModel):
location: WebSearchLocation | None = None location: WebSearchLocation | None = None
class WindowsSandboxImplementation(Enum):
elevated = "elevated"
unelevated = "unelevated"
mxc = "mxc"
class WindowsSandboxReadiness(Enum): class WindowsSandboxReadiness(Enum):
ready = "ready" ready = "ready"
not_configured = "notConfigured" not_configured = "notConfigured"
@@ -11312,7 +11318,8 @@ class ConfigRequirements(BaseModel):
list[WebSearchMode] | None, Field(alias="allowedWebSearchModes") list[WebSearchMode] | None, Field(alias="allowedWebSearchModes")
] = None ] = None
allowed_windows_sandbox_implementations: Annotated[ allowed_windows_sandbox_implementations: Annotated[
list[WindowsSandboxSetupMode] | None, Field(alias="allowedWindowsSandboxImplementations") list[WindowsSandboxImplementation] | None,
Field(alias="allowedWindowsSandboxImplementations"),
] = None ] = None
auto_review: Annotated[AutoReviewRequirements | None, Field(alias="autoReview")] = None auto_review: Annotated[AutoReviewRequirements | None, Field(alias="autoReview")] = None
browser_use: Annotated[BrowserUseRequirements | None, Field(alias="browserUse")] = None browser_use: Annotated[BrowserUseRequirements | None, Field(alias="browserUse")] = None