pub fn elect_unmatched_server(
servers: &[McpServerStatus],
configured: &[ConfiguredMcpServer],
roots: &[RootProcess<'_>],
) -> Option<(u32, String)>Expand description
Pair the sole unmatched Connected stdio server with the sole unmatched
candidate process, returning that process’s pid and the name its row takes.
A join by ELIMINATION, not identity - nothing observable ties a server to its process - so two leftovers on either side decline rather than guess.
What the Connected filter buys is narrow, and it is not liveness: it only
guarantees the name attached comes from a server the CLI last reported as
connected, so a Pending or Failed server can never lend its name. It
does NOT establish that the elected process belongs to a live server. A
server that connected and then died still reads Connected until the CLI
notices, and there is no liveness signal on the wire to check - so in that
window the sole remaining candidate can be paired with a dead server’s name.
Declining on snapshot age would not help: in that case the snapshot is fresh
and still says Connected.