Skip to content

mcp: retain spawn configs so reconnect works for ephemeral/managed/builtin servers - #15535

Draft
Legoben wants to merge 1 commit into
masterfrom
bens/mcp_retain_spawn_configs_so_reconnect_works_for_ephemeral_managed_builtin_servers
Draft

mcp: retain spawn configs so reconnect works for ephemeral/managed/builtin servers#15535
Legoben wants to merge 1 commit into
masterfrom
bens/mcp_retain_spawn_configs_so_reconnect_works_for_ephemeral_managed_builtin_servers

Conversation

@Legoben

@Legoben Legoben commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

reconnect_server only looked up installations in locally_installed_servers, so every ephemeral server — managed (backend-proxied), file-based, CLI-run (oz agent run --mcp), and the built-in Factory MCP — failed reconnection permanently with "Installation not found" the moment its transport closed. The spawn consumes the installation and nothing retained it; CLI-ephemeral installs are the only carrier of resolved secrets, so the config couldn't be re-derived either.

Changes

  • spawn_configs retention: the manager keeps the exact installation each server instance was spawned with (RetainedSpawnConfig + SpawnProvenance), inserted on every spawn and removed on shutdown/delete. Entries hold resolved secrets/proxy tokens and are never logged.
  • Universal reconnect lookup (respawnable_config): consults retained configs first; locally installed servers prefer the live installation (the user may have edited it); the built-in server re-mints its bearer from current session credentials. Gated behind the new McpSelfHeal feature flag — flag off is exactly today's behavior (covered by tests).
  • Unflagged reconnect hygiene fixes:
    • the old RunningService is now cancelled during reconnect instead of dropped un-awaited (old stdio children could linger and race the respawn);
    • shutdown_server fails pending reconnect waiters instead of leaking them forever (their spawn was aborted, so the completion callback never ran);
    • authorization_urls is cleared on reconnect (was only cleared on shutdown).

Tests

cargo test -p warp --lib ai::mcp — new in-crate tests cover per-provenance lookup, the live-installation preference, builtin re-mint failure without credentials, waiter drain on shutdown, and flag-off behavior preservation.

Part of the MCP self-healing stack (see stacked PRs above/below in Graphite).

@cla-bot cla-bot Bot added the cla-signed label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant