mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +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:
1 parent
426fa8cdab
commit
e9a6d731b7
3 files changed
+45
-15
No files matched your search
@@ -1425,6 +1425,14 @@ async fn plugin_read_agent_plugin_excludes_nested_skills() -> Result<()> {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn plugin_read_returns_plugin_details_with_bundle_contents() -> Result<()> {
|
async fn plugin_read_returns_plugin_details_with_bundle_contents() -> Result<()> {
|
||||||
let codex_home = TempDir::new()?;
|
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 repo_root = TempDir::new()?;
|
||||||
let plugin_root = repo_root.path().join("plugins/demo-plugin");
|
let plugin_root = repo_root.path().join("plugins/demo-plugin");
|
||||||
std::fs::create_dir_all(repo_root.path().join(".git"))?;
|
std::fs::create_dir_all(repo_root.path().join(".git"))?;
|
||||||
|
|||||||
@@ -2543,7 +2543,7 @@ impl PluginsManager {
|
|||||||
manifest_format,
|
manifest_format,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
if manifest_format == PluginManifestFormat::Legacy && auth_mode.is_some() {
|
if manifest_format == PluginManifestFormat::Legacy {
|
||||||
apply_app_mcp_routing_policy(
|
apply_app_mcp_routing_policy(
|
||||||
&mut app_declarations,
|
&mut app_declarations,
|
||||||
&mut mcp_servers,
|
&mut mcp_servers,
|
||||||
|
|||||||
@@ -4127,6 +4127,20 @@ plugins = true
|
|||||||
vec!["other-mcp".to_string(), "sample-mcp".to_string()]
|
vec!["other-mcp".to_string(), "sample-mcp".to_string()]
|
||||||
);
|
);
|
||||||
assert!(api_key_outcome.plugin.apps.is_empty());
|
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]
|
#[tokio::test]
|
||||||
@@ -4166,7 +4180,11 @@ plugins = true
|
|||||||
);
|
);
|
||||||
|
|
||||||
let config = load_config(tmp.path(), &repo_root).await;
|
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
|
let outcome = manager
|
||||||
.read_plugin_for_config(
|
.read_plugin_for_config(
|
||||||
&config,
|
&config,
|
||||||
@@ -4606,19 +4624,23 @@ enabled = false
|
|||||||
);
|
);
|
||||||
|
|
||||||
let config = load_config(tmp.path(), &repo_root).await;
|
let config = load_config(tmp.path(), &repo_root).await;
|
||||||
let outcome = test_plugins_manager(tmp.path().to_path_buf())
|
let outcome = test_plugins_manager_with_options(
|
||||||
.read_plugin_for_config(
|
tmp.path().to_path_buf(),
|
||||||
&config,
|
Some(Product::Codex),
|
||||||
&PluginReadRequest {
|
Some(AuthMode::Chatgpt),
|
||||||
plugin_name: "toolkit".to_string(),
|
)
|
||||||
marketplace_path: AbsolutePathBuf::try_from(
|
.read_plugin_for_config(
|
||||||
repo_root.join(".agents/plugins/marketplace.json"),
|
&config,
|
||||||
)
|
&PluginReadRequest {
|
||||||
.unwrap(),
|
plugin_name: "toolkit".to_string(),
|
||||||
},
|
marketplace_path: AbsolutePathBuf::try_from(
|
||||||
)
|
repo_root.join(".agents/plugins/marketplace.json"),
|
||||||
.await
|
)
|
||||||
.unwrap();
|
.unwrap(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(outcome.plugin.details_unavailable_reason, None);
|
assert_eq!(outcome.plugin.details_unavailable_reason, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
Reference in new issue
Block a user