mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Integrate discovery V2 with step-scoped skill catalogs (#55322)
## What changed - Build executor skill catalogs from discovery V2 inventories without reopening host paths or falling back to legacy discovery. - Merge Cloud and executor skills by remote plugin identity and skill name, retaining Cloud metadata and accepted provider read routes. Apply plugin selection and disablement before merging. - Share a stable catalog across each step's rendering, list/read tools, and explicit and implicit skill invocations. - Preserve unmatched executor entries when Cloud catalogs are unavailable or partial; only complete Cloud catalogs disable unmatched remote entries. - Bind discovery caches to captured environments and executor sessions, and refresh MCP when V2 inventories change. Preserve pending invalidations when forced MCP refreshes fail. ## Testing Add regression coverage for V2 inventory sharing and refresh, environment isolation, catalog merging, partial Cloud results, disabled plugins, and catalog consistency across steps and read routes. GitOrigin-RevId: 842bdcbc9e19364dd69a9abf9e48330b7425a76c
This commit is contained in:
committed by
copyberry
parent
57560e9d53
commit
a309f9206a
@@ -88,8 +88,8 @@ pub enum PluginSourceLocation {
|
||||
}
|
||||
|
||||
/// Uses Cloud membership and metadata, retaining version-matched installations in order.
|
||||
/// Unavailable Cloud data preserves executor enablement. With a Cloud catalog, unmatched remote
|
||||
/// plugins are retained but disabled. Local plugins retain their existing enablement.
|
||||
/// Unavailable or partial Cloud data preserves unmatched executor entries. Complete Cloud
|
||||
/// catalogs disable unmatched remote entries; local entries retain their enablement.
|
||||
pub fn merge_catalogs(
|
||||
executor: Option<&PluginCatalog>,
|
||||
cloud: Option<&PluginCatalog>,
|
||||
@@ -113,9 +113,11 @@ pub fn merge_catalogs(
|
||||
.iter_mut()
|
||||
.find(|definition| definition.id == installation.id)
|
||||
else {
|
||||
let mut disabled = installation.clone();
|
||||
disabled.enabled = false;
|
||||
merged.entries.push(disabled);
|
||||
let mut unmatched = installation.clone();
|
||||
if !cloud.is_partial {
|
||||
unmatched.enabled = false;
|
||||
}
|
||||
merged.entries.push(unmatched);
|
||||
continue;
|
||||
};
|
||||
if definition.version != installation.version {
|
||||
|
||||
@@ -125,7 +125,11 @@ fn cloud_catalog_controls_remote_plugins_but_preserves_local_plugins() -> anyhow
|
||||
assert_eq!(
|
||||
merge_catalogs(Some(&unmatched), cloud.as_ref()),
|
||||
PluginCatalog {
|
||||
entries: disabled_entries.clone(),
|
||||
entries: if cloud.as_ref().is_some_and(|catalog| catalog.is_partial) {
|
||||
unmatched.entries.clone()
|
||||
} else {
|
||||
disabled_entries.clone()
|
||||
},
|
||||
is_partial: cloud.as_ref().is_some_and(|catalog| catalog.is_partial),
|
||||
warnings: cloud.map(|catalog| catalog.warnings).unwrap_or_default(),
|
||||
},
|
||||
@@ -162,3 +166,32 @@ fn cloud_catalog_controls_remote_plugins_but_preserves_local_plugins() -> anyhow
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_cloud_merges_known_plugins_and_preserves_unmatched_enablement() -> anyhow::Result<()> {
|
||||
let definition = cloud_plugin("matched");
|
||||
let matched = executor_plugin("matched", "executor-a")?;
|
||||
let mut denied = executor_plugin("denied", "executor-a")?;
|
||||
denied.enabled = false;
|
||||
let unmatched = executor_plugin("unmatched", "executor-a")?;
|
||||
let executor = PluginCatalog {
|
||||
entries: vec![matched.clone(), denied.clone(), unmatched.clone()],
|
||||
..Default::default()
|
||||
};
|
||||
let cloud = PluginCatalog {
|
||||
entries: vec![definition.clone()],
|
||||
is_partial: true,
|
||||
..Default::default()
|
||||
};
|
||||
let mut expected = definition;
|
||||
expected.locations.extend(matched.locations);
|
||||
assert_eq!(
|
||||
merge_catalogs(Some(&executor), Some(&cloud)),
|
||||
PluginCatalog {
|
||||
entries: vec![expected, denied, unmatched],
|
||||
is_partial: true,
|
||||
..Default::default()
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ pub fn catalog_from_snapshots(
|
||||
let inventory = match &snapshot.result {
|
||||
Ok(inventory) => inventory,
|
||||
Err(error) => {
|
||||
catalog.is_partial = true;
|
||||
catalog.warnings.push(format!(
|
||||
"could not discover plugins in environment `{}`; skipping its plugin inventory: {error}",
|
||||
snapshot.environment_id
|
||||
|
||||
Reference in New Issue
Block a user