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:
Anthony Tafoya
2026-10-19 17:02:20 +00:00
committed by copyberry
parent 57560e9d53
commit a309f9206a
64 changed files with 3627 additions and 734 deletions
@@ -20,6 +20,18 @@ pub struct ExecutorCapabilityDiscoveryV2Snapshot {
pub result: Result<Arc<DiscoverV2CapabilitiesResponse>, String>,
}
impl ExecutorCapabilityDiscoveryV2Snapshot {
/// Compares discovery identity, not inventory contents; repeated errors compare by message.
pub fn same_discovery(&self, other: &Self) -> bool {
self.environment_id == other.environment_id
&& match (&self.result, &other.result) {
(Ok(previous), Ok(current)) => Arc::ptr_eq(previous, current),
(Err(previous), Err(current)) => previous == current,
(Ok(_), Err(_)) | (Err(_), Ok(_)) => false,
}
}
}
/// Discover installed capabilities for a thread, without client-supplied installation paths.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@@ -1,4 +1,4 @@
//! V2 discovery requests and responses round-trip through JSON.
//! V2 discovery wire contracts.
use super::*;
use crate::CapabilityTextFile;