mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Reconcile V2 executor plugins with cloud catalogs (#55301)
## What changed - Use V2 discovery inventories for plugin MCP contributions when supplied, including empty or failed inventories; retain legacy discovery when no V2 snapshot is supplied. - Merge plugins by canonical identity, using cloud metadata and enablement for remote plugins and attaching executor installations only when versions match. Preserve configured executor-local plugins and executor enablement when cloud data is unavailable. - Keep installation order stable across refreshes and run merged MCP declarations on the first retained executor installation while preserving attribution for the others. - Carry local and remote identities through selected-plugin snapshots, skill attribution, and active-plugin telemetry. Track disabled plugin IDs alongside disabled roots. - Preserve a complete cloud catalog when a partial refresh arrives, and cap tool-description plugin attribution at 1,024 bytes while retaining all plugin associations. ## Testing Add coverage for catalog parsing and reconciliation, enablement and discovery-mode selection, installation refresh ordering, executor-specific MCP normalization, selected-plugin snapshots, and bounded UTF-8 attribution text. GitOrigin-RevId: a8ad352de6a2b8dc4bfd1ff6a5c62ee8ed1d1664
This commit is contained in:
committed by
copyberry
parent
1277bcfddc
commit
f7a135ec61
@@ -275,7 +275,12 @@ impl ContextContributor for StepPackages {
|
||||
snapshot
|
||||
.plugins
|
||||
.iter()
|
||||
.map(|plugin| (plugin.plugin_id.clone(), plugin.selected_root_id.clone()))
|
||||
.map(|plugin| {
|
||||
(
|
||||
plugin.plugin_id.as_str().to_string(),
|
||||
plugin.selected_root_id.clone(),
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
Vec::new()
|
||||
@@ -331,11 +336,12 @@ impl PluginProvider for CloudProvider {
|
||||
fn cloud_catalog() -> PluginCatalog {
|
||||
PluginCatalog {
|
||||
entries: vec![PluginCatalogEntry {
|
||||
enabled: true,
|
||||
id: PluginIdentity::Remote {
|
||||
remote_plugin_id: "plugin_remote".to_string(),
|
||||
},
|
||||
display_name: "Cloud Demo".to_string(),
|
||||
version: Some("1.0.0".to_string()),
|
||||
version: "1.0.0".to_string(),
|
||||
mcp_servers: Default::default(),
|
||||
connector_ids: vec!["calendar".to_string()],
|
||||
locations: vec![codex_core_plugins::PluginSourceLocation::Cloud {
|
||||
@@ -343,7 +349,7 @@ fn cloud_catalog() -> PluginCatalog {
|
||||
bundle_uri: None,
|
||||
}],
|
||||
}],
|
||||
warnings: Vec::new(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +390,15 @@ async fn run_cloud_catalog_refresh_lifecycle() -> anyhow::Result<()> {
|
||||
};
|
||||
gmail_catalog.entries[0].display_name = "Gmail Demo".to_string();
|
||||
gmail_catalog.entries[0].connector_ids = vec!["gmail".to_string()];
|
||||
let mut disabled_catalog = cloud_catalog();
|
||||
disabled_catalog.entries[0].enabled = false;
|
||||
let mut partial_catalog = gmail_catalog.clone();
|
||||
partial_catalog.is_partial = true;
|
||||
let partial_empty_catalog = PluginCatalog {
|
||||
is_partial: true,
|
||||
warnings: vec!["resource listing was truncated".to_string()],
|
||||
..Default::default()
|
||||
};
|
||||
let provider = Arc::new(CloudProvider::default());
|
||||
let step_packages = Arc::new(StepPackages::default());
|
||||
let mut extensions = ExtensionRegistryBuilder::new();
|
||||
@@ -421,6 +436,30 @@ async fn run_cloud_catalog_refresh_lifecycle() -> anyhow::Result<()> {
|
||||
let calendar = ("calendar", "list_events", "Cloud Demo");
|
||||
let gmail = ("gmail", "search_email", "Gmail Demo");
|
||||
for (turn, reply, expected_plugin, new_account, tool_call) in [
|
||||
(
|
||||
"initial-partial",
|
||||
Ok(partial_catalog.clone()),
|
||||
Some("plugin_gmail"),
|
||||
None,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"partial-replaces-partial",
|
||||
Ok(PluginCatalog {
|
||||
is_partial: true,
|
||||
..cloud_catalog()
|
||||
}),
|
||||
Some("plugin_remote"),
|
||||
None,
|
||||
Some(calendar),
|
||||
),
|
||||
(
|
||||
"partial-empty-replaces-partial",
|
||||
Ok(partial_empty_catalog.clone()),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"empty",
|
||||
Ok(PluginCatalog::default()),
|
||||
@@ -428,6 +467,13 @@ async fn run_cloud_catalog_refresh_lifecycle() -> anyhow::Result<()> {
|
||||
None,
|
||||
Some(calendar),
|
||||
),
|
||||
(
|
||||
"partial-after-complete-empty",
|
||||
Ok(partial_catalog.clone()),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"discovered",
|
||||
Ok(cloud_catalog()),
|
||||
@@ -435,6 +481,20 @@ async fn run_cloud_catalog_refresh_lifecycle() -> anyhow::Result<()> {
|
||||
None,
|
||||
Some(calendar),
|
||||
),
|
||||
(
|
||||
"partial-refresh",
|
||||
Ok(partial_catalog.clone()),
|
||||
Some("plugin_remote"),
|
||||
None,
|
||||
Some(calendar),
|
||||
),
|
||||
(
|
||||
"partial-empty-refresh",
|
||||
Ok(partial_empty_catalog),
|
||||
Some("plugin_remote"),
|
||||
None,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"same-account-failure",
|
||||
Err("temporarily unavailable".to_string()),
|
||||
@@ -442,6 +502,30 @@ async fn run_cloud_catalog_refresh_lifecycle() -> anyhow::Result<()> {
|
||||
None,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"complete-with-warning-disables-plugin",
|
||||
Ok(PluginCatalog {
|
||||
warnings: vec!["optional bundle hint ignored".to_string()],
|
||||
..disabled_catalog
|
||||
}),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"partial-after-disable",
|
||||
Ok(partial_catalog.clone()),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
),
|
||||
(
|
||||
"re-enabled",
|
||||
Ok(cloud_catalog()),
|
||||
Some("plugin_remote"),
|
||||
None,
|
||||
None,
|
||||
),
|
||||
("removed", Ok(PluginCatalog::default()), None, None, None),
|
||||
(
|
||||
"restored",
|
||||
@@ -457,6 +541,13 @@ async fn run_cloud_catalog_refresh_lifecycle() -> anyhow::Result<()> {
|
||||
Some("account-b"),
|
||||
None,
|
||||
),
|
||||
(
|
||||
"new-account-partial",
|
||||
Ok(partial_catalog),
|
||||
Some("plugin_gmail"),
|
||||
None,
|
||||
Some(gmail),
|
||||
),
|
||||
(
|
||||
"new-account-discovered",
|
||||
Ok(gmail_catalog),
|
||||
|
||||
Reference in New Issue
Block a user