A local session's toolsets and MCP server definitions are frozen in its launch
policy, so after `/reload-mcp` (or Desktop's MCP add) connected a server added to
config, the session's frozen selection filtered the new server out: the reload
answered "added: fixt" and the chat never got the tool, open or resumed. Main
merged newly enabled servers into the session's toolsets on reload.
- The MCP server set changes only through CFG-2's gateway-committed,
generation-fenced refresh (idle checked inside the write transaction): the
session's own selection (explicit pick or platform allowlist, `no_mcp`,
disabled entries respected) of its profile's current servers, their names in
the toolsets and their definitions in the session config, private values split
into the session's config-secret scope as at creation. A managed worker binds
that config, so it connects exactly the servers it names. Bypass and editor-MCP
sessions keep their frozen set; config is read from the session's own profile.
- `reload.mcp` (CLI, Desktop) commits it for the calling session when idle
(`session: applied | unchanged`); while a turn runs or waits it changes nothing
and says so (`session: busy`): the tools apply once the turn finishes and reload
runs again, or when the chat is reattached. Other sessions take the new servers
when a client next attaches. A queued or running turn never gains a capability.
- `reload.mcp` names configured servers that did not connect: the
`mcp_servers_unavailable` refusal when nothing took effect (no server
registered or removed, no session generation committed; a server reconcile
only attempted does not count), otherwise success with `unavailable`.
`ReloadMcpResult` gains `session` and `unavailable` (TS and OpenRPC contracts
regenerated). Desktop's save, connect and reconnect paths read both: a busy
chat gets a notice that the change applies after its turn and another reload
or on reattach, unavailable servers are named, and connect/reconnect claim
success (and reconnect clears its failure marker) only when the chat runs the
server. Messaging `/reload-mcp` appends a "did not connect: ..." line.
`mcp_servers_not_connected()` ignores the connect cooldown, which hid a
just-failed server.
The failed-server naming rebuilds the idea of #136778 (bfea327b) in the
gateway handler; that PR's backend targets the legacy tui_gateway sidecar
path.
Refs #134889 (CFG-3)
Refs #139523
Co-authored-by: fyzanshaik <fyzan.shaik@gmail.com>