Configure PSP routing through the feature system (#38056)

## What changed

- Add the under-development `psp` feature and expose it in the config schema.
- Use the feature to attach the PSP cookie to first-party ChatGPT clients.
- Remove the hidden `--psp` flag and its process-scoped configuration plumbing.
- Preserve configured ChatGPT cookies when creating the PSP client used for GET and POST requests.

## Testing

- Update the config manager service test to verify that enabling `features.psp` retains the setting in the effective config and configures the expected ChatGPT cookie.

GitOrigin-RevId: 53acb5495d2ff71e4ed25f674a0cff787aea474a
This commit is contained in:
stevenlee-oai authored and copyberry committed 2026-08-11 19:16:15 +00:00
1 parent b28aa476f4
commit 285abc0368
24 files changed
+47 -107

No files matched your search

-3
View File
@@ -5034,7 +5034,6 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
refreshed_toml,
ConfigOverrides {
cwd: Some(codex_home.path().to_path_buf()),
psp: Some(true),
..Default::default()
},
codex_home.abs(),
@@ -5112,8 +5111,6 @@ async fn rebuild_preserving_session_layers_refreshes_requirements() -> std::io::
.rebuild_preserving_session_layers(&refreshed_config)
.await?;
assert!(config.psp);
assert!(config.http_client_factory().has_chatgpt_cookies());
assert_eq!(
config.mcp_servers.get(),
&HashMap::from([
+1 -8
View File
@@ -977,9 +977,6 @@ pub struct Config {
/// Whether Codex-owned clients should respect host system proxy settings.
pub respect_system_proxy: bool,
/// Process-only ChatGPT routing selection supplied when Codex is launched.
pub psp: bool,
/// Optional product SKU forwarded to the host-owned apps MCP server.
pub apps_mcp_product_sku: Option<String>,
@@ -1623,7 +1620,7 @@ impl Config {
OutboundProxyPolicy::ReqwestDefault
};
let factory = HttpClientFactory::new(outbound_proxy_policy);
if self.psp {
if self.features.enabled(Feature::Psp) {
factory.with_chatgpt_cookies([HeaderValue::from_static("oai-chat-psp=true")])
} else {
factory
@@ -1835,7 +1832,6 @@ impl Config {
ConfigOverrides {
cwd: Some(self.cwd.to_path_buf()),
default_zsh_path,
psp: Some(refreshed_config.psp),
..Default::default()
},
refreshed_config.codex_home.clone(),
@@ -2579,7 +2575,6 @@ pub struct ConfigOverrides {
pub tools_web_search_request: Option<bool>,
pub ephemeral: Option<bool>,
pub bypass_hook_trust: Option<bool>,
pub psp: Option<bool>,
/// Additional directories that should be treated as writable roots for this session.
pub additional_writable_roots: Vec<PathBuf>,
/// Explicit absolute runtime workspace roots for this session. When set,
@@ -3270,7 +3265,6 @@ impl Config {
tools_web_search_request: override_tools_web_search_request,
ephemeral,
bypass_hook_trust,
psp,
additional_writable_roots,
workspace_roots: workspace_roots_override,
} = overrides;
@@ -4192,7 +4186,6 @@ impl Config {
.chatgpt_base_url
.unwrap_or("https://chatgpt.com/backend-api/".to_string()),
respect_system_proxy,
psp: psp.unwrap_or_default(),
apps_mcp_product_sku: cfg.apps_mcp_product_sku.clone(),
responses_api_metadata: cfg.responses_api_metadata.unwrap_or_default(),
realtime_audio: cfg