Preserve ChatGPT auth for trusted staging MCP servers (#36983)

## What changed

- Treat an MCP server as trusted for ChatGPT authentication when its origin
  matches the configured HTTPS `chatgpt-staging.com` host or one of its
  subdomains.
- Continue trusting the production ChatGPT origin and falling back to OAuth for
  other transports and origins.

## Testing

- Cover both the staging apex domain and a staging subdomain.

GitOrigin-RevId: 1b1d06ab214141d39eb38d46de9dfb74e6fedb3e
This commit is contained in:
yijiang12 authored and copyberry committed 2026-08-04 22:13:50 +00:00
1 parent b9ba969f39
commit bf05737da4
2 files changed
+52 -13

No files matched your search

+19
View File
@@ -362,6 +362,25 @@ fn codex_apps_server_config_forwards_originator_and_configured_product_sku_heade
}
}
#[test]
fn effective_mcp_servers_preserve_chatgpt_auth_for_staging() {
for url in [
"https://chatgpt-staging.com",
"https://preview.chatgpt-staging.com",
] {
let mut config = test_mcp_config(PathBuf::new());
config.chatgpt_base_url = url.to_string();
let server = codex_apps_mcp_server_config(
url, /*apps_mcp_product_sku*/ None, /*originator*/ None,
);
let configured = HashMap::from([("staging".to_string(), server)]);
let effective =
effective_mcp_servers_from_configured(configured, &config, /*auth*/ None);
assert_eq!(effective["staging"].config().auth, McpServerAuth::ChatGpt);
}
}
#[tokio::test]
async fn effective_mcp_servers_preserve_runtime_servers() {
let codex_home = tempfile::tempdir().expect("tempdir");