* feat: Record Lane Git State and Serve Conversation Pull Requests
A conversation now stores the branch, head and repository its code lane last reported, written only by the server after a finished bash command and excluded from ordinary reads, generic saves, unset fields and imports. GET /api/convos/:conversationId/pull-request finds the pull request for that branch through an injected GitHub source with a bounded cache, answers null for an absence, and maps failures to stable codes without upstream text. The feature is off unless endpoints.agents.pullRequests is enabled with a token reference.
* fix: Address Review Findings on Pull Request Lookup and Lane Writes
Scope the lookup cache, shared in-flight request and rate limit cooldown to the credential, so one tenant's token never serves another. Ask for open pull requests on their own before falling back to the newest closed one, read every page of check runs up to a bound and never report an incomplete rollup as passing, order lane writes per conversation so an older write cannot land last, and name both required token permissions in the example config.
* fix: Address Second Round Review Findings on Pull Request Lookup
Clear the stored lane when the conversation moves to another workspace or leaves attached execution, so the previous workspace's pull request is never served. Fence the lane write on the time it was reported, so an older report from another replica cannot replace a newer one. Honor GitHub's reset window up to an hour instead of ten minutes, and expose the request timeout, whole lookup timeout and check run page limit as endpoints.agents.pullRequests settings with the previous values as defaults.
* fix: Authorize Pull Request Repositories and Fence Lane Writes
Require an administrator allowlist of repositories before the server token is used, since a worker reports its own repository. Match a pull request to the commit the conversation last ran at, so a reused branch name does not return another pull request. Fence the lane write on the workspace the command ran in, so a write queued before a move cannot bring the old lane back, and record a subagent thread's lane on the visible root conversation. Key the lookup cache and shared request by the recorded commit and the lookup policy, and document the worker flag in the example config.
* fix: Order Lane Reports by a Database Sequence and Tighten Head Matching
Replace wall clock ordering of lane reports with a per conversation counter reserved in the database when the command settles, so replica clock skew cannot reject a newer report. Treat a pull request whose head is behind the recorded commit as no match, and expose the candidate and comparison bounds of the history search as settings. Read the app config and the owner scoped lane together, inject the HTTP transport from the route instead of falling back to a global, skip a report identical to the last one written, and name the Contents permission that commit comparison needs.
* fix: Queue Lane Reports by the Visible Conversation and Read Checks for the Current Head
Order lane report reservations by the conversation the write lands on, so two subagent threads of one conversation share a chain, and write every report instead of skipping a repeat, since another recorder may have changed the lane in between. Read a pull request's detail before its check runs and use the head it reports, so line counts, mergeability and checks describe one commit. Treat an expired temporary chat as gone when reserving, writing and reading the lane, and make the shared cache capacity a setting.
* fix: Fence Lane Reports by Attachment Epoch and Place Recorders Before Reporting
Strip dotted descendants of lane fields from saves and imports, partition the pull request cache per credential, resolve the lane write target when the tool is created, and fence reports with a codeAttachmentEpoch that advances only on an owner move or detach.
* fix: Fence Subagent Lane Reports by the Root Epoch and Cover Forks and Moved Heads
Read the visible root's attachment epoch for a subagent report, gate lane recording on pullRequests.enabled, make the credential partition bound a config field, revalidate the detail head against the recorded commit, and find fork pull requests through the recorded commit.
* fix: Keep the Credential Cache Bound Deployment Wide and Budget Head Revalidation
Apply the largest configured credential bound to the shared cache, count cache hits as use, spend the comparison budget on a moved head, and fix the data-provider config default test.
* fix: Cool Down Headerless Secondary Rate Limits
A 403 whose message names a secondary rate limit now starts the credential cooldown for at least a minute instead of being cached as a ten second failure.
* fix: Keep Reasoning Out of Every Read Aloud Path
Read aloud spoke the Thoughts section along with the answer. The hover
button flattened think parts into the string it handed to TTS, browser
autoplay and the hooks parsed content without skipping reasoning, and
server streaming spoke the stored text field, which an aborted turn
persists with its reasoning included.
Add getSpeechText to data-provider as the single source for spoken text:
text parts only for structured content, and the legacy :::thinking block
stripped from plain text, treating a still-open block as reasoning so
streamed speech only ever grows. Route the hover button, browser
autoplay and server streaming through it, and skip reasoning in the TTS
hooks' own content parsing.
* fix: Speak String Message Content Without Its Reasoning
Imported or client-built messages can carry their answer as string
content rather than parts; read it like plain text instead of falling
back to an empty text field.
* fix: Keep Answers Between Repeated Legacy Thinking Blocks
Strip every closed :::thinking block before treating an unterminated one
as reasoning, so a second closed block no longer swallows the answer
that follows it.
* fix: Skip Read Aloud and Autoplay When Only Reasoning Remains
A turn stopped mid-reasoning has no answer to speak once reasoning is
filtered. Gate autoplay on the same speech text it will play, so the
external engine never opens a stream that can only time out, and hide
the Read aloud action when there is nothing to read. Every speech path
reads a finalized message, so speak an unmatched :::thinking marker as
the answer text the UI shows instead of dropping the rest.
* refactor: Move Speech Chunk Polling Into packages/api
The decision of what text to stream as speech lived in the legacy CJS
service. Move the chunk processor to packages/api as
createSpeechChunkProcessor, taking the message cache and lookup from the
caller, and leave streamAudio.js wiring them in. Its tests move with it
onto an in-memory cache instead of module mocks.
* fix: Speak Exactly the Answer the Message View Shows
Share the legacy :::thinking parser between the message view and speech,
so Read Aloud strips the same block the view collapses instead of a
separate pattern drifting from it. Trim structured speech text so a
whitespace-only answer is not speakable, and key autoplay's audio cache
by the spoken text, as manual playback already is, so audio cached with
reasoning before this change is never replayed.
* fix: Fall Back to Text When String Content Is Empty
* 📴 fix: Finalize Compaction Snapshots and Move Abort Policy Into packages/api
* 🔕 fix: Inspect Every Part When Finalizing and Reuse the Loaded Row
* 📴 fix: Settle Finalized Compaction Rows and Verify Their Anchor
* 📴 fix: Withhold the Unanchored Abort Final and Settle Marked Snapshots
* 📴 fix: Consolidate the Compaction Abort Policy Into One Injected Operation
* 📴 fix: Settle the Live Compaction Row Past an Anchor-Shaped Collision
* 📴 fix: Lift the Failed-Turn Settlement Into the Compaction Module
* 📴 fix: Keep a Removed Round's Failure and Guard Settled Jobs From Snapshots
* ⚡ perf: Read Only the Anchor Id in the Abort Existence Check
* 📴 fix: Withhold the Abort Final Only When a Row Needed Writing
* test: Cover Stopped Compaction Finalization and the Missing Anchor in E2E
* fix: Withhold a Stopped Compaction That Carries No Anchor Id
* fix: Settle Stopped Compactions, Announce Finalized Rows, and Own the Abort Read in packages/api
* test: Accept the Model Spec Query on the Stopped Reply Conversation URL
* fix: Report the Anchor Read Failure Beside a Withheld Compaction Abort
* fix: Synthesize a Compaction Failure Only for a Round After the Latest Outcome
* fix: Skip the Anchor Read When a Stopped Turn Writes No Row
* fix: Decide the Disconnect Snapshot Gate in packages/api
The last-subscriber partial save now asks resolveDisconnectSnapshotMode for
the settled-job decision instead of branching on the job record in the CJS
controller.
* fix: Leave an Already Settled Compaction Row to the Path That Settled It
* 📴 fix: Persist Cancelled Compactions With Their Identity
* 🧪 test: Build the Cancelled-Compaction Leaf on a Real Conversation
* 🧪 test: Assert the Withheld Controls on the Live Cancelled Compaction
* 📴 fix: Keep Live Disconnect Compaction Rows Free of a Synthesized Failure
* 🧪 test: Cover the Compaction Flag in the Redis Job Round Trip
* 📴 fix: Keep a Stopped Compaction Honest and Its Anchor Untouched
* 🧾 perf: Load Tool-Call Previews and Fetch Full Parts on Demand
Long agent conversations shipped every tool output, argument string and
subagent transcript on load, though the cards render collapsed: 12-18 MB
of message JSON per chat, enough to crash iPhone Safari tabs.
A client that adds ?toolPreviews=1 to the conversation load now receives
bounded previews of settled tool calls (start and end of long outputs,
JSON arguments and outputs kept valid with only their longest strings
shortened, exit-status trailers kept whole, subagent transcripts omitted)
with explicit markers and full lengths. Opening a card or a subagent
panel fetches the stored part from a new owner-scoped endpoint,
GET /api/messages/:conversationId/:messageId/parts/:partIndex, cached
under its own React Query key. Clients that do not ask, exports and share
links keep the full payload; bounds are configurable under
toolCallPreviews in librechat.yaml, and a client-authored message that
carries previews is refused rather than saved.
* 🧾 fix: Validate Part Reads in Parallel and Preview Fork Responses
The full-part read now starts beside conversation-access validation
instead of after it, and keeps the active-job fallback the conversation
read has, so a conversation still live before its first save can expand
its previews. Fork, duplicate and shared-link fork responses honor the
preview parameter, so they no longer seed the conversation cache with
the full history. Background-task results whose structure cannot fit a
valid JSON preview go whole, image cards keep their prompts, and the
subagent panel offers a retry when its stored part fails to load.
* 🧾 fix: Key Hydrated Parts by Preview Revision and Call Identity
A fetched part is now cached under the preview's revision and replaces
only the fields the server shortened, so a call whose stored output
changes later (a harvested background result) is fetched again rather
than rolled back. Part lookups carry the run-step and agent identity and
refuse an ambiguous fallback, since provider tool-call ids can repeat
within one response. A subagent that finished without final text has
its transcript omitted like any other settled call, and JSON nested past
a fixed depth falls back to a text preview; a call whose preview fails
is sent whole instead of failing the conversation load.
* 🧾 fix: Release Hydrated Parts With Their History and Bound JSON Work
Full tool-call parts fetched for a conversation are removed when its
message history is released or cleared, so they cannot outlive it under
their own key. The structure-preserving JSON preview now bails out before
cloning when the value has more nodes or strings than could ever fit,
keeps a __proto__ key as ordinary data, and the part endpoint accepts any
safe-integer index instead of an arbitrary ceiling.
* 🧾 fix: Count Property Names Before Cloning a JSON Preview
Property names are never shortened, so the pre-check now adds their
length to its budget and falls back to the text preview before any
cloning when they alone could not fit.
* 🧾 fix: Preview Artifact and Branch Responses and Rehydrate Subagent Prompts
Artifact edits and parallel-response branches merge the message the
server returns into the conversation cache, so both requests now ask
for previews and their routes honor it. The subagent panel reads the
prompt from the stored arguments once they load, and the part endpoint
no longer caps identifier length, so any previewed call can be fetched.
* 🧾 fix: Preview Only Tool Calls That Can Be Fetched Back by Identity
A call without an id has nothing but its position to name it, and the
position can shift on the client, so it is left whole instead of being
previewed. The part endpoint now requires a tool-call id, so an indexed
lookup always confirms the call it returns.
* 🧾 fix: Fetch Parts by Exact Identity and Preview Only Unique Ones
The part endpoint now finds a call by its exact identity (provider id,
run-step id, agent) instead of trusting the client's index, and the
preview pass only shortens calls whose identity is unique in their
message, so every preview names exactly one stored part. Legacy
web-search failures that carry their error phrase mid-output go whole,
since the collapsed card reads that phrase anywhere.
* 🧾 fix: Bound the JSON Fit Walk Before Queueing and Normalize Empty Identities
The structure check now counts an array's or object's children against
the node budget before queueing them, so a very wide value is refused
without building a work list its size. An empty run-step or agent id is
treated as absent by the part lookup, matching how the preview pass and
the client already treat it.
* 🧾 fix: Key Fetched Parts to the Stored Version and Hydrate Search Details
Each preview now carries `previewRevision`, when its message last
changed, and the client keys fetched parts to that plus a fingerprint of
the whole preview, so any change to the stored call is fetched again.
The web-search details card asks for the stored call when it opens, so
its query is never left shortened.
* 🧾 fix: Cache Fetched Parts by Identity and Hold Copy Until Hydrated
The part query key drops the client-side index, which only rides along in the request; the server locates the call by message and exact identity, so a shifted index serves the cached copy instead of downloading it again. Copy controls inside a previewed part are disabled until the stored content arrives, so a slow or failed fetch cannot export shortened text.
* 🧾 fix: Shape Shared Forks With the Recipient's Bounds and Keep JSON Numbers Exact
A shared-link fork resolves the share owner's config for its content checks, but the forked conversation belongs to the requester, so its preview bounds now come from the requester's tenant and role (prepareResultToolCallPreviews). A structure-preserving JSON preview now requires every number in the text to survive a parse and re-serialization as the same value; an integer past 2^53, an out-of-range exponent or an over-precise decimal falls back to the text preview (or the whole output for parsed-output tools) instead of showing a changed value.
* 🏝️ fix: Let a No-Workspace Turn Carry a Remembered Approval Mode
A conversation set to run without attached workspaces failed every turn with
"The selected code approval mode is not permitted by the current policy" when
the reader had picked Accept edits or Full access for a workspace earlier.
With no attached target, the server validated the requested mode against an
empty policy that only allows ask. A turn with no attached target now accepts
any known mode, resolves it to ask for the run, and keeps the conversation's
stored mode instead of overwriting or unsetting it. Unknown values are still
rejected, and any attached target, including a subagent's, keeps the strict
check.
The composer treated an explicit no-workspace chat as still running on the
agent's default machine, so it kept offering and submitting the remembered
mode. It now offers no attached mode there, and the submit path sends ask
whenever the turn resolves to run without a workspace.
* fix: Leave an Unset Approval Mode Unset on a No-Workspace Turn
A turn without an attached target seeded the conversation's approval mode
from the request when the row stored none. A current client sends the gated
ask there, so the first no-workspace turn of a new chat wrote ask and
replaced the remembered pick the composer would otherwise keep offering.
Such a turn now only carries forward a mode the conversation already stores;
a stored mode still comes only from a turn that validated it against its
attached targets.
* fix: Gate the Approval Menu on the Resolved Workspace Mode and the Saved Conversation
The composer hid attached approval modes only for a chat that recorded a
no-workspace decision, while useCodeWorkspace also resolves one for a saved
chat with no recorded decision and for a draft still choosing. The approval
menu, the queued-turn snapshot, and the submit path now read the mode the
composer resolved, so the control matches what the turn sends.
A no-workspace turn kept the mode of the row admission loaded, but a turn
sent with overrideConvoId is saved under another conversation; the stored
mode is now read only when that row is the conversation being saved.
* fix: Preserve the Saved Conversation's Approval Mode Through a No-Workspace Turn
A no-workspace turn chose what to record from the row admission loaded, but
a turn sent with overrideConvoId is saved under another conversation while
its unsets are still computed from that loaded row, so either the source
row's mode was copied onto the target or the target's own mode was unset.
Such a turn now records no mode and declares codeApprovalMode preserved:
the conversation write skips it when computing unsets, so the stored mode of
whichever conversation the turn is saved under stays as it is, and a chat
that stores none keeps offering the remembered pick. Turns with attached
targets record exactly the mode they validated, as before.
* 🧭 feat: Let a Parent Choose Its Subagent's Code Machine Per Call
A parent agent can now pass optional `machine` / `workspace` arguments on a
subagent call to pick where the child runs, using the host-argument
extension point added to @librechat/agents.
- Each lazy child declares enums built only from machines it may reach:
admitted in the conversation's sealed codeWorkspaces, on its default or
allowlist, in the requesting principal's tenant-scoped list, and served by
a ready worker. A child the conversation pinned to a machine offers only
that machine; a child with no reachable machine declares nothing.
- On use, a request-scoped routing session in packages/api re-validates the
choice against the current request and live worker status and refuses an
invalid one with a typed, model-visible error instead of falling back. A
routed child is pinned to the chosen machine at every routing site,
overriding parent inheritance.
- Omitted arguments keep inherit-by-default routing, extended so a child
follows the machine a per-call-routed parent runs on (passing through
agents without code). A subagent keeps one machine for the whole request.
- A child whose default workspace is unavailable stays guarded unless it has
per-call choices; then it stays callable and its description asks the
parent to pick a listed machine.
- Routed children keep their tool context per execution for tool loading,
provisioning and artifact handling.
- Paused-approval bindings, the attached-machine policy hook, skill-file
priming and tool-output references account for per-call choices.
The declarations are gated on the installed SDK exporting
SubagentHostArgumentError, so this change is inert until LibreChat depends on
an @librechat/agents release that includes it.
* 🧭 fix: Reserve Default Routes Early and Route a Routed Subagent's Graph Members
- Reserve a subagent's default machine when it is placed, as
initializeAgent will resolve it (including parent inheritance), so a
concurrent call cannot claim another machine during initialization.
- Graph members spawned by a per-call-routed subagent follow its machine
when they may, unless they already initialized on their own route this
request.
* 🧭 fix: Settle Concurrent Inherited Routes and Register Routed Graph Members
- Re-read a subagent's inherited route after resolving targets, so two
concurrent calls from differently routed parents settle on one machine.
- Attribute a workspace-only conflict to the workspace argument.
- Register graph members a routed subagent initialized, so each gets the
attached-machine policy of the machine it actually runs on.
* 🧭 fix: Re-read Inherited Routes After Resolving Subagent Targets
- Re-read a subagent's inherited route after the target resolution await,
so two concurrent omitted-machine calls from differently routed parents
settle on one machine.
- Attribute a workspace-only conflict to the workspace argument.
* 🧪 test: Prove a Routed Graph Member Takes Its Machine's Policy Through createRun
- Register a resolved child's graph members inline in the lazy resolver
instead of through an exported generic helper whose test did not
typecheck.
- Drive the check through createRun's real PreToolUse hook: a member
routed to a deny machine flips from its metadata machine's allow to deny
once its parent resolves.
* 🧭 fix: Hold a Lazily Loaded Graph Member's Default Machine While It Initializes
- Pass a graph member's code flags when it initializes on its default
route, so the routing session reserves that machine before the
asynchronous initialization instead of only after it, and a concurrent
call cannot place the same agent on another machine meanwhile.
* 🧭 fix: Validate the Approval Mode Against Every Machine a Subagent May Use
- Collect each agent's default attached route and each attached machine a
parent may route it to per call, and validate the requested approval
mode against that set in createRun and both client checks.
- A child whose default is unavailable but whose per-call machine permits
accept edits no longer fails run creation; full access still requires
every such machine to permit it.
* 🧭 fix: Admit, Prime, and Cancel Per-Call Subagent Routes Conservatively
- Build scheduled pause admission from every attached machine a parent
may route an agent to, so a permissive default does not hide a
per-call machine that asks.
- Walk lazy graph-member metadata when collecting execution routes, so
historical skill files are primed for every machine such a member may
run on.
- Stop placing a canceled call after its target resolution resolves, so
it never claims a machine for an execution that will not initialize.
* 🧭 fix: Release Unused Route Claims and Scope Per-Call Machines to Their Run
- Hold a subagent's route claim per placement: a failed or canceled
initialization gives the machine back unless another execution still
holds it, and a claim is permanent once a child on it attaches.
- Fold an agent's default route into its per-call choice digest, so each
agent contributes at most one paused-approval binding target.
- Use only an agent's route policies for pause admission when it has
them, so a missing default does not make a decided route look asking.
- Drop a routable child's provisional attached-machine membership when it
resolves off attached machines.
- Offer and accept no attached machine per call while run files are
shared, since shared children must run on managed code.
* 🧭 fix: Give Back a Route When Its Placement Verification Fails
- Release a placement's hold when attach finds the child initialized on a
different machine than the one it was routed to, so a retry that
follows the unavailable-machine guidance may name another machine.
* 🧭 fix: Commit a Lazy Child's Routes Only When Its Whole Resolution Succeeds
- Keep the routes a lazy child and its routed graph members hold pending
through the child's entire resolution (settleExecution), committing them
on success and giving them back on failure or cancellation unless
another execution still holds them.
- Placements outside any call (shared graph members) still commit when
they attach.
* 🧭 fix: Drop a Failed Lazy Resolution's Config from the Graph Cache
- When a lazy child's graph resolution fails or is canceled after its
config was cached for graph reuse, remove that entry with its route, so
a later graph never reuses a config for a machine the child gave back.
* 🧭 fix: Follow a Routed Agent Through Self-Spawned Runs and Scope Routed Member Configs
- A call whose parent run was never placed (an allowSelf spawn reuses its
routed inputs) inherits the routed claim of its parent agent, which keeps
one machine per request.
- Never share a graph member initialized for a routed parent's execution
through the graph-member cache, so a failed resolution leaves no config
behind for a route it gave back.
- Race lazy target discovery with the request signal.
* 🧭 fix: Pass a Machine On Through Self-Spawned Runs of Agents Without Code
- Record the machine each agent without stateful code passes on, and let a
call from that agent's unplaced run (an allowSelf spawn) follow it when
the agent passed on exactly one machine this request.
* 🧭 fix: Keep a Pass-Through Route Only When Its Resolution Succeeds
- Record the machine an agent without code passes on with the rest of its
call's routing state: kept when the resolution deciding it succeeds,
dropped when it fails, so a self-spawn never follows a failed attempt.
* 🧭 fix: Settle a Lazy Child's Routing State at the SDK Handoff
- Wrap the run's whole lazy resolution, through the inputs handed to the
SDK, in the descriptor's settle hook, so a cancel after the host
resolver returns still gives the call's routes back.
- Roll back the per-agent tool context a pending placement set (restoring
the entry it replaced) when its resolution fails, so a retry on another
machine seeds its own context.
- Drop a failed call's shared config from the graph cache through the
same settle hook.
* 🧭 fix: Keep Per-Agent Tool Contexts on Live Placements and Queue Target Probes
- Track every pending placement that uses an agent's per-agent tool
context: a committed one sets it, a failed one hands it to a surviving
placement, and only the last failure restores the earlier entry.
- Let an unplaced run of an agent (an allowSelf spawn) defer to the routed
run of the same agent that encloses it when looking up tool contexts.
- Queue live target probes at eight in flight, below the shared status
poller's ceiling, so concurrent descriptors never misreport a healthy
machine as unavailable.
* 🧭 refactor: Load Routed Graph Members Through a packages/api Service
- Move the routed graph-member load (shared reuse, skip list, view check,
execution identity, failure policy) into createRoutedGraphMemberLoader;
the initializer only injects its dependencies.
- Thread the request and call signals into target resolution so queued
probes are skipped once canceled.
- Probe nothing in shared-file runs, where every per-call target is
attached and unusable.
- Retire pending tool-context ownership when a committed placement
installs the per-agent entry.
* 🧭 fix: Share a Lazy Child's Config with Later Graphs Only After It Commits
- Publish a default-placed lazy child's config to the shared graph cache
from the settle hook's commit, so no concurrent graph can borrow a config
whose route may still be given back.
- Resolve a child's own appearance in its graph to the child config itself.
* 🧬 fix: Default Subagents to Their Parent's Code Machine and Workspace
A subagent resolved its code machine from its own saved fields only, so
when a chat routed the parent to an allowlisted machine the subagent fell
back to its own default and whatever workspace the conversation had
selected there, or failed the parent's whole turn when none existed.
Subagents now inherit the parent's resolved attached machine when it is
their own default or on their allowlist where per-chat choice applies,
the principal can use it, the sealed decision already selected it, and no
selection names the subagent as an explicit owner. Inheritance is derived
per request from the sealed decision and current agent configuration and
fed to every routing site; it is never persisted, so existing chats and
older clients get it without a decision change. The composer mirrors it.
A subagent whose machine has no usable workspace is advertised to the
parent as unavailable instead of failing the turn; a locked decision
stays fatal.
* fix: Inherit Across Every Spawning Path, Graph Members and Deferred Code Tools
A subagent now inherits only when every agent that can spawn it, at any
depth, runs on the same machine; spawn cycles keep their own routes.
Subagent graph members inherit like explicit subagents. The deferred
execute_code loader passes inheritance to its fallback resolver. Subagent
reads and VIEW checks move to a packages/api loader shared by inheritance,
lazy descriptors and graph members. The composer lets a draft's subagent
follow its parent's machine before a workspace is picked, and keeps an
inheriting subagent's former selection without asking for a move.
* fix: Prune Spawn Back-Edges, Gate the Composer on an Inheritance Capability
Spawning parents follow the run's path semantics, so a back-edge the
descriptor tree prunes no longer blocks inheritance, and agents that spawn
each other follow their single outside parent machine when it routes them
all there. Only admitted subagents count toward the walk's node limit.
Graph members re-read and re-check VIEW when they initialize. The composer
echoes an inheriting subagent's former selection without gating on that
machine, and mirrors inheritance only when the API advertises
codeWorkspaceInheritanceVersion; approval modes keep intersecting every
machine an agent could use.
* fix: Settle Each Mutually Spawning Group on Its Own
Independent spawn cycles no longer merge into one group, so a pair under
one parent follows that parent even when another pair follows a different
machine. Also types the data-provider spec for its ES5 target.
* fix: Bound the Inheritance Walk, Normalize Parallel Roots, Move Subagent Availability to TS
The walk reads in batches no larger than the remaining node budget, stops
once the limit is reached, and runs through the run's subagent load limiter.
Roots are keyed by saved agent ID, so a parallel root such as id____1 can
never receive an inheritance entry. Resolving a lazy subagent's code route,
reporting it unavailable, and guarding its descriptor now live in
packages/api (resolveSubagentCodeAvailability, guardUnavailableSubagent).
* fix: Keep Missing Subagent Loads Parallel Near the Node Limit
Batches never shrink below eight IDs, so missing or unviewable subagents
near the limit still load in parallel under the injected limiter, and at
most a handful of reads land past the limit.
* 🔗 feat(agents): use LibreChat prompt groups as agent instructions
Agents can link a prompt group revision or Production as their instructions. The link resolves at the start of each turn through a cached resolver. The cache clears on promote and delete. Editors without VIEW on the group see a restricted placeholder.
* fix: remove duplicate logger import from agent initialization tests
* fix: honor prompt management capabilities for linked agent instructions
* test: seed prompt manager capabilities in authorization fixtures
* fix: clear acknowledged linked prompt edits before version restore
* test: adapt merged chain coverage to prompt-aware payload helper
---------
Co-authored-by: Lia <lia@librechat.ai>
* perf: Async Local File Saves and Compile Hot-Path Regexes Once
* perf: Check Closing Code Fences Without a Per-Length Regex Cache
* test: Build the Delivery Route Config Before Routing Instead of Mutating It
mergeFileConfig now memoizes by config identity, so the CSV fallback tests
must set textFallbackWithoutTools when they build the request config rather
than mutate the object after the agent's routing already merged it.
* fix: Write Local Buffers Atomically So Concurrent Saves Cannot Interleave
Async writeFile calls to one deterministic path (OpenID and SAML avatars)
could truncate and interleave each other. Write through a temp file and a
rename instead, and add scenario specs for local saves and longer closing
fences.
* refactor: Move Local Save Logic Into packages/api
saveLocalBuffer, the temp-upload move and the atomic directory writes now live
in packages/api/src/storage/local.ts and receive their paths from the caller;
the Local strategy in /api keeps its logging and calls through. The traversal
check now runs before any directory is created.
* fix: Copy Moved Uploads Through a Temp File and Rename Into Place
Concurrent async copies to one destination could interleave just like direct
writes, so moveLocalFile now fills a sibling temp file and renames it.
* fix: Contain Every Local Write and Move Inside Its Target Directory
The traversal check that guarded saveLocalBuffer now runs in writeLocalFile
and moveLocalFile too, before any directory is created, and the buffer
save accepts only the images and uploads base paths.
* test: Define the Success Assertion Inside the Local File Saves Scenario
* fix: Give Atomic Write Temp Files a Fixed-Length Name So Long Targets Still Fit
* test: Send Image Dimensions and Read the Message Array in the Local Saves Scenarios
deleteCodeEnvFile rethrew every error except 404. A deployment that only serves
the stateful profile answers a default-profile delete with 409
execution_profile_mismatch on every retry, so the file landed in failedFileIds,
its record and agent references stayed, and agents holding it aborted every code
turn with "Failed to provision N file(s) to the code environment". The mismatch
is now handled like an absent object: logged, and the delete proceeds. Other
409s, 5xx, auth and network errors still fail the delete.
* 🔭 feat: Recover Stale Chunks Without the Error Page and Ship Client Logs to RUM
Stale chunks: a tab left open across a deploy that opens a code-split panel
requests a hashed chunk the new deploy removed. Vite's preload handler hands
the failure to the stale-asset recovery, which reloads, but the import then
resolves to `undefined` and `React.lazy` throws a TypeError into the route
error boundary, so the error page flashes before the reload. Lazy imports now
go through `lazyWithRecovery`/`importWithRecovery`, which turn that result into
a `ChunkLoadError`; the route boundary recognizes chunk failures (and any error
while a recovery reload is underway), asks the page recovery once, and renders
a localized "Updating to the latest version…" status. When the loop guard
declines, the normal error page with its reload action shows instead. The
page recovery is now idempotent within a page, so concurrent callers join the
in-flight reload rather than tripping the guard.
Client logs: with RUM in proxy mode, the client logger's warn/error calls,
error-boundary catches and stale-asset recovery events are exported as OTLP
log records through the authenticated `/api/rum/v1/logs` proxy. Records carry
allowlisted, scrubbed fields only, follow RUM session sampling, dedupe repeats
with a count, are budgeted per minute and per page, batch with backoff, flush
with keepalive on page hide, and stop after persistent failures. The proxy
now refuses non-OTLP content types and applies a per-user rate limit.
`RUM_CLIENT_LOGS=false` turns the export off.
* 🔒 fix: Keep Client Logs Opt-In and Drop Application Error Messages
- RUM_CLIENT_LOGS now defaults to off, like console capture, so enabling
RUM proxy mode never starts a new log stream on its own.
- Error messages are exported only for engine, browser and library
generated types (TypeError, SyntaxError, DOMException, AxiosError,
chunk failures); application errors keep type, status and stack only,
since their messages can echo prompt or response text. All quoted
fragments are now redacted.
- Batches are measured in encoded UTF-8 bytes of the exact request body,
and page hide drains every queued record that fits the keepalive quota.
- Queued stale-asset events are delivered as soon as the log exporter
starts, independent of the RUM SDK loading, and marked so they are
never logged twice.
* 🔒 fix: Export Only Known Generated Error Messages and Ack Queued Events
- Error messages are exported only when the whole text matches a known
engine, browser or library message shape (property access on
undefined, "x is not a function", fetch/abort/axios status, chunk and
CSS preload failures). The error class alone no longer qualifies, since
any code can throw a TypeError carrying arbitrary text.
- Queued stale-asset events are marked logged only after the collector
accepts the record carrying them, so an undelivered event replays on the
next page; in-flight events are skipped by the SDK path.
- A fractional RUM_PROXY_USER_MAX below one falls back to the default
instead of flooring to a limit of zero.
* 🔒 fix: Hold Unacknowledged Asset Events, Re-send In-Flight Logs on Hide
- The RUM SDK flush no longer drops queued stale-asset events whose client
log record is still unacknowledged: they stay queued and persisted,
flagged so their SDK action is not repeated, and leave the queue once
the collector accepts the record.
- Page hide re-sends the records of an unanswered regular request with
keepalive; each record belongs to the latest request carrying it, so a
late response to the original request neither marks nor requeues it.
- Client-log export stops when the authenticated layout unmounts.
- The proxy refuses /v1/logs while client logs, console capture and replay
are all off, so turning RUM_CLIENT_LOGS off also stops tabs that still
hold an older startup config.
* 🔒 fix: Export Only Complete Stack Frames, Never the Message Header
Stack reduction now strips the V8 `name: message` header (including every
line of a multi-line message) and keeps only lines with a complete V8,
Gecko or WebKit frame shape that ends in a URL or absolute path with a
line number. A message ending in a source-position-like suffix can no
longer pass as a frame.
* fix: centralize RUM delivery and asset recovery lifecycle
* fix: preserve RUM page lifetime and collector acknowledgements
* fix: retain page transport quotas and recover functional chunks
* fix: scope RUM client sessions to authenticated identity
---------
Co-authored-by: Lia <lia@librechat.ai>
* fix: Separate workspace admission and transport budgets
* fix: Validate workspace run reserves and retry test types
---------
Co-authored-by: Lia <lia@librechat.ai>
* fix: persist approval provenance in the resume claim and publish the pre-claim paths from any unapplied abort
The claim CAS now records the provenance it replaces. An abort that lands
before the resumed provider crosses its start CAS publishes those paths, so
schedule deletion, account deletion and user stops no longer label
model-authored chunks as user-submitted.
* test: add approval provenance scenario on the shared approval e2e helpers
* test: seed an earlier started segment before the unapplied abort case
* fix: label abort provenance by the published content and persist the same selection
A path the approval claim added is user-authored only once its tool call
carries output in the abort content, so an abort between the provider
start CAS and the resumed tool keeps the pre-claim labels, and an ask
answer stamped by the abort route keeps its own. AbortResult.jobData
carries the selection so the persisted row matches the final event.
* fix: keep claimed non-tool provenance paths on an abort
Only tool-call paths wait for their resumed call to complete; a steer the
claim already found in the seed content needs no decision to apply.
* fix: count a completed tool call with an empty output as applied in abort provenance
* fix: check abort provenance on the unfiltered content and remap it onto the published parts
* test: type the abort provenance overrides with the job store field names
* test: assert the preserved paths when an unanswered ask aborts
* feat: Remember Tool Approvals Per Conversation
Adds an opt-in "Always allow" choice to the tool approval card. When
endpoints.agents.toolApproval.allowAlways is true, the server marks eligible
paused calls with allow_always; approving with scope "session" stores that
exact tool name on the conversation, and later runs in the same conversation
fold the stored names into the policy as exact-name allow entries.
The server enforces every step: the resume route rejects a session scope the
pause did not offer, eligibility is rechecked against the live policy before
storing, the list is written only through an owner-scoped bounded method, and
generic saves and imports cannot set or clear it. Admin deny and ask rules and
programmatic hooks still win, stored names are ignored under dontAsk or when
the flag is off, and native code tools stay under the code approval picker.
The flag defaults to false, so existing deployments keep prompting.
* fix: Share the Effective Approval Policy and Persist Allows After Resume Fences
Offering, resume re-check, scheduled admission and createRun now read one
policy from buildEffectiveToolApprovalPolicy: endpoint rules healed against
MCP alias spellings, then the conversation's remembered tools. A call held by
a healed ask rule is no longer offered "Always allow", and a scheduled fire
whose known tools are all remembered is no longer rejected as pause capable.
The remembered-tools cap and name length cap move to
toolApproval.allowAlwaysMaxTools and allowAlwaysMaxToolNameLength (defaults
64 and 256). The card stops offering the choice for new tools once the cap is
reached instead of silently approving once.
The resume route stores remembered tools only after the schedule and project
context fences pass; a storage failure still approves the call once.
* fix: Offer Always Allow Only When It Will Hold
Offer allow_always only when storing the name would auto-approve the next
identical call on the run's own path: every MCP spelling of the tool passes
the healed static policy and no programmatic or plugin approval hook can
apply to it (the pause payload does not record which hook asked).
Remembered names now expand to every alias spelling of the same tool, and a
deny or ask on any spelling keeps the tool ineligible. A table-driven spec
walks the invariant through the real hook wiring.
* fix: Recheck Approval Hooks Before Remembering a Resumed Approval
The resume-time eligibility recheck now applies the same programmatic and
plugin PreToolUse hook check as marking, with a hook context built from the
resume request and the live plugin hook source. A hook registered after the
pause turns the choice into a one-time approval: nothing is stored and the
resume continues.
Document that toolApproval.allowAlways should be enabled only once every
replica supports it, since older replicas ignore the choice.
* fix: Judge Always Allow Offers Against the Run's Live Aliases and Active Cap
* fix: Charge Only New Tool Names Against the Remembered Approval Cap
* fix: Recheck Remembered Approvals Against the Paused Run's Aliases
* chore: Sort Imports in Agent Run After Rebase
* 📝 docs: Describe Attached-Workspace Lanes, Sandbox Scratch, and Skill Files in Tool Descriptions
- Lane-mode `cwd` now states that any call outside `.worktrees/<name>` (with or
without cwd, and file tools on such paths) is checkout-wide: it waits for
running worktree calls and blocks new ones until it finishes, so checkout-wide
calls are reserved for creating, pruning or removing worktrees.
- `command`/`cwd` state that the command starts in cwd, so the model does not
also cd into it; the lane-mode cd hint says the call ran checkout-wide.
- Workers advertising the native SRT sandbox profile (`anthropic-srt`,
`anthropic-srt:<preset>`) get a bash bullet that / and /tmp are read-only and
scratch files belong in $TMPDIR or the workspace. Carried as
`codeWorkspace.nativeSandbox` into tool definitions and the bash tool.
- The attached skill-aware `read_file` description says skill files are not on
the attached machine and must be written into the workspace to run there.
- Tightened the attached bash description so the native variant stays within
the 1024-character tool description limit.
* 📝 fix: Keep the Skill-Copy Warning on the Command-Only Workspace's Skill read_file
A workspace that offers execute_command but not read_file falls back to the
skill-only read_file definition. It now carries the same sentence as the
attached skill-aware definition, so the model knows bash_tool cannot reach
skill files by path there.
* 📝 fix: Name bash_tool in the Skill-File Warning Only When It Is Registered
The skill-copy sentence on attached read_file definitions now depends on the
attached bash_tool being registered beside it (includeBash and an advertised
execute_command), for the attached skill-aware definition, its custom
line-limit variant, and the skill-only fallback. Workspaces without commands
keep the plain skill description.
A conditional generation create that loses its predecessor fence is an expected admission outcome: the store rejects before replacing anything, an automatic continuation defers without consuming an attempt, and a client restores its queued turn. Sibling background-tool wake-ups for one conversation race this fence by design, which logged every lost race as an initialization error with a stack.
Route the controller's initialization-failure log through a typed packages/api helper that logs a predecessor mismatch as a concise warning with the stream, conversation, continuation flag, and whether the current generation is active, and keeps every other failure at error level as redacted text.
* ✅ feat: Default Machine Selection and Linked-Worktree Lanes On
Per-chat machine choice from an agent's saved allowlist and linked-worktree
lane routing were both opt-in, so neither worked until a deployment found and
set its flag. Both are now on unless set to false: machine choice still only
applies to agents with a saved allowlist, and lanes still require a worker
that advertises git_linked_worktree. One helper per flag in data-provider
decides the default for every server reader and the advertised client config.
* feat: Advertise the Code Environment Decision Protocol by Default
Per-chat machine choice needs the conversation decision protocol, which the
client requires before offering allowlisted machines, but the protocol was
only advertised when CODE_ENVIRONMENT_DECISION_VERSION=1. With selection on
by default, authors could save an allowlist the composer never offered.
An unset or blank value now advertises protocol v1; any other value, such as
0, keeps the legacy-safe path.
* fix: Turn Machine Choice Off With the Decision Protocol Opt-Out
CODE_ENVIRONMENT_DECISION_VERSION=0 stopped advertising the protocol but
routing still accepted a non-default machine, so a cached tab or a direct
client could persist a choice during a mixed-version rollout. Machine choice
is recorded through that protocol, so isCodeEnvironmentSelectionEnabled now
requires both, for routing and for the advertised endpoints config. The
protocol resolver moves to code/protocol.ts (re-exported from code/config)
so execution and endpoints can use it without an import cycle.
* style: Format checkout routing regression cases
---------
Co-authored-by: Lia <lia@librechat.ai>
* 🛖 fix: Scope OAuth Binding Cookies to the Public API Path
* fix: Canonicalize OAuth Callback and Cookie Paths Together
---------
Co-authored-by: Lia <lia@librechat.ai>
* ♻️ refactor: Native prompts behind a shared service and adapter
* test: Bound Slow Mongo Fixture Startup and Guard Cleanup
---------
Co-authored-by: Lia <lia@librechat.ai>
The SMTP transport options set `requireTls`, but nodemailer only reads
`requireTLS`, so the key was ignored. With EMAIL_ENCRYPTION=starttls,
a server that does not offer STARTTLS received the message over an
unencrypted connection instead of the send being refused.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat: Serve Built-In Endpoint Model Lists From Config So Principal Overrides Can Narrow Them
OpenAI, Google and Anthropic model lists came only from *_MODELS env vars,
which are global, so a role or group override could not narrow them. A
configured endpoints.<name>.models list now replaces the env list and is read
from the per-request config, matching Bedrock.
* fix: Skip OpenAI and Anthropic Model Discovery When a List Is Configured
* feat: enforce required two-factor authentication
Require local and LDAP accounts to enroll in TOTP before they can use the
app when ENFORCE_TWO_FACTOR_AUTHENTICATION is set. Sign-in, refresh, bearer
verification, optional share auth and image authorization all route an
unenrolled account into a staged setup flow, and every bearer credential
minted before enrollment or a password reset is retired.
Password reset retirement uses the existing credentialsChangedAt stamp, and
commitPasswordReset clears any staged enrollment in the same write. Passkey
sign-in follows the same enrollment gate as password sign-in.
* test: cover passkey sign-in handing off to required enrollment
* refactor: keep Mongoose user types out of two-factor auth contracts
* fix: withdraw a minted session when its retirement recheck fails
* fix: hold Agent API keys and the reset CLI to the required two-factor policy
* fix: adopt a setup token handed off after the setup screen mounted
* fix: move every tab that receives an enrollment hand-off into setup
* fix: read the enrollment gate's retirement cutoff in system scope
* fix: clear minted session cookies before the fallible session deletion
* fix: adopt a setup token persisted before the setup screen subscribed
* feat: add ephemeral retention mode for forced temporary chats
Adds RetentionMode.EPHEMERAL, which forces every newly saved chat
temporary: hidden from history and search, given the temporary-chat
expiration, and with the toggle locked on.
Forces isTemporary and applies the temporary expiration in the normal
conversation and message save methods, routes Assistants/Threads
messages through the normal message save, applies the all-data
retention policy to file uploads and shared links, and stamps imports,
forks, and duplicates. Locks the frontend toggle and keyboard shortcut
behind an administrator-enforced badge.
The default temporary mode and the existing all mode are unchanged.
* fix: enforce ephemeral retention when resuming paused chats
* fix: preserve forced retention across pauses and assistant turns
* test: Use Real Module IDs for Installed Package Mocks
* test: Wait for Resumed Retention Persistence
* test: Control Mongo Index Setup in OpenID Fixture
* test: Close Mobile Drawer Before Retention Resume Scenario
* fix: Store Responses API Messages Under the Retention Write Context
Input and output messages were saved with the raw request, so under
ephemeral retention they missed the forced-temporary classification the
conversation received. Route both through getConversationWriteContext
and announce the stored reply as saved.
* fix: Align Resumed Responses With the Parent Retention Deadline
A resumed response was saved with a fresh forced-temporary window while
the re-stamp kept the conversation's earlier deadline, so a chat that
paused again could leave its response stored after the conversation
expired. Stamp the saved response with the parent's deadline.
* fix: Clear Released Bookmark Tags When Forcing a Chat Temporary
stampForcedRetention released a converted chat's bookmark counts but
kept its tags, so deleting that chat before TTL removal decremented the
same tags again and reduced counts owned by other visible chats. Clear
the tags in the conditional conversion update that releases them.
* fix: Store No Bookmark Tags on Forced-Temporary Imports
An ephemeral import, fork or duplicate skipped its tag count increment
but kept the source tags, so deleting the copy before TTL removal
decremented counts owned by other visible chats. Store the same tags the
import counts, which is none for a forced-temporary copy.
* test: Provide the Forced-Temporary Retention Helper to the Header Stacking Mock
* test: Reuse One Admin Login per Worker in Ephemeral Retention Scenarios
* fix: Keep Legacy Temporary Chats Temporary When Forking Under All-Data Retention
* fix: Convert a Resumed Chat Under Ephemeral Retention Before It Can Re-Pause Empty
* fix: Treat a Reloaded Pre-Policy Run as Temporary Once Retention Is Forced
* fix: Stamp Messages with the Deadline a Concurrent Retention Stamp Stored
* fix: Wait for the Startup Config Before Rebuilding a Resumed Submission
* test: Wait for the Resumed Response Row in the Ephemeral Resume Scenario
* test: Provide the Real Command Executor Stamp to the Callbacks Mock
(cherry picked from commit 02a70e9c58)
Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/13811
* feat: Show Exit Status for Attached Workspace Commands
Parse the exit trailer the attached-workspace bash_tool writes so the card
fails a non-zero exit, a signal or a timeout, names the reason beside the
failure suffix, and renders stderr distinctly. The group outcome reads the
same parser so its failed count matches the card. Sandbox output without the
trailer keeps the existing heuristics.
* fix: Parse Exit Status Only for Attached Workspace Calls
The sandbox and attached-workspace tools are both named bash_tool, and the
sandbox output is trimmed, so a sandbox command that printed
"[exit code: 1]" last was read as a failed attached-workspace run by the
card and the group outcome.
The execute handler now records a run step when the resolved tool instance
is the one createAttachedWorkspaceBashTool built (tracked by object
identity), and the step-completed handler stamps executor:
'attached_workspace' on the streamed tool call and the aggregated part.
Redis replay and the client SSE merge carry the field through. BashCall
and outcome.ts parse the trailer only when the marker is set.
* fix: Count Styled Terminal Lines Like Plain Ones When Output Ends in a Newline
(cherry picked from commit abc9285523)
Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16556
* 🎒 feat: Carry Project Context Across Conversations
* fix: fail a project attach whose upload hold cannot be released and keep file deletes independent of project cleanup
- Attaching a project file now fails, with nothing attached, when the file's
temporary upload hold cannot be released, instead of attaching a file that
can still expire.
- A failed project cleanup after a file delete is logged rather than failing a
delete that already happened, and a user-wide delete clears that user's
project references without reading every file first.
- Both resize handles share the orientation-aware grip, so a primary handle in
a vertical group renders a rotated grip like the alternate one.
* fix: treat an empty tenant id as no tenant in the project file picker
* fix: attach nothing when a project file is deleted while the attach is in flight
* fix: localize project file association failures instead of showing server text
* test: expect a localized reason for a rejected project file association
* fix: scope project file listing to the caller's tenant and name the file limit when attaching an existing file
- Listing a project's attached files now returns not found when the project
belongs to another tenant, matching the available-file listing and the
chat context resolver.
- Choosing an existing file for a full project now names the project file
limit instead of the generic attach error, like the upload path.
* fix: treat an empty tenant id as no tenant in every project tenant check
A caller whose tenant id is an empty string was refused its own tenantless
project when listing attached or available files, because the handlers
compared '' with null. The project handlers and the chat context resolver now
share one comparison that treats an empty tenant id as no tenant, the rule the
project file queries already follow.
* test: wait for the workspace layout swap and the mobile drawer before acting in the long-metadata spec
The desktop title was measured while the phone layout could still be the one
rendered, and the sidebar row menu was opened before the mobile drawer
committed its open state, which closes a menu opened ahead of it. The spec
now waits for the workspace's phone-only sidebar toggle to leave and for the
drawer to drop inert, the same drawer signal the agents helpers use.
* fix: keep the agent context fingerprint of a turn outside any project unchanged
Every turn now passes a project context key into the agent context
fingerprint, and a turn outside any project passed the no-project sentinel,
which changed the digest of every existing no-project checkpoint. An agent
event conversation written before this change then cold-started and reloaded
its history on its next event. The fingerprint now hashes the no-project key
as absent, so those checkpoints keep matching.
* test: load the long-metadata spec at phone width before driving the mobile drawer
The spec crossed back from desktop to phone width without a reload, which
leaves the drawer on the desktop toggle path whose delayed focus handoff to
the close button dismissed the row menu roughly 200ms after it opened. The
spec now reloads at phone width, as a phone arrives, and waits for the
drawer's own focus handoff before opening the menu.
(cherry picked from commit 4062bc3c00)
Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/15684
* fix: outlast failed auth cache eviction on credential changes
A credential change committed to MongoDB could report success while a
cached auth user document without the new credentialsChangedAt stayed
readable, so an old OpenID access token kept authorizing until the
cache TTL. The Redis-backed auth cache swallowed every failure (Keyv and
KeyvRedis resolve a failed GET as a miss and a failed DEL as a no-op), and
the eviction helpers stopped at the first error.
- The AUTH_USER_DOC namespace opts into throwOnErrors so a failed read or
delete is visible; every caller of that namespace already catches.
- evictAuthUserDocs attempts every delete even when another fails and
reports whether a document may still be served; the data-schemas and
packages/api invalidation paths share it.
- updateUser waits out AUTH_USER_DOC_CACHE_TTL_MS before returning a
credential change whose eviction was incomplete, so the change is only
confirmed once no pre-change document can be served. Other updates stay
best effort, and later revocations are delayed, never skipped.
* fix: record the reverse index before caching an auth user document
A document written before its reverse-index entry was cached without an
index naming it when the index write failed, so eviction could not find
it. Write the index first with a TTL that outlives the documents it names,
and skip the document when the index write fails.
* test: keep real data-schemas helpers in the pinned order spec
* fix: settle the auth cache after revoking reset credentials
Waiting out the cache TTL inside updateUser held the reset before its
session and passkey revocations, so a live refresh token or passkey could
mint an access token issued after credentialsChangedAt during the wait.
updateUser is best effort again; awaitAuthUserDocEviction retries the
eviction and waits one TTL only when it is still incomplete, and both the
web reset controller and the reset CLI call it after revoking sessions and
passkeys, before confirming the reset.
* fix: settle the credential barrier with a margin and on CLI revocation errors
Timers can fire a millisecond early, so the eviction barrier now waits the
cache TTL plus a 100 ms margin. The reset CLI also settles the barrier when
revoking passkeys or sessions throws, since the password is already changed.
* fix: treat an auth cache that cannot delete as not evicted
* fix: keep the reverse index until every document it names is evicted
A failed eviction still deleted the reverse index, so the credential
barrier's retry found no index and reported the cache clear while the
documents an unreadable index or a failed delete left behind stayed
cached. The index is now deleted only after it was read and every document
it names is gone, so a retry can still find what remains.
* fix: treat a malformed auth reverse index as unreadable
* fix: treat a reverse index with a non-string entry as unreadable
(cherry picked from commit 18b6937da3)
Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16435