Recover capability discovery after executor disconnects (#38420)

## Why

Transient executor disconnects could leave capability discovery and skill catalogs
stuck on a cached failure for the rest of a thread, even after the executor
reconnected.

## What changed

- Replay capability discovery after executor recovery and retry transient failures
  on later requests while continuing to cache permanent failures.
- Avoid caching skill catalogs produced from failed discovery so a later step can
  load the recovered catalog.
- Mark the MCP runtime dirty when recovered manifests change the projected MCP
  servers, and allow discovery to be cancelled with the turn.

## Testing

- Cover same-request recovery after a disconnect and recovery on a later request.
- Cover retry classification through connection-attempt errors and skill catalog
  caching after discovery recovers.

GitOrigin-RevId: a57f90844351e73ea831931f72a9ddc4e4f3335c
This commit is contained in:
hesham-oai authored and copyberry committed 2026-08-13 19:14:30 +00:00
1 parent 9946da9af1
commit 588e18aae5
10 files changed
+285 -31

No files matched your search

+8 -5
View File
@@ -422,11 +422,14 @@ impl Session {
})
.cloned()
.collect::<Vec<_>>();
Some(Arc::new(
cache
.snapshot(&selected_capability_roots, &sandbox_contexts)
.await,
))
let discovery = cache
.snapshot(&selected_capability_roots, &sandbox_contexts)
.await;
if cache.take_recovered_discovery() {
// Root selection is unchanged, but recovered manifests can change MCP servers.
self.mark_mcp_runtime_dirty();
}
Some(Arc::new(discovery))
}
pub(crate) async fn resolve_selected_capability_roots_for_step(