mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
## 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
78 lines
3.1 KiB
Rust
78 lines
3.1 KiB
Rust
//! Tests partial Cloud reconciliation without changing source-specific enablement.
|
|
|
|
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
fn skill(kind: SkillSourceKind, name: &str) -> SkillCatalogEntry {
|
|
SkillCatalogEntry::new(
|
|
SkillPackageId(format!("skill://{kind}/{name}")),
|
|
SkillAuthority::new(kind.clone(), kind.to_string()),
|
|
name,
|
|
"",
|
|
SkillResourceId::new(format!("skill://{kind}/{name}/SKILL.md")),
|
|
)
|
|
.with_remote_plugin_id(Some("plugin_a".to_string()))
|
|
}
|
|
|
|
#[test]
|
|
fn partial_cloud_merges_matches_without_disabling_unmatched_installations() {
|
|
for (cloud_is_partial, cloud_has_match) in [
|
|
(None, false),
|
|
(Some(false), false),
|
|
(Some(true), false),
|
|
(Some(false), true),
|
|
(Some(true), true),
|
|
] {
|
|
for executor_is_partial in [false, true] {
|
|
let cloud_entry = skill(SkillSourceKind::Cloud, "matched");
|
|
let matched = skill(SkillSourceKind::Executor, "matched").disabled();
|
|
let mut unmatched = skill(SkillSourceKind::Executor, "unmatched");
|
|
let mut denied_source = unmatched.primary_source();
|
|
denied_source.enabled = false;
|
|
unmatched.sources.push(denied_source);
|
|
let denied = skill(SkillSourceKind::Executor, "denied").disabled();
|
|
let mut executor = SkillCatalog::default();
|
|
executor.extend(SkillCatalog {
|
|
entries: vec![matched.clone(), unmatched.clone(), denied.clone()],
|
|
is_partial: executor_is_partial,
|
|
..Default::default()
|
|
});
|
|
// Appending a complete provider must not clear an earlier partial result.
|
|
executor.extend(SkillCatalog::default());
|
|
let cloud = cloud_is_partial.map(|is_partial| SkillCatalog {
|
|
entries: if cloud_has_match {
|
|
vec![cloud_entry.clone()]
|
|
} else {
|
|
Vec::new()
|
|
},
|
|
is_partial,
|
|
// Diagnostic warnings alone do not make membership incomplete.
|
|
warnings: vec!["diagnostic".to_string()],
|
|
});
|
|
let expected_match = if cloud_has_match {
|
|
let mut entry = cloud_entry;
|
|
entry.sources.push(matched.primary_source());
|
|
entry
|
|
} else {
|
|
matched
|
|
};
|
|
if cloud_is_partial == Some(false) {
|
|
unmatched.enabled = false;
|
|
}
|
|
assert_eq!(
|
|
merge_catalogs(cloud, executor),
|
|
SkillCatalog {
|
|
entries: vec![expected_match, unmatched, denied],
|
|
warnings: if cloud_is_partial.is_some() {
|
|
vec!["diagnostic".to_string()]
|
|
} else {
|
|
Vec::new()
|
|
},
|
|
is_partial: cloud_is_partial.unwrap_or(false) || executor_is_partial,
|
|
},
|
|
"cloud_is_partial={cloud_is_partial:?}, cloud_has_match={cloud_has_match}, executor_is_partial={executor_is_partial}",
|
|
);
|
|
}
|
|
}
|
|
}
|