mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-17 13:33:45 +00:00
* 🫥 fix: Clear Hidden MCP Chat Selections A server hidden with `chatMenu: false` stayed active in chat when it had been selected while still visible. The selection persists to localStorage, and the guard that clears stale selections tested the *filtered* server list — which is empty precisely when every configured server is hidden, so the guard could never fire and the selection survived every reload. Gate the prune on the unfiltered catalog instead. It is non-empty in exactly the case the old guard missed, and it stays a guard rather than a load flag so an empty catalog — still loading, or a degraded read — is never mistaken for "the admin removed everything" and used to wipe a selection irrecoverably. Clear the ephemeral agent alongside the atom: it is what carries the selection to the server, so a hidden name has to leave it too, not just the dropdown's state. Also label the dropdown badge from the servers the menu actually offers. It counted the raw selection, so a hidden server rendered as "Server Four" or "2 selected" above an empty menu — the symptom that reads as a server you cannot turn off. * 🔧 fix: Keep Spec-Assigned MCP Servers Out of the Hidden-Server Prune A model spec may deliberately assign a server the chat menu hides, and `applyModelSpecEphemeralAgent` seeds it straight into `ephemeralAgent.mcp`. The prune could not tell that apart from a stale selection, so activating such a spec dropped its server — and because the same function re-reads `LAST_MCP_` for existing conversations, the loss persisted across navigation. Exempt whatever the active spec pins. `chatMenu` hides a picker entry; it does not override an admin's spec assignment. * 🔒 fix: Confine the MCP Selection Prune to the Hook Instance That Owns It `useMCPServerManager` has seven call sites, and only `BadgeRowContext` reads the chat selection — the rest mount it for the catalog, the server actions, or the status icons. Every instance keyed to the same conversation shares one atom and one ephemeral agent, so those six were all running the prune too, and the always-mounted `useSideNavLinks` has no spec context to exempt from: it would rewrite the selection the picker's own instance was deliberately keeping. Make managing the selection opt-in, off by default at both layers, and let the badge row alone opt in. The six catalog consumers stop touching chat selection state entirely, which is what they should have been doing all along. Tests now state whether they own the selection rather than inheriting it from a default, so each one exercises the same configuration as the instance it models. * 🔁 fix: Mirror the MCP Selection Everywhere, Prune It Only in the Owner Gating the whole ephemeral-agent sync on selection ownership was too broad. The action paths — `initializeServer`'s OAuth success, the revoke handler — build their next selection from `mcpValues` and write it back through `setMCPValues`, which also rewrites the shared ephemeral agent. An unmirrored instance therefore wrote a stale list: authenticating server B could drop an existing selection of server A, leaving only B. Mirroring and pruning are separate concerns. Every instance mirrors, so each one builds on the current selection; only the owner prunes, because only it knows which servers a spec pins. |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| ActivePanelContext.tsx | ||
| AddedChatContext.tsx | ||
| AgentPanelContext.tsx | ||
| AgentsContext.tsx | ||
| AgentsMapContext.tsx | ||
| AnnouncerContext.tsx | ||
| ArtifactContext.tsx | ||
| ArtifactsContext.tsx | ||
| AssistantsContext.tsx | ||
| AssistantsMapContext.tsx | ||
| BadgeRowContext.tsx | ||
| BookmarkContext.tsx | ||
| ChatContext.tsx | ||
| ChatFormContext.tsx | ||
| CodeBlockContext.tsx | ||
| CustomFormContext.tsx | ||
| DragDropContext.tsx | ||
| EditorContext.tsx | ||
| FileMapContext.tsx | ||
| index.ts | ||
| MediaContext.tsx | ||
| MessageContext.tsx | ||
| MessagesViewContext.tsx | ||
| PromptGroupsContext.tsx | ||
| SearchContext.tsx | ||
| SetConvoContext.tsx | ||
| ShareContext.tsx | ||
| ToolCallsMapContext.tsx | ||
| UploadModalContext.tsx | ||