* feat: resolve executing agent ids in MCP header templates
* test: preserve MCP config source literal types
* 🪪 feat: Forward the Active Agent Id in Request Header Placeholders
A gateway in front of LibreChat sees the user, the conversation and the
message, but not which agent is running — so it cannot attribute spend per
agent, apply per-agent limits, or tell agent traffic from plain chat. Adds
`{{LIBRECHAT_AGENT_ID}}` as its own namespace beside the user / body / OpenID
ones, resolving wherever the existing request placeholders already work.
The value is the primary agent's, derived once per run, so subagent steps and
auxiliary calls (summarization, titles, activity labels, memory extraction)
forward the id of the turn they belong to rather than their own. Only
persisted agents resolve: ephemeral ids embed user-authored preset text that
is unsafe in a header value, so ephemeral runs and non-agent requests resolve
to an empty value rather than forwarding literal template text.
No behaviour change unless the placeholder is configured. The MCP surface
(#14303) is not covered — its connection classification derives from
`ALLOWED_BODY_FIELDS`, so a new namespace needs a follow-up.
(cherry picked from commit 8a3f1016f0)
* test: cover shared provider and MCP agent header resolution
* docs: clarify absent agent placeholder resolution
* fix: preserve agent header boundaries across transport lifecycles
* fix: retain Google header provenance during agent resolution
---------
Co-authored-by: Jiří Krejčí <51734696+krejcji@users.noreply.github.com>
* 🚪 fix: Refuse Interactive MCP Sign-in on Remote Agent API Runs
A run started through the remote agent API (API key or OIDC bearer) has no
signed-in browser reading its response. When one of the agent's MCP servers
needed OAuth, the run still published LibreChat's sign-in prompt into the
OpenAI-compatible response and waited up to two minutes for a sign-in the
caller could not complete.
The remote auth middleware now marks the response it admits. The prompt
emitters refuse to write to a marked response, and tool loading skips the
turn-start wait when no reader exists. Background Responses keep their
prompts: those go to the generation stream the owner follows in LibreChat.
* 🧭 refactor: Pass the Unattended Fact Explicitly and Release Unattended Callers From Shared Sign-in
Review feedback on the first commit:
- The response registry coupled the auth middleware to MCP through module
state. The remote controllers now supply `unattended` as an argument
(chat completions always; Responses through the runtime's tool context,
foreground only) and it is passed through tool loading to the manager and
the prompt transports. The registry and the middleware side effect are gone.
- A remote run that reached a server while its owner had a sign-in open in a
browser joined that recovery and waited for the person. The manager now
guards an unattended caller at its two entry points: the first sign-in
prompt, from the caller's own flow or from a recovery it waits on, ends that
caller's wait with a typed error and leaves a shared recovery running for
its other waiters. A recovery announces a sign-in request so waiters that
registered no prompt handler are released too.
* 🧪 test: Cover Unattended Sign-in Through the Real MCP SDK
The shared-sign-in tests replaced the production OAuth handler with a
synthetic listener, so they did not exercise the SDK lifecycle whose
cancellation and shared-recovery behaviour the change depends on.
They now run against the real Streamable HTTP test server, the real
connection factory handler and the real flow manager: an unattended tool
call alone, alongside the owner's open sign-in, joining a recovery that
then stops being silent, recovering through a silent refresh, and opening
a connection that needs sign-in. The synthetic-handler versions are removed.
* 🦠 chore: Upgrade Node.js and Undici to Security Releases
* test: Wait for Restored Composer Readiness and Reuse Wrapping Config
---------
Co-authored-by: Lia <lia@librechat.ai>
* fix: Advance Slack Account Linking in Place
* fix: Narrow Slack Reply Transport Contract
* fix: Make Slack Link Reply Updates Monotonic
* fix: Clear Invalidated Slack Link Cards After Delayed Writes
* fix: allow members to connect agents to installed Slack workspaces
* fix: clarify Slack destination assignment actions
* fix: align Slack assignment status with destination heading
* fix: explain Slack agent assignments in terms of the connected bot
* fix: separate Slack connection setup, management and confirmation
* fix: name replaced agents only when the member can view them
* perf: avoid redundant Slack assignment identity lookups
* fix: Allow Admins to Remove Disconnected Slack Workspaces
* fix: Use Workspace Status Chips and One Confirmation Action
* fix: Confirm Workspace Removal in a Stacked Dialog
* fix: Align Confirmation Cancel Action to the Left
* 👤 feat: Link and Revoke Personal Channel Accounts
* fix: Own Channel Link Lifetimes and Complete Channel Entry Points
* fix(channels): activate trusted link URLs with account page
* fix: Preserve Personal Consent for Channel Managers
* test: preserve channel fixture in upstream agent selection cases
* 🧷 fix: Promote Unapplied Steers to Durable Queued Turns at Run End
A steer the server accepted (202) but the run never applied was handed back
in FINAL as `pendingSteers` and re-owned by the browser as a tab-local queued
message. A reload, closed tab, or a predecessor race before the drain lost it.
At terminal publication, a normally completed run now promotes such steers
into server-owned agent queued turns (parent: the ended response, epoch: the
ended generation's createdAt, chained behind any turn already queued against
that epoch). The job store hands the parked copy over atomically
(`promoteSteerLeftover`: parked item removed, receipt settled `recovered`), so
status recovery, lost-ACK retries and legacy recovery starts cannot queue the
same words again. FINAL reports the receipts in `promotedSteers`; the client
adopts them as server rows instead of converting the steer locally.
Promotion is opt-in per steer (`promoteLeftover`, sent only by clients that
adopt receipts and only for steers with no tab-only context), so older
clients keep the legacy path unchanged, and older servers simply never
report `promotedSteers`.
* 🔒 fix: Settle a Promoted Steer's Hand-Off at Admission, Not Only at FINAL
The job-store hand-off of a promoted steer now returns an outcome and stamps
the receipt with the owning queued turn, so it is idempotent for that turn.
The queued-turn resolver repeats it before admitting a promoted turn: it
completes a hand-off a crash interrupted, and cancels the turn when the
parked copy was discarded or recovered elsewhere, so the words never run
twice. At FINAL, a row whose hand-off was refused and whose retirement cannot
be confirmed is withheld from `pendingSteers` and left for that admission
check. The conservative reconcile frame keeps `promotedSteers`, and the
client adopts it there before sweeping local chips.
* 🔏 fix: Give Promoted Steers Durable Ownership, Their Run's Queue Lineage and Approval Mode
A turn promoted from an unapplied steer now records its source on its own
row: the steer's ids, the generation that accepted it, and a mark set only
once the job store handed the parked copy to that row. Admission runs a
promoted turn on that mark or on a hand-off the job store confirms now;
without proof (the store's evidence expired, or the host cannot ask) the
turn is held for review instead of running.
- Hand-off replies that are lost no longer cancel the row. The row stays as
the client's handle and its admission settles ownership, so a committed
hand-off can no longer leave the steer with no runnable copy.
- A replayed promotion never hands the parked copy to a row that was
cancelled or failed.
- Promoted turns join the queue lineage of the generation that accepted
the steer, so a sibling still queued behind that run no longer strands
them with a predecessor mismatch.
- The steer request carries the sender's code approval mode onto the
promoted turn; an unreadable mode keeps the steer on the client path.
- A steer whose quotes its owner stripped stays on the client path.
- The queued-turn receipt names the promoted steer by both ids, and the
receipt list retires a pane's local copies even when it missed FINAL.
* 🚧 fix: Fence Promoted Turns to Workers That Prove Steer Ownership
A promoted row without an approval mode was published under the v1 queued
turn capability, so during a rolling deploy a worker that predates the
ownership check could claim it and run an unsettled row while the parked
steer was still recoverable elsewhere.
Promoted rows now publish under a new agent_queued_turn_v3 capability and a
v3 delivery identity, always reserved before insertion. A replica that
projects an older version can neither publish the reserved delivery nor
claim it, and enqueue refuses a promoted row without a reservation.
* 🪦 fix: Keep a Dead Promoted Turn Answering for Words It Held
A pane that learns of a promoted steer from the receipt list dropped the
mapping for every dead row. A row quarantined as ADMISSION_INDETERMINATE can
still settle as admitted, and a row that died after it was proven the sole
owner of the words is their only surface, so in both cases the pane kept a
chip whose recovery could never run.
The receipt now says whether the turn owned its steer's words, and a dead
receipt keeps answering for them when it did or when its admission is
indeterminate. A replayed promotion applies the same rule to a settled row.
* 🧾 fix: Find Promoted Turns by the Steer a Pane Holds, Join Root Lineages, Redact Hand-off Errors
- A promoted turn's request id is now derived from the client steer id, and a
pane asks for the receipts of the steers it still holds a local copy of
(recovery rows and failed chips). A promoted turn that already ran is only
listed when asked for by name, so a pane that missed FINAL now finds it
and retires its copy. A client steer id too long to key a queued turn is
not promoted.
- The lineage lookup includes a generation admitted from a root queued turn,
which has a parent and no epoch. The promoted turn joins that lineage
without an epoch instead of opening a second one.
- A failed hand-off at admission reports a fixed message. The job store's
own error text stays out of the dead-letter record a client can read, and
promotion logs carry safe error metadata instead of error text.
* 🔢 fix: Ask for Held Steers First Under the Receipt Lookup Limit
The receipt list answers for at most 100 request ids, and a pane's server
rows were listed ahead of the steers it still holds, so a full server queue
could push every held steer out of the request. A promoted turn that had
already run was then never found.
Held steers now come first. An active server row is listed whether or not
it is asked for, while a settled promoted turn is found only by name.
* 🦊 feat: Add Claude Fable 5.2 Support
* fix: Preserve Snapshot Version Boundaries in Model Matching
* test: Measure the Snapshot-Safe Token Matcher Search
---------
Co-authored-by: Lia <lia@librechat.ai>
* perf: Validate Agent Models Against Their Own Endpoint Catalog
* perf: Share In-Flight Model List Fetches
* test: Cover Agent Model Validation Across Endpoints
* test: Check Agent Model Catalog Parity With the Real Loaders
* perf: Look Up MCP Server Catalogs Concurrently for Tool Definitions
* test: Cover MCP Sign-In Order for Concurrent Catalog Lookups
* docs: Widen the mcpCatalogLookups Comment in the Example Config
* test: Cover the Catalog Lookup Bound Passed to the Definitions Loader
* perf: Read Only the Active Branch for Turn History
* perf: Narrow the History Read Only When It Skips a Tenth of the Rows
* test: Cover Follow-Up Turns After a Regenerated Answer
Bound model-facing Flux images to the 5 MiB base64 budget for standard and finetuned generation. Preserve original image data for attachment storage under the existing resolution policy.
Fixes#6954.
* fix: Read the Account and Session Together and Test Cancel on a Real Database
- Start the setup user and refresh session lookups together in the cancel controller instead of one after the other, as the opt-in confirmation already does
- Run the cancel controller spec on mongodb-memory-server with the real data-schemas methods, so the session and compare-and-swap predicates under test are the production ones, and add a negative case for each
- Keep only a module wiring test in the CJS controller spec, since the database behavior is now covered where it can run for real
* test: Pin the Cancel Response When the Session Lookup Fails
Both lookups now run before any cookie or write, so a failed session lookup answers 500 with the browser and the stored state untouched. Cover that on the real database.
* fix: Keep the Saved Files Draft Until the File List Loads
After a reload the live file map is empty until the server's file list arrives, and the restore that rebuilds it needs that list. The save effect rewrote the stored draft from the empty map in between, so a pasted-text chip or any other attachment was gone before it could be restored. It now waits for the list. This is what turned the composer-attachments restore scenario red on dev.