mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-12 09:45:47 +00:00
* 🪪 fix: Adopt MCP OAuth Callback Tokens Without Re-Prompting or Losing the Lease A chat request loading OAuth tokens joins the `mcp_get_tokens` flow a catalog discovery left behind and polls it. The OAuth callback deletes that entry when it stores the new tokens, so the poll ends with "Flow state not found", the factory reports the tokens missing, drops the `mcp_oauth` flow the callback just completed, and starts a second interactive flow. Once tokens arrive, the connection leases the publication generation it captured before the wait; the callback's publication moved it, so the connection is torn down as it connects and the agent fails with AGENT_EXPECTED_MCP_TOOLS_UNAVAILABLE. `createFlowWithHandler` now serves a completed result at once, monitors only pending attempts and retained failures, and replaces a failure nobody retains; a waiter whose flow disappears gets `FlowStateNotFoundError`. The factory treats that as a credential change: it re-reads storage once, after letting the connection build re-capture its generation. The authorization transaction and a silent refresh attach the generation they publish to the tokens they release, and a build adopts that generation for credentials obtained after its capture. * 🪪 fix: Claim Flow Attempts Atomically and Lease Under the Stored Generation A connection now adopts a carried publication generation only while it is the generation currently stored, instead of comparing the token's exchange time to its capture, so a callback that exchanged before the build began and published after it is still adopted and a retired generation still leaves the fence in place. Installing a flow attempt is an atomic compare-and-set against the attempt the caller observed, on Redis and on the default in-memory store, so concurrent replacements of a failed attempt, or concurrent creations of an absent one, run one handler while the rest join it. An aborted caller is rejected before a cached result is served, and a joiner that aborts leaves the shared flow to its owner and the other waiters. * 🪪 fix: Return Generation-Tagged Callback Tokens and Route Flow Claims Through the Cluster Executor The authorization transaction now returns the same generation-tagged tokens it releases to the OAuth completion and the pending token waiters, so the callback route's tool-flow completion carries the published generation to the connection waiting on it. The Action OAuth and index-sync flow managers pass the cluster-aware Redis script executor, so their flow claims and guarded settlements route through slot-master selection and READONLY recovery instead of the raw client. |
||
|---|---|---|
| .. | ||
| connect.js | ||
| index.js | ||
| index.spec.js | ||
| indexSync.js | ||
| indexSync.spec.js | ||
| models.js | ||
| utils.js | ||
| utils.spec.js | ||