Preserve orchestrator skill caches across MCP runtime updates (#46033)

## Why

Orchestrator skill caches were tied to the entire MCP connection set, so runtime updates could discard cached catalogs and contents even when the Apps connection was reused. Plugin changes still need to refresh those resources without requiring a reconnect.

## What changed

Key orchestrator skill caches by the Apps server connection and an explicit invalidation generation. Preserve cached resources while that identity stays unchanged, and invalidate them on MCP runtime refresh requests or configuration refreshes. Replacing the connection also changes the cache identity.

## Testing

Extend the production-turn integration test to verify cache reuse across ordinary turns and approval-policy changes, refreshed skill contents after plugin invalidation without reconnecting, and fresh resource requests after a forced reconnect.

GitOrigin-RevId: 43ce059972369c4c735742e8224b60a692244b02
This commit is contained in:
Henry Levy
2026-09-16 21:41:23 +00:00
committed by copyberry
parent 73bf181272
commit 29e6bc814e
8 changed files with 130 additions and 9 deletions
+2
View File
@@ -7,6 +7,8 @@ use super::*;
impl Session {
pub(crate) fn request_mcp_runtime_refresh(&self) {
// Plugin changes can reuse connections but still change their skill resources.
self.services.mcp_runtime.invalidate_resource_caches();
self.mark_mcp_runtime_dirty();
self.schedule_mcp_prewarm();
}
+1
View File
@@ -2160,6 +2160,7 @@ impl Session {
warn!("failed to refresh MCP OAuth coordination config: {err}");
}
state.session_configuration.original_config_do_not_use = Arc::new(config);
self.services.mcp_runtime.invalidate_resource_caches();
self.mark_mcp_runtime_dirty();
drop(state);
self.schedule_mcp_prewarm();