mirror of
https://github.com/openai/codex.git
synced 2026-11-05 20:10:33 +00:00
Apply app routing policy to unauthenticated plugin reads (#41230)
## What changed Apply the legacy plugin app/MCP routing policy even when no authentication mode is available. Unauthenticated plugin reads now omit unavailable app declarations while retaining their MCP server alternatives. ## Testing Extend plugin manager coverage for unauthenticated reads and provide ChatGPT authentication in the app-server bundle-details test. GitOrigin-RevId: d90d29d0702488eb7413c6779254a9e6aae615c0
This commit is contained in:
committed by
copyberry
parent
426fa8cdab
commit
e9a6d731b7
@@ -1425,6 +1425,14 @@ async fn plugin_read_agent_plugin_excludes_nested_skills() -> Result<()> {
|
||||
#[tokio::test]
|
||||
async fn plugin_read_returns_plugin_details_with_bundle_contents() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
write_chatgpt_auth(
|
||||
codex_home.path(),
|
||||
ChatGptAuthFixture::new("chatgpt-token")
|
||||
.account_id("account-123")
|
||||
.chatgpt_user_id("user-123")
|
||||
.chatgpt_account_id("account-123"),
|
||||
AuthCredentialsStoreMode::File,
|
||||
)?;
|
||||
let repo_root = TempDir::new()?;
|
||||
let plugin_root = repo_root.path().join("plugins/demo-plugin");
|
||||
std::fs::create_dir_all(repo_root.path().join(".git"))?;
|
||||
|
||||
@@ -2543,7 +2543,7 @@ impl PluginsManager {
|
||||
manifest_format,
|
||||
)
|
||||
.await;
|
||||
if manifest_format == PluginManifestFormat::Legacy && auth_mode.is_some() {
|
||||
if manifest_format == PluginManifestFormat::Legacy {
|
||||
apply_app_mcp_routing_policy(
|
||||
&mut app_declarations,
|
||||
&mut mcp_servers,
|
||||
|
||||
@@ -4127,6 +4127,20 @@ plugins = true
|
||||
vec!["other-mcp".to_string(), "sample-mcp".to_string()]
|
||||
);
|
||||
assert!(api_key_outcome.plugin.apps.is_empty());
|
||||
|
||||
let no_auth_outcome = test_plugins_manager_with_options(
|
||||
tmp.path().to_path_buf(),
|
||||
Some(Product::Codex),
|
||||
/*auth_mode*/ None,
|
||||
)
|
||||
.read_plugin_for_config(&config, &request)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
no_auth_outcome.plugin.mcp_server_names,
|
||||
vec!["other-mcp".to_string(), "sample-mcp".to_string()]
|
||||
);
|
||||
assert!(no_auth_outcome.plugin.apps.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -4166,7 +4180,11 @@ plugins = true
|
||||
);
|
||||
|
||||
let config = load_config(tmp.path(), &repo_root).await;
|
||||
let manager = test_plugins_manager(tmp.path().to_path_buf());
|
||||
let manager = test_plugins_manager_with_options(
|
||||
tmp.path().to_path_buf(),
|
||||
Some(Product::Codex),
|
||||
Some(AuthMode::Chatgpt),
|
||||
);
|
||||
let outcome = manager
|
||||
.read_plugin_for_config(
|
||||
&config,
|
||||
@@ -4606,19 +4624,23 @@ enabled = false
|
||||
);
|
||||
|
||||
let config = load_config(tmp.path(), &repo_root).await;
|
||||
let outcome = test_plugins_manager(tmp.path().to_path_buf())
|
||||
.read_plugin_for_config(
|
||||
&config,
|
||||
&PluginReadRequest {
|
||||
plugin_name: "toolkit".to_string(),
|
||||
marketplace_path: AbsolutePathBuf::try_from(
|
||||
repo_root.join(".agents/plugins/marketplace.json"),
|
||||
)
|
||||
.unwrap(),
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let outcome = test_plugins_manager_with_options(
|
||||
tmp.path().to_path_buf(),
|
||||
Some(Product::Codex),
|
||||
Some(AuthMode::Chatgpt),
|
||||
)
|
||||
.read_plugin_for_config(
|
||||
&config,
|
||||
&PluginReadRequest {
|
||||
plugin_name: "toolkit".to_string(),
|
||||
marketplace_path: AbsolutePathBuf::try_from(
|
||||
repo_root.join(".agents/plugins/marketplace.json"),
|
||||
)
|
||||
.unwrap(),
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(outcome.plugin.details_unavailable_reason, None);
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user