aKode fase 2b-1 (WIP): rimossi cloud-config, apps MCP ChatGPT, upload file, connectors-extension, rate limits backend; plugin remoti in corso (test non ancora compilanti)
Some checks failed
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled

This commit is contained in:
Andrea
2026-11-09 13:55:36 +01:00
parent 137106bf17
commit e4209e2755
166 changed files with 155 additions and 31558 deletions

View File

@@ -4,10 +4,6 @@ use crate::OPENAI_BUNDLED_MARKETPLACE_NAME;
use crate::PluginInstallRequest;
use crate::PluginsConfigInput;
use crate::PluginsManager;
use crate::remote::InstalledPluginDisplayAssets;
use crate::remote::REMOTE_GLOBAL_MARKETPLACE_NAME;
use crate::remote::RemotePluginServiceConfig;
use crate::remote::fetch_and_cache_global_remote_plugin_catalog;
use crate::startup_sync::curated_plugins_repo_path;
use crate::test_support::TEST_CURATED_PLUGIN_SHA;
use crate::test_support::load_plugins_config;
@@ -27,7 +23,6 @@ use codex_protocol::auth::AuthMode;
use codex_protocol::protocol::Product;
use codex_utils_absolute_path::AbsolutePathBuf;
use pretty_assertions::assert_eq;
use serde_json::json;
use std::collections::HashSet;
use std::path::Path;
use std::sync::Arc;
@@ -35,13 +30,6 @@ use tempfile::tempdir;
use tracing::Level;
use tracing_subscriber::fmt::format::FmtSpan;
use tracing_test::internal::MockWriter;
use wiremock::Mock;
use wiremock::MockServer;
use wiremock::ResponseTemplate;
use wiremock::matchers::method;
use wiremock::matchers::path;
use wiremock::matchers::query_param;
use wiremock::matchers::query_param_is_missing;
#[tokio::test]
async fn returns_fallback_plugins_when_remote_disabled_for_codex_auth() {
@@ -839,238 +827,6 @@ source = "/tmp/{sales_marketplace_name}"
assert_eq!(discoverable_plugins, Vec::new());
}
#[tokio::test]
async fn cached_remote_discovery_requires_installed_cache_and_filters_candidates() {
assert_cached_remote_discovery_filters_candidates(InstalledPluginDisplayAssets::Include).await;
}
/// Tool suggestions need installed IDs even when display enrichment was skipped.
#[tokio::test]
async fn cached_remote_discovery_accepts_snapshot_without_display_assets() {
assert_cached_remote_discovery_filters_candidates(InstalledPluginDisplayAssets::Skip).await;
}
async fn assert_cached_remote_discovery_filters_candidates(
display_assets: InstalledPluginDisplayAssets,
) {
let codex_home = tempdir().expect("tempdir should succeed");
write_file(
&codex_home.path().join(CONFIG_TOML_FILE),
r#"[features]
plugins = true
"#,
);
let server = MockServer::start().await;
Mock::given(method("GET"))
.and(path("/backend-api/ps/plugins/list"))
.and(query_param("scope", "GLOBAL"))
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
"plugins": [
{
"id": "plugins~Plugin_remote_github",
"name": "github",
"scope": "GLOBAL",
"installation_policy": "AVAILABLE",
"authentication_policy": "ON_USE",
"status": "AVAILABLE",
"release": {
"display_name": "Remote GitHub",
"description": "Remote GitHub long",
"app_ids": ["github"],
"interface": {"short_description": "Remote GitHub short"},
"skills": [{
"name": "github",
"description": "Use GitHub",
"interface": null
}]
}
},
{
"id": "plugins~Plugin_remote_unlisted",
"name": "remote-unlisted",
"scope": "GLOBAL",
"installation_policy": "AVAILABLE",
"authentication_policy": "ON_USE",
"status": "AVAILABLE",
"release": {
"display_name": "Remote Unlisted",
"description": "Remote Unlisted long",
"app_ids": ["remote-unlisted-app"],
"interface": {
"short_description": "Remote Unlisted short",
"long_description": null,
"developer_name": null,
"category": null,
"capabilities": [],
"website_url": null,
"privacy_policy_url": null,
"terms_of_service_url": null,
"brand_color": null,
"default_prompt": null,
"composer_icon_url": null,
"logo_url": null,
"screenshot_urls": []
},
"skills": [
{
"name": "remote-unlisted",
"description": "Use unlisted remote plugin",
"interface": null
}
]
}
},
{
"id": "plugins~Plugin_remote_slack_not_available",
"name": "slack",
"scope": "GLOBAL",
"installation_policy": "NOT_AVAILABLE",
"authentication_policy": "ON_USE",
"status": "AVAILABLE",
"release": {
"display_name": "Remote Slack",
"description": "Remote Slack long",
"interface": {"short_description": "Remote Slack short"}
}
},
{
"id": "plugins~Plugin_remote_figma_admin_disabled",
"name": "figma",
"scope": "GLOBAL",
"installation_policy": "AVAILABLE",
"authentication_policy": "ON_USE",
"status": "DISABLED_BY_ADMIN",
"release": {
"display_name": "Remote Figma",
"description": "Remote Figma long",
"interface": {"short_description": "Remote Figma short"}
}
}
],
"pagination": {
"next_page_token": null
}
})))
.expect(1)
.mount(&server)
.await;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let mut plugins = load_plugins_config(codex_home.path(), codex_home.path()).await;
plugins.chatgpt_base_url = format!("{}/backend-api", server.uri());
let plugins_manager = test_plugins_manager_with_options(
codex_home.path().to_path_buf(),
Some(Product::Codex),
Some(AuthMode::Chatgpt),
);
fetch_and_cache_global_remote_plugin_catalog(
codex_home.path(),
&RemotePluginServiceConfig::new(
plugins.chatgpt_base_url.clone(),
crate::test_support::test_http_client_factory(),
/*product_sku*/ None,
),
Some(&auth),
)
.await
.expect("remote plugin catalog cache should write");
assert_eq!(
list_discoverable_plugins(
&plugins_manager,
discovery_input(plugins.clone(), &[], &[], &["remote-unlisted-app"]),
Some(&auth),
)
.await,
Vec::new()
);
let installed_request = Mock::given(method("GET"))
.and(path("/backend-api/ps/plugins/installed"))
.and(query_param_is_missing("scope"))
.and(query_param_is_missing("includeDownloadUrls"));
let installed_request = match display_assets {
InstalledPluginDisplayAssets::Include => {
installed_request.and(query_param_is_missing("includeDisplayAssets"))
}
InstalledPluginDisplayAssets::Skip => {
installed_request.and(query_param("includeDisplayAssets", "false"))
}
};
installed_request
.respond_with(ResponseTemplate::new(200).set_body_json(json!({
"plugins": [],
"pagination": {
"next_page_token": null
}
})))
.expect(1)
.mount(&server)
.await;
plugins_manager
.build_and_cache_remote_installed_plugin_marketplaces_with_display_assets(
&plugins,
Some(&auth),
&[REMOTE_GLOBAL_MARKETPLACE_NAME],
/*on_effective_plugins_changed*/ None,
display_assets,
)
.await
.expect("remote installed plugin cache should write");
let expected_github = ToolSuggestDiscoverablePlugin {
id: "github@openai-curated-remote".to_string(),
remote_plugin_id: Some("plugins~Plugin_remote_github".to_string()),
name: "Remote GitHub".to_string(),
description: Some("Remote GitHub short".to_string()),
has_skills: true,
mcp_server_names: Vec::new(),
app_connector_ids: vec!["github".to_string()],
};
assert_eq!(
list_discoverable_plugins(
&plugins_manager,
discovery_input(plugins.clone(), &[], &[], &[]),
Some(&auth),
)
.await,
vec![expected_github.clone()]
);
let discoverable_plugins = list_discoverable_plugins(
&plugins_manager,
discovery_input(plugins.clone(), &[], &[], &["remote-unlisted-app"]),
Some(&auth),
)
.await;
assert_eq!(
discoverable_plugins,
vec![
expected_github,
ToolSuggestDiscoverablePlugin {
id: "remote-unlisted@openai-curated-remote".to_string(),
remote_plugin_id: Some("plugins~Plugin_remote_unlisted".to_string()),
name: "Remote Unlisted".to_string(),
description: Some("Remote Unlisted short".to_string()),
has_skills: true,
mcp_server_names: Vec::new(),
app_connector_ids: vec!["remote-unlisted-app".to_string()],
},
]
);
assert_eq!(
list_discoverable_plugins(
&plugins_manager,
discovery_input(plugins, &[], &["github@openai-curated-remote"], &[]),
Some(&auth),
)
.await,
Vec::new()
);
}
fn discovery_input(
plugins: PluginsConfigInput,
configured_plugin_ids: &[&str],