fix(mcp): restart the eager session boot after a session sync drops the pool

SyncSession (sent at TUI launch and on resume) calls drop_mcp_pool, and the old comment said configured servers 'reconnect lazily'. With eager connect as the default nothing started the boot again, so /mcp status (Show -> bootstrap_mcp) read a fresh pool and reported every server 'not connected' while the cached boot snapshot still said connected (2). Reproduced on the installed 0.10.2 (8642ccbdc5) with the journey fixture: /mcp status as the first MCP command showed all three not connected, repeatably. After the sync handler, an absent pool now starts start_mcp_session_boot(IfChanged).

After: the same repro on the debug build shows eager and required connected; nextest tui lib filter mcp|sync_session|session_boot: 629 passed, 0 failed. Known cost: the fixture server logs two starts, the first pool's connection is discarded by the sync.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
CodeWhale BotandClaude Sonnet 5.5 committed 2026-10-10 16:54:22 -07:00
1 parent 8642ccbdc5
commit aeb4207f29
1 file changed
+12 -2
+12 -2
View File
@@ -3030,8 +3030,8 @@ impl Engine {
// authoritative schedule makes that token fail closed when drained.
self.scheduled_goal_continuation = None;
// Runtime-added MCP servers are conversation capabilities even when
// both conversations use the same workspace. Configured servers can
// reconnect lazily after the new session is installed.
// both conversations use the same workspace. The sync handler restarts
// the session boot once the new session is installed.
self.drop_mcp_pool();
// C02-17: cumulative usage belongs to the conversation that spent
// it. The sync carries no prior total for the installed session, so
@@ -3939,6 +3939,16 @@ impl Engine {
};
self.session.rebuild_working_set();
self.reconcile_restored_work_bindings().await;
if self.mcp_pool.is_none()
&& let Err(error) = self
.start_mcp_session_boot(McpConnectRefresh::IfChanged)
.await
{
tracing::debug!(
"MCP session boot failed: {}",
crate::mcp::format_mcp_error_for_display(&error)
);
}
// SessionUpdated acknowledges the sync. A generic status
// would immediately cover the host's confirmed resume receipt.
self.emit_session_updated().await;