LibreChat/packages/api
Danny Avila 253112ff8d
🧷 fix: Close Only Scheduled MCP Authority at Request Cleanup (#17354)
* 🧷 fix: Close Only Scheduled MCP Authority at Request Cleanup

resolveScheduledMCPBearerConfig runs on every MCPManager.callTool, and it
threw ScheduledMCPBearerError('binding_mismatch') whenever the request
context had started cleanup, before checking whether the context was
scheduled at all. A detached subagent keeps its parent turn's MCP request
context; once the parent turn ended, every pooled MCP call from the child
threw that error, and with no scheduled identity bound the receipt
recorder fenced it as "Scheduled generation is no longer current."

Unscheduled contexts now return the declared config before the cleanup
check, as pooled calls did before #16699. A scheduled context still
denies after cleanup (scopes are never cleared), quiesce stays
unconditional, and request-scoped servers still refuse a closed context
at connection checkout.

* 🧪 test: Cover Pooled Connection Creation After Request Cleanup

The pooled-call integration test made its first call before cleanup, so
it only reached the resolver on connection reuse (MCPManager.callTool).
A detached child's first call to a server its parent never used, or a
call after idle eviction, creates the pooled connection instead
(UserConnectionManager -> MCPConnectionFactory). The new case cleans the
context first and then makes the first pooled call, so a cleanup check
added at either creation site now fails CI.

The resolver comment now says why the early return is safe for every
unscheduled context: request-scoped checkout refuses a closed context.
2026-10-23 07:13:22 +02:00
..
openapi 🗑️ feat: Expose Skill Deletion in Management API (#17005) 2026-10-16 09:05:03 -07:00
src 🧷 fix: Close Only Scheduled MCP Authority at Request Cleanup (#17354) 2026-10-23 07:13:22 +02:00
types
.gitignore
babel.config.cjs
jest.config.mjs 🧑‍✈️ feat: Enroll Machines Through Explicit Browser Approval (#17344) 2026-10-22 16:54:00 +02:00
jest.setup.cjs
package.json 🧑‍✈️ feat: Enroll Machines Through Explicit Browser Approval (#17344) 2026-10-22 16:54:00 +02:00
tsconfig.build.json
tsconfig.json 🥟 ci: Type-Check Workspaces with bun check (#17009) 2026-10-12 06:40:07 -04:00
tsconfig.openapi.json
tsconfig.spec.json
tsdown.config.mjs 🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261) 2026-10-19 22:13:31 +02:00