Route curated plugins by authentication mode (#35671)

## Why

Curated plugin capabilities need to follow the active authentication mode, including after an account switch and when the configured model provider differs from the authentication source.

## What changed

- Select the ChatGPT, remote, or API curated marketplace from the current authentication mode, with an API marketplace fallback for ambient Amazon Bedrock credentials.
- Apply that selection consistently to plugin loading, hooks, skills, installed-plugin conflict filtering, marketplace listing, and `codex mcp` discovery.
- Start the local curated repository sync when an account change makes the remote catalog unavailable, and refresh existing thread MCP runtimes when the effective plugin cache changes.

## Testing

Added coverage for account switches, ChatGPT-authenticated Bedrock sessions, API-key MCP discovery, curated marketplace filtering, hook and skill routing, and existing-thread MCP refreshes.

GitOrigin-RevId: dbefdba3a3ea7281e7b6013e057a418770ccfc95
This commit is contained in:
felixxia-oai
2026-07-27 21:17:42 +00:00
committed by copyberry
parent fd41e813cb
commit 294d813263
12 changed files with 1258 additions and 88 deletions
+53
View File
@@ -9,6 +9,7 @@ use anyhow::Result;
use codex_config::types::McpServerTransportConfig;
use codex_core::config::edit::ConfigEditsBuilder;
use codex_core::config::load_global_mcp_servers;
use codex_login::CODEX_API_KEY_ENV_VAR;
use predicates::prelude::PredicateBooleanExt;
use predicates::str::contains;
use pretty_assertions::assert_eq;
@@ -57,6 +58,58 @@ fn list_shows_empty_state() -> Result<()> {
Ok(())
}
#[test]
fn api_key_auth_exposes_api_curated_plugin_mcp_servers() -> Result<()> {
let codex_home = TempDir::new()?;
std::fs::write(
codex_home.path().join("config.toml"),
r#"[features]
plugins = true
remote_plugin = false
[plugins."api-docs@openai-api-curated"]
enabled = true
"#,
)?;
let plugin_root = codex_home
.path()
.join("plugins/cache/openai-api-curated/api-docs/local");
std::fs::create_dir_all(plugin_root.join(".codex-plugin"))?;
std::fs::write(
plugin_root.join(".codex-plugin/plugin.json"),
r#"{"name":"api-docs","version":"local"}"#,
)?;
std::fs::write(
plugin_root.join(".mcp.json"),
r#"{
"mcpServers": {
"api-docs": {
"type": "stdio",
"command": "api-docs-mcp"
}
}
}"#,
)?;
let mut list_cmd = codex_command(codex_home.path())?;
list_cmd
.env(CODEX_API_KEY_ENV_VAR, "sk-test")
.args(["mcp", "list", "--json"])
.assert()
.success()
.stdout(contains(r#""name": "api-docs""#));
let mut get_cmd = codex_command(codex_home.path())?;
get_cmd
.env(CODEX_API_KEY_ENV_VAR, "sk-test")
.args(["mcp", "get", "api-docs", "--json"])
.assert()
.success()
.stdout(contains(r#""name": "api-docs""#));
Ok(())
}
#[tokio::test]
async fn list_discovers_local_oauth_server_through_environment_proxy() -> Result<()> {
let codex_home = TempDir::new()?;