Route curated plugin catalogs by authentication mode (#38429)

## Why

The model provider does not reliably identify which curated plugin catalog is
available. ChatGPT authentication can be used with a custom provider, while an
unauthenticated session should use the API-compatible catalog regardless of its
provider.

## What changed

- Select the ChatGPT curated catalog only for authentication modes that use the
  Codex backend; use the API curated catalog for API-key and unauthenticated
  sessions.
- Initialize standalone plugin managers with the current authentication mode
  across CLI, app-server, MCP, and external-agent migration paths.
- Preserve authentication mode while detecting and importing migrated plugins.

## Testing

- Cover catalog and skill routing across ChatGPT, API-key, unauthenticated,
  Bedrock, and custom-provider configurations.
- Verify authenticated plugin migration uses the ChatGPT curated marketplace.

GitOrigin-RevId: 660a339ee8891c33aad961078d3a979242a6a166
This commit is contained in:
willwang-openai
2026-08-13 20:20:01 +00:00
committed by copyberry
parent 507ef0b371
commit f898ebcafd
28 changed files with 348 additions and 139 deletions
+24 -5
View File
@@ -5653,7 +5653,10 @@ async fn session_new_fails_when_zsh_fork_enabled_without_packaged_zsh() {
let (tx_event, _rx_event) = async_channel::unbounded();
let (agent_status_tx, _agent_status_rx) = watch::channel(AgentStatus::PendingInit);
let plugins_manager = Arc::new(plugins_manager_for_config(&config));
let plugins_manager = Arc::new(plugins_manager_for_config(
&config,
auth_manager.get_api_auth_mode(),
));
let mcp_manager = Arc::new(McpManager::new(Arc::clone(&plugins_manager)));
let skills_service = Arc::new(HostSkillsService::new(
config.codex_home.clone(),
@@ -5818,7 +5821,10 @@ pub(crate) async fn make_session_and_context() -> (Session, TurnContext) {
.expect("primary environment")
.environment,
);
let plugins_manager = Arc::new(plugins_manager_for_config(&config));
let plugins_manager = Arc::new(plugins_manager_for_config(
&config,
auth_manager.get_api_auth_mode(),
));
let mcp_manager = Arc::new(McpManager::new(Arc::clone(&plugins_manager)));
let skills_service = Arc::new(HostSkillsService::new(
config.codex_home.clone(),
@@ -6073,7 +6079,10 @@ async fn make_session_with_config_and_rx(
let (tx_event, rx_event) = async_channel::unbounded();
let (agent_status_tx, _agent_status_rx) = watch::channel(AgentStatus::PendingInit);
let plugins_manager = Arc::new(plugins_manager_for_config(&config));
let plugins_manager = Arc::new(plugins_manager_for_config(
&config,
auth_manager.get_api_auth_mode(),
));
let mcp_manager = Arc::new(McpManager::new(Arc::clone(&plugins_manager)));
let skills_service = Arc::new(HostSkillsService::new(
config.codex_home.clone(),
@@ -6188,7 +6197,10 @@ async fn make_session_with_history_source_and_agent_control_and_rx(
let (tx_event, rx_event) = async_channel::unbounded();
let (agent_status_tx, _agent_status_rx) = watch::channel(AgentStatus::PendingInit);
let plugins_manager = Arc::new(plugins_manager_for_config(&config));
let plugins_manager = Arc::new(plugins_manager_for_config(
&config,
auth_manager.get_api_auth_mode(),
));
let mcp_manager = Arc::new(McpManager::new(Arc::clone(&plugins_manager)));
let skills_service = Arc::new(HostSkillsService::new(
config.codex_home.clone(),
@@ -7997,7 +8009,10 @@ where
.expect("primary environment")
.environment,
);
let plugins_manager = Arc::new(plugins_manager_for_config(&config));
let plugins_manager = Arc::new(plugins_manager_for_config(
&config,
auth_manager.get_api_auth_mode(),
));
let mcp_manager = Arc::new(McpManager::new(Arc::clone(&plugins_manager)));
let skills_service = Arc::new(HostSkillsService::new(
config.codex_home.clone(),
@@ -8524,6 +8539,10 @@ async fn mcp_refresh_updates_plugin_auth_mode_before_checking_pending_state() {
CodexAuth::from_api_key("old-api-key"),
codex_home.path().to_path_buf(),
);
session
.services
.plugins_manager
.set_auth_mode(/*auth_mode*/ None);
let session = Arc::new(session);
let auth_mode = session.services.auth_manager.get_api_auth_mode();
@@ -750,7 +750,10 @@ async fn guardian_subagent_does_not_inherit_parent_exec_policy_rules() {
auth_manager.clone(),
config.model_provider.clone(),
);
let plugins_manager = Arc::new(plugins_manager_for_config(&config));
let plugins_manager = Arc::new(plugins_manager_for_config(
&config,
auth_manager.get_api_auth_mode(),
));
let skills_service = Arc::new(HostSkillsService::new(
config.codex_home.clone(),
/*bundled_skills_enabled*/ true,