Commit graph

755 commits

Author SHA1 Message Date
lia-by-librechat[bot]
532214c022
🐡 fix: Bound Tool Approval Admission Work (#17387)
* 🐡 fix: Bound Tool Approval Admission Work

* style: Normalize HTTP Regression Formatting

* fix: Validate Persisted Options Before Runtime Alias Expansion

* fix: Preserve Option Limits Across Reset and Initialization

* fix: Keep Legacy Approval Options Readable in Management Responses

* fix: Retain Option Limit Provenance Through Runtime Normalization

* test: Use a Typed MCP Configuration Fixture

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-24 08:58:17 +02:00
lia-by-librechat[bot]
a51c45bbf3
🌳 fix: Preserve Primary Files Until Secondary Cleanup Succeeds (#17228)
* fix: Preserve primary files until secondary cleanup succeeds

* test: Use a flat deletion-strategy lookup

* fix: Preserve erasure retries and reconcile removed embeddings

* test: Match deletion regression formatting

* fix: Preserve search intent after vector cleanup

* fix: Repair retained project search files before tool execution

* fix: Normalize Retained Project File Runtime Types

* test: Use the Storage Source Enum in Project Repair Coverage

* fix: Confirm Secondary Cleanup and Preserve Repair Policy

* test: Correct Repair Fixture Types and Cleanup Retry Assertions

* fix: Reconcile Code Copies Compatibly and Charge Shared File Budgets

* fix: Reserve Admitted File Budgets Before Deferred Screening

* fix: Retain Concurrent File Copies and Scope Cleanup by Tenant

* fix: Bound Erasure File Checks and Correct Cleanup Fixtures

* fix: Preserve Provider-Only Assistant File Deletion

* fix: Reconcile Primary Vector Deletions Before Finalization

* fix: Finalize Successful Files in Mixed Cleanup Batches

* test: Load Real File Finalizer in Cleanup Integration Tests

* fix: Preserve Project Routing MIME and Fence File Storage Operations

* fix: Validate Provisioning Principal and Type Project Repair Fixtures

* fix: Recover Provisioning Claims and Retain Uncertain Storage Outcomes

* fix: Normalize File Recovery Results and Reconcile Transport Attempts

* test: Preserve Deployment Routes in Host Provisioning Fixtures

* fix: Recover Deletion Claims and Fence Generated Output Writes

* fix: Preserve Generated Output Commit Snapshots

* test: Use Persisted Owner Type in Generated File Fixture

* test: Type Generated Output Fixture with Its Commit Contract

* fix: Preserve Publication Error Handling and Cleanup Test Boundaries

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-23 07:00:20 +02:00
Danny Avila
db225c0919
🔐 feat: Admin Config Secrets v2 (MCP and Azure Credentials, Re-entry, Env Allowlist, Rebinding) (#17353)
* 🔐 feat: Admin Config Secrets v2 (MCP and Azure Credentials, Re-entry, Env Allowlist, Rebinding)

The admin config API stored MCP server credentials and Azure group keys in plaintext, returned
them to config readers, let an admin who cannot read a stored credential send it to a host of
their choosing, and let override values reference any environment variable. MCP credentials
and Azure keys, in `groups` and in the `groupMap` the Azure clients read, are now encrypted
with masked previews, hidden from every read and decrypted once after the merge. A write that
keeps a stored MCP credential or web search key while changing where it is sent must enter it
again, judged by the value the written document holds. `${VAR}` references in overrides are
limited to an allowlist, named where a change batch leaves them, and the merge drops a
credential a layer moves to a new destination without entering it, listing it in write
responses only for sections the caller can read. A custom endpoint's key is bound to its base
URL, its provider and the destination options in addParams and dropParams (such as the
anthropicApiUrl the native Anthropic client sends to), matched across layers under the name the
merge folds (ollama is Ollama). A restated `${VAR}` counts as entered, so allowlisted names
are not bound to a destination. Azure's `${INSTANCE_NAME}` and `${DEPLOYMENT_NAME}` stay
templates in a group's `baseURL`, and a scheduled job's MCP consent no longer depends on the
masked previews that change when an admin rotates the key in place.

* ♻️ refactor: Move the MCP Key Re-entry Guard Out of the Binding Helpers to Break an Import Cycle

With #17351's OpenID provisioning on dev, the app config service reached itself through the
rebinding guard: app/service -> app/overrides -> app/rebinding -> mcp/registry/binding ->
mcp/errors (and mcp/types) -> mcp/oauth/obo -> utils/identity -> auth/openid -> auth/provision
-> app/resolve -> app/service. The binding helpers are pure diffs; only
requireApiKeyReentryForRebinding needs the MCP error class, so it moves to
mcp/registry/reentry.ts, and the helpers take MCPOptions from librechat-data-provider as
mcp/headers.ts does. No behaviour changes.

* 🧪 test: Drop a Base-Held Endpoint Key That a Lower-Priority Profile Moves

Base merges first since #17352, so a profile below Base's priority still
lands over it. The rebinding guard drops the key Base stores for a custom
endpoint whose baseURL the profile changes, and the PATCH response lists
it in `ignored`.

* 🔐 fix: Serve Admin Azure Group Keys and Keep Deployment Keys at Their Own Destinations

Azure groups a profile writes now take effect: the merge resolves a layer's
`endpoints.azureOpenAI.groups` as AppService resolves librechat.yaml's
(`resolveAzureGroups`, shared with `azureConfigSetup`) into the `groupMap`,
`modelGroupMap`, model list and assistant models the Azure clients read. A
layer's groups replace the groups below whole, as its array does; groups that
do not resolve stay unread with a warning. The rebinding guard judges the
resolved groups like any `groupMap` entry, and an Azure group's destination now
also covers a deployment name its base URL takes its host from and the
destination options of its `addParams`/`dropParams`.

A write that keeps a stored Azure group key (in `groups` or `groupMap`) while
changing where the group sends it answers 400 `CONFIG_SECRET_REENTRY_REQUIRED`
on PUT, PATCH, field deletes, tombstones and change batches, judged as the
document resolves over librechat.yaml and on each `groups` item as written.

OCR fills an empty key from `OCR_API_KEY` only for its default destination (no
base URL, or `${OCR_BASEURL}`), so a key the guard dropped for an override's
`${VAR}` base URL is not replaced by the deployment's. The env reference policy
includes the `${OCR_API_KEY}` loading fills in for an `ocr` section without a
key, so a client can write back what GET `/base` returned.

The custom endpoint guard no longer needs the layer's overrides to name an
entry: an entry changed some other way is judged as inherited (positional
tombstones inside the list are not applied by the merge, so none reached one).

A web search URL a layer points at a `${VAR}` other than librechat.yaml's
without entering its key is set back: web search sends the deployment's key,
or its client's environment default, to any `${VAR}` URL.

* 🔐 fix: Keep Azure Assistants Served, Opaque Keys as Entered and Batch Env Checks on the End State

Azure assistants: a profile's `groups` replace the groups below whole, so
groups with no model that supports assistants under librechat.yaml's
`assistants: true` left `assistants` on with an empty `assistantModels`, and
the Azure Assistants initializer picked `assistantModels[0]` (undefined).
`azureConfigSetup` refuses that combination at startup; the merge now turns
`assistants` off when none of the models it leaves supports them, with a
warning, judged on the merged result so a later layer whose groups serve
assistants keeps them on. The check is `lacksAzureAssistantModels`, shared
with `azureConfigSetup`.

Opaque credentials: every runtime reader of the OCR, speech, web search and
Langfuse keys uses the decrypted value as is (`resolveConfigSecret`,
`resolveStoredConfigSecret`, `decryptConfigSecret`), so a `${...}` inside a
key the write encrypts is part of the key. Those fields are marked `opaque`:
the write-time check skips a value the write encrypts there, and the runtime
pass keeps their ciphertext instead of blanking it. A whole `${VAR}`
reference there, which the field passes through and its reader resolves, is
still checked, and so is stored plaintext. Custom endpoint (`initializeCustom`),
Azure group (`mapModelToAzureConfig`) and MCP (`processMCPEnv`) credentials
are expanded by their clients once decrypted and stay checked; the Assistants
keys have no reader yet and stay checked too.

Change batches: env references are judged on the document the batch leaves,
as its other issues are. An issue counts only when the end state still holds
a disallowed reference (ciphertext by its plaintext) where the batch sent one,
at a location the batch changed, so a value a later op removes or replaces
(`set ocr.baseURL`, then `unset ocr`) is no longer refused, and a stored
reference the batch puts back where it was is left to merge time.

* 🔐 fix: Proxy-Bound OAuth Secrets, Consistent Azure Group State, Batch Issues by Entry Key and Loaded Web Search References

- The MCP proxy is part of the OAuth client secret's binding (user tier, admin re-entry and the
  merge's rebinding guard share `getChangedOAuthSecretBindingFields`): the access token the
  secret obtains travels through it.
- A tombstone of `endpoints.azureOpenAI.groups` resolves the groups to none in the merge (empty
  `groupMap`, `modelGroupMap` and model lists, so the model list does not fall back to the
  environment's defaults), and removes what they resolve to in `applyConfigTombstones`.
- The merged Azure model lists name only models a merged group serves
  (`narrowAzureServedModels`), so an override's `assistantModels` no group serves no longer keeps
  Azure assistants on.
- `/changes` env issues are held by entry identity (`toConfigIdentityPath`), followed through
  renames and resolved on the batch's end state, so a removal or rename no longer shifts them.
- References loading librechat.yaml introduces (OCR's `${OCR_API_KEY}`, the web search defaults)
  are allowed at the location they are loaded at, so GET /base's sections are accepted written
  back, and nowhere else.

* 🔐 fix: Re-entry for Endpoint, OCR and Speech Keys, Own Keys Bound Over Base and User Key Destinations Kept

- The document that stores a custom endpoint, OCR or speech key can no longer
  move its destination without the key: PUT, PATCH, field deletes, tombstones
  and change batches answer CONFIG_SECRET_REENTRY_REQUIRED at the changed field
  (getBoundKeyReentryIssues), judged by value as the document alone sends it.
- A profile's own key for an endpoint, MCP server, OCR or speech service, or
  Azure groupMap group that Base defines is bound to that destination when it
  is entered: the rebinding guard reports a fingerprint of where it goes, the
  write stores it beside the key (<secret>Binding), and the guard keeps the key
  there until a lower layer moves it. Reads and the merged config leave the
  fingerprint out; kept keys carry it; client values are replaced.
- An inherited custom endpoint or MCP server that sends a credential each user
  holds (user_provided, customUserVars, apiKey.source user, OpenID or Graph
  token placeholders) keeps its destination: a layer's move is set back and
  listed in ignored.
2026-10-23 06:37:54 +02:00
Danny Avila
6189220697
🏷️ fix: Resolve endpoints.all Title Settings per Field and Fold Ollama Endpoint Names (#17316)
Some checks failed
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Publish `@librechat/client` to NPM / pack (push) Waiting to run
Publish `@librechat/client` to NPM / publish-npm (push) Blocked by required conditions
Docker Dev Images Build / publish (push) Waiting to run
Sync Helm Chart Tags / Ignore non-main push (push) Waiting to run
Sync Helm Chart Tags / Sync chart tags (push) Waiting to run
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Has been cancelled
Publish `librechat-data-provider` to NPM / pack (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / pack (push) Has been cancelled
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
* 🏷️ fix: Resolve endpoints.all Title Settings per Field and Fold Ollama Endpoint Names

Conversation titles picked `endpoints.all` as a whole block, so any `all`
block (even one holding only streamRate, headers or activity label keys)
hid every per-endpoint titleConvo, titleModel, titleMethod, titleEndpoint
and title prompt. `resolveTitleConfig` resolves each field from `all`,
then the named endpoint, then the custom endpoint entry, keeping
titleEndpoint and titleModel as one choice from the first layer that sets
either.

Config overrides merged `endpoints.custom` by exact name while the runtime
serves names through `normalizeEndpointName`, so an override `ollama`
survived beside the YAML `Ollama` and split the endpoint between two
baseURLs and keys. The merge key now folds the same way (the YAML spelling
is kept), merge-key issues, issue attribution and secret preservation use
the same identity, and the effective config serves
`modelSpecs.addedEndpoints`, `modelSpecs.list[].preset.endpoint` and
`endpoints.agents.allowedProviders` in served names without repeats.

A stored document that already names one endpoint in two spellings is
combined at merge in document order, so requests keep the host and key
of the first item instead of moving to the YAML entry; omit-to-keep
secret preservation reads the same combined entry. A new write naming
both spellings is rejected as a duplicate.

An agent saved as `Ollama` now runs on the served `ollama`: the model
catalog lookup (`resolveModelCatalogKey`) falls back to the served name,
and `initializeAgent` folds the provider before the allowedProviders
check and provider setup.

* 🏷️ fix: Report Per-Field endpoints.all Title Resolution in the Admin Config Meta

resolveTitleConfig resolves endpoints.all title settings one field at a time, so GET /api/admin/config/meta now reports rules.titleResolution as 'field'. meta.spec ties the reported value to resolveTitleConfig: with endpoints.all = { streamRate: 1 } and openAI.titleModel = 'x', the rule is 'field' exactly when the endpoint's titleModel survives.

* 🧪 test: Expect Segments on the Folded duplicate_merge_key Write Issue

Admin config write issues carry segments since #17322; the folded Ollama/ollama duplicate test now asserts them.

* 🏷️ fix: Match Folded Custom Endpoint Names in Admin Config Change Ops

The changes endpoint from dev matched entry keys exactly, while the config
merge, merge-key issues and secret preservation fold `Ollama`/`ollama` into
one custom endpoint. An upsertEntry `ollama` over a stored `Ollama` copied the
stored key, appended a second entry and failed as duplicate_merge_key;
removeEntry `ollama` left a stored `Ollama` in place; a rename onto another
spelling passed entry_exists; and the librechat.yaml entry check missed
`ollama` against the YAML `Ollama`.

- data-schemas: `getConfigEntryIdentity` folds a key by its override path;
  `getConfigEntryMatcher` backs upsertEntry, removeEntry, rename, written-path
  attribution and the stored-counterpart lookup; issue locations use the same
  identity. A rename of an entry stored in two spellings moves the one entry
  the runtime merge combines (`combineFoldedConfigEntries`).
- api: the YAML-entry rename guard and the per-batch duplicate check compare
  entries by the same identity.
- Tests: unit coverage for each op across spellings, and handler integration
  tests against MongoDB for upsert with secret preservation (single and
  two-spelling documents), removal, entry_exists, inherited_entry and
  duplicate changes in one batch.
2026-10-22 16:57:42 +02:00
Danny Avila
8c51a3f9f8
🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327)
* 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields

Config profiles are the `__base__`, role, group and user documents written through `/api/admin/config`. A profile can tombstone `mcpServers.<name>`, and the merge then removes that server from the principal's resolved `mcpConfig`.

* 🛡️ fix: Apply MCP Hiding to Server Instructions, Failed Removals and the Startup Audit

- Server instructions bound for the model now leave out librechat.yaml servers hidden from the acting user, including one a model spec pins. `applyContextToAgent` passes the request user through `formatInstructionsForContext`, which drops the user's hidden set from the user-less catalog it reads.
- A config-tier candidate that removes a librechat.yaml value (a field, or a key of a record such as `headers`) and fails inspection now stands as a failed config-source entry instead of falling back to the librechat.yaml base that still carries the removed value. A failed change that removes nothing still falls back, and an entry with no transport (fields written over a hidden server) keeps the documented librechat.yaml fallback.
- The startup tombstone report reads every tenant's profiles in the system tenant scope, so it also runs from entry points without an outer system scope under strict tenant isolation, and names each profile's tenant.

* 🗂️ fix: Project the Startup MCP Tombstone Report Query and Run It Alongside Connections

* 🔑 fix: Keep Removed OAuth Headers Out of the MCP OAuth Callback

* 📝 docs: Note That Removed OAuth Headers Stay Out of MCP Sign-In

* 🔐 fix: Recheck the MCP OAuth Flow's Server Before Initiation Redirects

OAuth initiation redirected to a flow's stored authorization URL, or started
a new authorization from the flow's stored server URL, without resolving the
server again, so a principal whose profile hid the server after the flow was
created could still be sent to its authorization endpoint. The callback's
active-server check and its OAuth header fallback lived in the CJS route.

resolveMCPOAuthTarget (packages/api/src/mcp/oauth/target.ts) now owns both:
it resolves the server in the principal's current config with a strict read,
refuses a flow admitted for another server, a server the principal can no
longer use, or a redefined one, and selects the headers the flow sends (the
initiation snapshot, else the principal's config). Initiation calls it before
either redirect (404 or 400); the callback calls it before the exchange and
from the token-store fence.

* 📝 docs: Note That a Hidden MCP Server Ends OAuth Sign-Ins Already Started

* 🚩 feat: Publish the yamlMcpHide Admin Config Meta Flag

Profiles can hide librechat.yaml MCP servers and a hidden server is an
access boundary, so GET /api/admin/config/meta now reports
features.yamlMcpHide for the admin panel to gate its hide UI on. The
meta.spec probe checks the behaviour itself: the admin API stores an
mcpServers.<name> tombstone, the merged config drops the server, the
registry withholds it from principal lookups and checkout but not from
app-level lookups, process-backed servers stay, and an unreadable
principal config withholds every hideable server.

* 🧪 test: Align MCP Tombstone Specs With the Portable Config Store

The admin config handlers now write whole documents through
writeConfigDocument, so the end-to-end tombstone spec wires it in place
of the removed upsertConfig/patchConfigFields deps. A reset of a whole
MCP record now also prunes the parents it leaves empty.
2026-10-22 14:10:31 +02:00
lia-by-librechat[bot]
eac18f4656
🥼 fix: Separate Agent Inference Settings From SDK Configuration (#17220)
* 🥼 fix: Separate Agent Inference Settings From SDK Configuration

* fix: Load Typed Inference Controls and Preserve Legacy Bedrock Preferences

* fix: Resolve Trusted Inference Profiles Consistently

* fix: Keep OpenRouter Cache Policy Independent of Reasoning

* fix: Enforce Final Parameter Policy Across SDK Aliases

* fix: Enforce Inference Policy Through Production Initialization

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-22 13:07:16 +02:00
Marco Beretta
4c6ea7e981
🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261)
* fix: Hash Off the Event Loop and Surface API Key Lookup Failures

Registration, email verification, password reset and verification resends
hashed and compared with bcryptjs's synchronous calls. bcryptjs is pure
JavaScript, so each call blocked the event loop for every request in the
process. They now use the promise APIs, and the password reset
dependencies are async.

validateAgentApiKey caught its own query failures and returned null, so a
database outage answered remote callers with 401 Invalid API key. It now
lets the failure reach requireApiKeyAuth, which answers with a 500.

* fix: Run bcrypt on a Worker Pool in packages/api

bcryptjs's promise API still computes on the main thread, only in chunks
of up to 100 ms, so concurrent registrations and resets kept stalling
unrelated requests (four cost-10 hashes delayed a 5 ms timer by about
190 ms). hashSecret and compareSecret now run bcryptjs on a small
worker_threads pool in packages/api, and AuthService.js calls them.

* feat: Configure the Password Hashing Worker Count

* fix: Verify Login and Step-Up Passwords on the Hash Pool
2026-10-19 22:13:31 +02:00
Marco Beretta
b1cf65c7e9
🗂️ perf: Index Hot Lookups and Project the Remote Models List (#17259)
* perf: Index Hot Lookups and Project the Remote Models List

checkBan reads the KeyvMongo logs collection by key on every request when
bans are enabled, BYOK requests read Key by user and name, and agent tool
loading reads Action by agent_id or assistant_id. None of those fields had
an index, so each read scanned its collection. The Key and Action schemas
gain indexes, and the KeyvMongo store builds a key index on first use
unless the deployment disables auto indexing.

The remote /v1/models routes loaded whole agent documents, including the
unbounded versions history, to read six fields. getAgentModelSummaries
loads only those fields.

* test: Authenticate the Models List Scenarios With an Agent API Key
2026-10-19 21:39:10 +02:00
Marco Beretta
e57aa3aa5b
🙊 fix: Keep API Keys and Internal Errors Out of Logs and Responses (#17258)
* fix: Keep API Keys and Internal Errors Out of Logs and Responses

The log redaction patterns did not cover the appid query parameter, so a
failed Wolfram request logged its AppID with the axios request URL. appid
now joins the redacted token and query names.

OpenWeather returned a fetch error's message to the model verbatim, and
node-fetch puts the full request URL, appid included, in that message. The
tool now passes it through redactMessage, as ToolService does.

The public startup config route and the unauthenticated password reset
route sent raw error text on unexpected failures. Both now answer with a
fixed message and keep the detail in the server log.

* refactor: Format Tool Error Text in packages/api

* fix: Redact appid Metadata Keys in Structured Logs
2026-10-19 21:36:46 +02:00
Marco Beretta
8fab21d882
🧬 fix: Skip Re-Embedding Legacy File Search Files After Upgrade (#17206)
* fix: Skip Re-Embedding Legacy File Search Files an Agent Already Holds

Files embedded before per-namespace tracking carry no embeddedEntities, so
lazy provisioning treated them as unembedded and embedded them a second
time on the first search after upgrading, duplicating every passage.

A legacy record in the agent's own file_search resources was embedded for
it, so trust its embedded flag there instead of re-queueing it.

* fix: Adopt Legacy Search Embeddings Only for Their Sole Holder

Trusting the embedded flag for every legacy File Search file left an agent
that inherited one querying a namespace without its vectors. Legacy files
held by no other agent now record the active agent as their namespace, a
one-time write, and are not embedded again; a file another agent also
holds keeps the per-namespace re-embed.

Adds an e2e scenario that reshapes an uploaded agent file into the v0.8.7
record and checks that search queries it without a second embed.

* test: Cover Legacy Search Files Shared With Another Agent

* test: Read the Stored File Id in Legacy Search Scenarios

* fix: Pin Legacy Search Adoption to Loaded Records and Wire Every Agent Init

file_id is not unique, so adoption now matches each record by its owner and
tenant as well, and only rewrites the records priming loaded. The added
conversation and client agent initializations receive the dependency too,
so their sole-holder legacy files are not embedded a second time.

* fix: Adopt Each Legacy Search Record in One Conditional Write

* fix: Count a Concurrent Same-Agent Adoption as Adopted

* fix: Run Legacy Search Adoption Beside the Liveness Probe and Fall Back on Failure

* fix: Keep Committed Legacy Search Adoptions When a Sibling Write Fails

* fix: Confirm Legacy Search Embeddings With RAG Before Adopting Them

Inferring the embedding agent from current File Search holders could adopt a
file for an agent whose namespace held none of its vectors, for example after
the agent that embedded it was deleted. Priming now asks RAG for one chunk of
each legacy file under the agent's entity_id and records the namespace only
on a hit; a miss or an unreachable RAG keeps the file queued for embedding.

The data-schemas method no longer scans agents and matches untenanted records
as untenanted. The fake RAG server answers these presence checks from the
embeds it stores.

* fix: Require the Entity's Own Chunks and Keep Confirmed Vectors

RAG also returns chunks owned by the requesting user, so a presence check now
counts only chunks recorded under the agent itself. Once vectors are
confirmed, the turn skips the re-embed even if recording the namespace fails.

* fix: Bound the Legacy Search Check and Keep the Fake RAG Query Shape

The RAG presence check now times out (fileConfig.legacySearchProbeTimeoutMs,
5s by default) and falls back to embedding, so a stalled RAG cannot hang
priming. The fake RAG server records presence checks in their own list and
keeps the file_search query records it already returned.

* fix: Check Any Unrecorded Namespace Before Embedding a Search File

A file another agent embedded first lists only that agent, so the agent
whose older vectors went unrecorded skipped the check and embedded a second
copy. Priming now asks RAG for every agent File Search file that records no
embedding for the active agent, and recording adds the namespace to the ones
already there.

* fix: Ask RAG for Several Chunks So a User Copy Cannot Hide the Agent's

RAG ranks chunks across every owner of a file_id and, once the top one is
authorized, returns them all. A copy of an agent file embedded for the
requesting user could rank first with k: 1 and hide the agent's own chunks,
so the presence check now asks for ten and checks every owner.

* fix: Confirm Setup Embeddings in Shared-File Runs and Log Safely

The run-file host primes an agent's setup files on its own, so it now
receives the RAG presence check and the namespace recorder too; without
them a shared-file run could embed a legacy setup file a second time.
Failed checks are logged with getSafeErrorMetadata rather than the raw
error, which carries the vector store's response body.
2026-10-17 19:19:14 +02:00
Marco Beretta
aec11338e6
🪦 chore: Retire the DALL-E 3 Tool (#17205)
* chore: Retire the DALL-E 3 Tool

OpenAI shut down dall-e-3 on May 12, 2026, so the built-in DALL-E 3 tool can no longer generate images on api.openai.com. Remove the tool, its manifest entry, registry definition, and env docs, along with the loadTools functions flag that only existed to register it. The OpenAI Image Tools cover the same use case. Stored agents that still list dalle load without it, and dalle stays in imageGenTools so past images keep rendering.

* test: Cover the Retired DALL-E 3 Tool in Mock Scenarios

* docs: Drop DALL-E from the README Image Generation List
2026-10-17 18:24:22 +02:00
Marco Beretta
472d29a3ee
🪙 fix: Price 1-Hour Prompt Cache Writes at the 1-Hour Rate (#17208)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
* fix: Price 1-Hour Prompt Cache Writes at the 1-Hour Rate

* test: Cover 1-Hour Cache Write Pricing End to End

* test: Price Cache Scenario on the Configured Mock Model

* fix: Accept a 1-Hour Cache Write Rate in Endpoint Token Configs
2026-10-17 15:43:57 +02:00
Marco Beretta
ab8dc9d3d2
🕶️ fix: Keep Temporary Chats Out of Langfuse (#17202)
* fix: Keep Temporary Chats Out of Langfuse

* fix: Gate Forced-Ephemeral and Open Responses Turns From Langfuse

* fix: Treat Legacy and Chat Completion Temporary Turns as Untraced

---------

Co-authored-by: Joel Hirzel <joel.hirzel@eps.ch>
2026-10-17 11:57:35 +02:00
Dustin Healy
f757a673aa
🐛 fix: Restore MCP App Rendering and Actions (#16382)
* 🐛 fix: Restore MCP App Rendering and Startup

* 🐛 fix: Sort MCP App Bridge Imports

* 🐛 fix: Scope MCP App Validation to Current Role

* 🐛 fix: Keep MCP App Frames Mounted Through Layout Changes

* 🐛 fix: Reuse Principals for MCP App Validation

* Revert "🐛 fix: Keep MCP App Frames Mounted Through Layout Changes"

This reverts commit 54152c2ec5.

* 🧪 test: Preserve Dev MCP App Rendering Coverage

* fix: Restore Stable Inline MCP Apps and Queued Actions

* fix: Preserve MCP App Resource Owners Through Content Shifts

* fix: preserve message attribution and sources across MCP Apps

* test: separate MCP App detach and navigation revocation

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-16 13:27:29 -07:00
Dustin Healy
73847f2db5
🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043)
* feat: integrate durable Skill lifecycle across writers and routes

* 🧪 test: Cover Skill Management Deletion End to End

* fix: Queue superseded Skill blobs for durable cleanup

* fix: Reject Skill file storage moves without new identity

* 🧪 test: Cover Skill UI Delete and Cleanup Restart

* 🧪 test: Assert Durable Cleanup for Replaced Skill Files

* fix: release Skill names during account deletion marking

* fix: use reserved Skill blob plans across writers

* fix: hold superseded Skill blobs until sync commits

* test: preserve account deletion retry coverage after restack

* test: verify durable Skill cleanup after account erasure

* fix: complete Skill cleanup leases and avoid historical metadata scans

* fix: bound Skill cleanup manifest processing
2026-10-16 09:05:05 -07:00
Marco Beretta
ecd6943194
✂️ refactor: Remove Dead Helpers, Classes and Dependencies From packages/api (#17118)
* refactor: Remove Unused Agent Helpers and Superseded Wrappers

* refactor: Remove Dead Auth, Middleware, Protection and Prompt Helpers

* refactor: Remove Dead MCP, File, Skill and Endpoint Code

* refactor: Remove Dead Stream, Telemetry, Utility and Type Exports

* chore: Drop Unused packages/api Dependencies From bun.lock

* refactor: Keep Published Compatibility and Deprecated packages/api Exports
2026-10-16 15:43:12 +02:00
Ravi Kumar L
a7e6cc89f6
🔓 fix: Prevent 30-Second OpenID Refresh Stalls After a Discarded Prerender (#17174)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
* fix: release OpenID delivery lease when the client disconnected before delivery

A refresh whose client disconnects before the response is sent claims the
delivery lease and then arms finish/close listeners on a response that has
already closed. Neither event fires again, so the lease is never released and
every later refresh for the same generation polls until the 30-second lease
expires.

Arm the listeners only while the response is open; otherwise release the lease
directly after the send.

* fix: defer the silent refresh until a prerendered page is shown

A prerendered page runs the startup silent refresh before the user sees it.
When the browser discards the prerender, the refresh is aborted mid-flight
after the server has already rotated the refresh token, and the page the user
actually opens has to recover from a session it never received.

Wait for prerenderingchange before refreshing so a prerender has no effect on
the session.

* refactor: move OpenID response delivery into packages/api
2026-10-15 16:02:28 -07:00
Marco Beretta
d0e253043a
🙈 fix: Mask Emails and Drop Personal Identifiers From Logs (#17048)
* fix: Mask Email Addresses and Drop Personal Identifiers from Logs

* fix: Log User IDs in OpenID Admin Role and LDAP Domain Block Messages

* fix: Mask Unicode Email Addresses in Log Redaction

* test: Add Log Email Masking Scenarios

* fix: Bound the Email Redaction Matcher and Handle Quoted Local Parts

* fix: Mask Quoted and Special-Character Email Local Parts

* fix: Redact Whole Email Tokens, Top-Level Log Fields and Metadata Keys

* fix: Redact Top-Level Metadata Keys and Escaped Quotes in Email Local Parts

* fix: Redact Truncated Emails, Address Literals and Request Paths in Logs

* fix: Redact the Full Log String Before Truncating

* fix: Preserve Colliding and Object Keys When Redacting Log Metadata

* fix: Bound Log Redaction to a Window Past the Truncation Limit

* fix: Redact the Truncation Window Without a Whitespace Cut

* fix: Redact Serialized Quoted Addresses and Keep Key Collisions Linear

* fix: Bound Every Log Redaction Path and the URL Credential Pattern

* fix: Keep Long-Scheme Credential Redaction and Serialized Escaped Quotes

* test: Cover Every Secret Shape Across the Log Truncation Cap

* fix: Drop Unfinished Window Tokens, Mask Short TLDs and Redact Direct Error Stacks

* fix: Treat Input End as a Token Boundary and Mask Parenthesized Identifiers

* fix: Remove the Quoted Local Part Length Cap Without Quadratic Scans

* fix: Drop an Unfinished Quoted Address at the Window Edge

* fix: Check Quoted Locals Before Accepting a Window Delimiter

* fix: Count Only Opening Quotes When Trimming the Window

* fix: Track Unmatched Quoted Locals Instead of Counting Closing Quotes

* fix: Lift Residual Email Caps, Keep Punctuated Credential URIs Masked and Move OBO Log Id to the API Package

* fix: Mask Empty Quoted Locals and Tolerate Read-Only Log Fields

* fix: Return a Sanitized Copy When a Log Field Cannot Be Replaced

* fix: Treat a Failed Key Removal as a Failed Replacement and Guard Stack Writes

* fix: Skip Heavy Error Graphs and Accept Escaped Backslashes in Serialized Locals

* fix: Accept Lone Escaped Backslashes in Serialized Locals Without Rescans

* fix: Compact Axios Request Info Before Redaction and Skip Heavy Splat Error Graphs

* fix: Redact Address Keys on Nested Error Objects

* fix: Materialize and Redact Enumerable Getters on Nested Errors

* fix: Guard Throwing Top-Level Getters and Skip Heavy Fields Only on Error Records

* fix: Skip Serialized Quotes When Trimming an Unfinished Address

* fix: Bound Redaction With a Per-Record Node Budget and Accept JSON Control Escapes

* fix: Match Credential URIs From the Separator So Scheme Length Is Unbounded

* fix: Count Strings Against the Redaction Budget and Guard Nested Getters

* fix: Rebuild the Log Record When a Top-Level Accessor Ignores Writes

* fix: Rebuild the Log Record When a Stack Accessor Ignores Writes

* fix: Guard the Initial Stack Read on Direct Error Logs

* fix: Accept Escaped Solidus and Preserve the Outer Budget on Reentrant Logging

* fix: Guard the Axios Marker and Error-Like Probes Against Throwing Getters

* fix: Guard the Axios Marker on Nested Errors

* fix: Replace Skipped Heavy Fields Up Front, Budget Top-Level Fields and Mask Encoded Emails

* fix: Mask Encoded Address Keys and Guard Nested Axios Config Compaction

* fix: Redact URL Objects in Compact Request Info

* fix: Remove Encoded Email Caps and Strip Serializer Hooks From Clones

* fix: Strip Serializer Hooks From Error Clones and Top-Level Records

* fix: Neutralize Inherited Serializer Hooks on Log Records

* fix: Guard the Serializer Hook Probe

* fix: Replace Function Values in Log Records

* fix: Mask Percent-Encoded Domain Separators in Logged URLs

* fix: Bound the Encoded Email Domain at URL Delimiters

* fix: Shadow Throwing Serializer Getters on Nested Errors

* fix: Rebuild Accessor Messages and Mask Doubly Encoded Addresses

* fix: Redact Multiply Encoded Address Keys

* feat: Make the Log Redaction Node Budget Configurable

* fix: Guard Message and Serializer Property Reads

* fix: Contain Proxy Failures and Redact the Compact Request Method
2026-10-15 15:54:27 +02:00
Marco Beretta
5fc4371c6a
🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
Marco Beretta
9adabde72e
🗂️ feat: Audit MCP, Code Worker, Langfuse, Skill Credential, Passkey and Audit Log Access (#17054)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
* fix: Remove Group Dependents Before Deleting the Group

* feat: Audit Code Worker Pairing and Langfuse Connection Changes

* feat: Audit Skill Sync Credential Changes

* feat: Audit Passkey Enrolment and Removal

* feat: Audit Audit Log Reads and CSV Exports

* feat: Audit Audit Log Retention Purges

* feat: Audit MCP Server Create, Update and Delete

* fix: Keep Purge Result When the Purge Audit Write Fails

* test: Cover Admin Integration Audit Scenarios

* fix: Tighten Admin Integration Audit Scope and Group Cleanup Order

* fix: Run Security Fences Before Awaiting Audit Writes

* fix: Move MCP Post-Commit Audit Ordering Into the Auditor and Audit Verify Reads

* fix: Fail Closed When Recording Audit Log Access

* fix: Audit Group Deletion Before the Cascade and Restore Dependents on Failure

* fix: Restore Only Config Overrides When Group Deletion Fails

* fix: Audit Worker Pairing and Export Before the Work and Append Failures

* fix: Record Group Deletion as Pending Without Delaying Revocation

* fix: Skip Config Restore When a Concurrent Delete Removed the Group

* fix: Restore Group Config When the Existence Recheck Fails

* fix: Keep Group Config Restricted When Delete State Is Unknown

* fix: Record Worker Pairing and Revocation as Pending Until Confirmed

* fix: Deliver the Pairing Code Before the Terminal Audit Write

* test: Assert Pairing Code Delivery Precedes the Terminal Audit Write

* fix: Send Revocation and Group Deletion Responses Before the Terminal Audit Write

* fix: Snapshot Group Config Before the Destructive Cascade Step

* refactor: Type the Group Config Snapshot Dependency Without Mongoose Shapes

* fix: Fence Shared MCP Users Before the Deletion Audit and Correlate Audit Attempts

* fix: Diff MCP Server Audits Against the Committed Config

* fix: Read the Committed MCP Config at Commit Time for the Audit Diff

* refactor: Start the Committed MCP Config Read Inside the Auditor

* fix: Audit Langfuse Patches When Activation Fails and Surface Failed Group Config Restores

* fix: Record Member Removals When Group Deletion Completes After a Failed Restore

* test: Serve the Committed Config on the MCP Update Audit Reread

* fix: Audit the Group Returned by the Compensating Deletion

* fix: Keep Member Removal Audits Fail-Open During Group Deletion

* fix: Retry ACL Cleanup After a Compensating Group Deletion

* fix: Mark Unavailable Audit Detail and Order Member Removals After the Pending Deletion

* fix: Guard Synchronous Committed-Config Read Failures in the MCP Auditor

* fix: Return the Persisted MCP Config and Audit Commits That Outlive Cache Invalidation

* style: Sort Imports in MCP Audit Files

* style: Sort Imports After Restack

* fix: Audit MCP Commits That Outlive Any Post-Write Step and Pend Audit Exports Until Complete

* test: Provide the Fail-Closed Setting in the Code Route Mock

* fix: Refresh MCP Read Caches When a Repository Step Fails After the Write

* fix: Finish Audit Exports on Response Completion and Keep Error Details Out of Messages and Logs

* fix: Watch Response Completion Before the Truncation Footer Write

* fix: Skip Audit for No-op MCP Deletes and Close Remaining Post-Failure Audit Gaps

* fix: Keep Causes Out of Structured Logs and Treat a Lost Compensating Delete as Not Found

* fix: Mark Failed MCP Post-Commit Steps and Null Langfuse Activation in Audits
2026-10-15 00:30:26 +02:00
Marco Beretta
76192bdfd0
🛂 feat: Audit Resource Sharing Changes and Fail Closed on Reversible Audit Writes (#17053)
* feat: Audit Resource ACL Changes and Fail Closed by Default

* fix: Keep Non-Reversible Admin Audit Handlers Fail-Open

* docs: Narrow AUDIT_LOG_FAIL_CLOSED Description

* fix: Audit and Restore ACL and Insights Changes in One Pass

* fix: Break Audit and Insights Permission Type Cycle

* test: Cover Resource ACL Audit Scenarios

* refactor: Audit Resource Permission Changes Before Writing

* test: Align Concurrent Revoke Audit Expectation

* fix: Skip Deleting ACL Entries That Were Not Audited

* fix: Read ACL Snapshots Through the Write Session

* fix: Never Block Revocations on Audit Outages and Normalize Principal Keys

* fix: Let an Explicit Public Disable Win Over a Public Update

* fix: Audit Duplicate ACL Rows as Combined Permissions

* fix: Audit Permission Changes Under One Target and Dedupe Revokes

* fix: Audit Capability Grants Before Writing Them

* feat: Serialize Resource Permission Updates With a Per-Resource Lease

* fix: Fence the Resource Lease Before Writes and Always Audit Grant Assignments

* fix: Renew the Resource Lease Before Each ACL Write Phase

* fix: Serialize System Grant Assignment and Revocation With a Per-Grant Lease

* fix: Keep Leases Alive During Audits, Bound Lock Index Wait, Canonicalize Audit Target IDs

* fix: Retry Deferred Revoke Audits Under the Lease and Audit Canonical Principal and Role IDs

* test: Expect Role IDs in Permission Audit Metadata

* fix: Read Mutation Snapshots From the Primary Outside Transactions

* fix: Flush Deferred Audits Before Cache Invalidation, Keep Renewals Monotonic, Keep Role Case in Grant Lease Keys

* refactor: Map the Busy Permission Error to Its Code in the API Package

* style: Sort Lease Imports and Type the Renewal Spec Read

* fix: Keep Success Audits After Commit, Report Downgrades as Revocations, Code Audit Outages

* refactor: Move the Audit Outage Code to Its Own Module

* fix: Translate Lock Failures, Lease Non-Transactional Sessions, and Code Grant Audit Outages

* fix: Sanitize Lease Renewal Failures at the Permission Boundary

* fix: Annotate the Unavailable Error Code for Isolated Declarations

* fix: Keep the Admin Route Fail-Closed Opt-In and Document Lease Clock Skew Safety

* fix: Translate Grant Lease Store Failures to a Retryable 503

* fix: Log Failed Grant Audit Writes With Safe Metadata Only

* test: Detect Raw Error Arguments in the Grant Audit Log Spec

* feat: Make Permission Lease Limits Configurable and Localize Retryable Sharing Failures

* fix: Bound Lock Index Readiness by the Lease Wait and Carry the Resource ID in Every Audit Entry

* test: Cover Lease Config Reaching the Leases and the Sharing Dialog Failure Messages

* fix: Load App Config on the Sharing and Grant Routes and Log Failed Lease Releases

* perf: Load App Config Only on the Grant Mutation Routes
2026-10-15 00:30:16 +02:00
Marco Beretta
20d2c0d43d
🧹 fix: Run the Full Erasure Cascade When an Admin Deletes a User (#17050)
* fix: Run the Erasure Cascade in Admin User Deletion

* refactor: Share Generation Stop Logic Between Self-Service and Admin Deletion

* refactor: Move Admin Erasure Dependency Assembly Into packages/api

* fix: Bind getCleanupJob When Waiting for Generation Persistence

* test: Pin the Deletion Fence Before Admin Generation Stop

* fix: Resolve the Erasure Target Config Fail Closed

* fix: Carry the Target Profile Into Admin Erasure Storage Cleanup

* fix: Keep the Erasure Target Contract Storage Neutral and Reuse the Loaded Identity

* fix: Refuse New Generations Once Account Deletion Has Begun

* fix: Enforce Account Deletion Admission Once in createJob and Narrow the Erasure File Type

* fix: Install the Admission Guard in Every Entrypoint and Purge Refused Jobs

* fix: Guarantee Refused Job Purge and Sanitize Admission Failures

* fix: Route Remote Admission Through createJob and Keep Refusal Cleanup Sanitized

* fix: Log Admission Cleanup Failures With Safe Error Metadata

* refactor: Check Account Deletion Before Creating a Generation and Drain Twice

* refactor: Order Admission Against the Deletion Marker Without a Grace Period

* fix: Sanitize Post-Commit Admission Retirement Failures

* fix: Wire Shared-Server MCP OAuth Cleanup Into Admin Erasure

* fix: Scope Admin Erasure Lookups to the Target Tenant and Await Shared-Link Cleanup

* fix: Resolve the Erasure Target Config Under the Target Tenant

* fix: Run Admin Erasure OAuth Fencing in the Target Tenant

* fix: Match the Split OAuth Invalidate and Disconnect Hooks in Admin Erasure

* refactor: Inject the Tenant Executor Into the Erasure Resolver
2026-10-14 23:54:32 +02:00
Marco Beretta
6e2941050b
🗑️ fix: Route Delete-User CLI Through the Shared Account Erasure Cascade (#17033)
* fix: Route Delete-User CLI Through the Shared Account Erasure Cascade

The operator CLI ran raw deleteMany calls that dropped File metadata while leaving storage objects, skipped skills, MCP servers and agent checkpoints, and used the wrong field for agent API keys. Account self-deletion and the CLI now share eraseUserData in packages/api, so both remove stored file objects before metadata, open checkpoint deletion around conversations, and clear skills, MCP servers and shared links with ACL cleanup.

* fix: Erase Favorites, Projects, Queued Turns and Refresh Bridges With the Account

Account erasure left tool favorites, chat projects, queued agent turns and their sequences, and OpenID refresh token bridges behind. The shared eraseUserData cascade now clears them, adding deleteUserToolFavorites and deleteUserChatProjects where no delete-by-user method existed.

* fix: Move MCP Server Erasure Queries Into Data Methods and Propagate Their Failures

* test: Cover Delete-User CLI and Self-Service Erasure Scenarios

* fix: Delete Stored Files When Account Deletion Arrives Without a Body

* fix: Delete Stored Files Before User Keys and Keep Provider Failures Best Effort

* fix: Propagate Agent and Prompt Erasure Failures Before Deleting the User

* fix: Delete Erasure Retry Anchors Last When Removing User-Owned Resources

* fix: Retire Session Hint From the Shared Erasure Cascade After Sessions Are Revoked

* fix: Propagate Skill and Agent Reference Cleanup Failures Before Deleting the User

* fix: Scope CLI Account Erasure to the Deleted User's Tenant and Legacy Refresh Bridges

* fix: Clean Shared-User MCP OAuth State When Account Erasure Removes a Server

* fix: Keep CLI Erasure System-Scoped Except ID-Keyed Cleanup and Await Shared-Link ACL Cleanup

* fix: Scope CLI MCP OAuth Lookups to the Tenant and Fail Erasure When Shared-User Cleanup Fails

* fix: Run CLI MCP OAuth Teardown and Allowlist Resolution Per User in the Tenant

* fix: Tear Down Shared-User MCP OAuth State Before Removing the Server Retry Anchors

* fix: Pin Agent Reference and MCP Token Cleanup to the Deleted User's Own Tenant
2026-10-14 23:53:16 +02:00
Marco Beretta
80e3707964
🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926)
* fix: Boot-Paint a Cached Theme Only for the Tab's Signed-In Owner

The boot script and DeploymentTheme's first commit replayed the deployment-theme cache without checking its owner, so a browser that last held one identity's theme painted it for another until the config answered. The tab now records its signed-in owner in session storage and both paths replay the cache only when it matches.

* test: Assert Session Ends Forget the Tab Theme Owner

* test: Hold the First-Paint Config Answer Until the App Paints

* fix: Skip the Boot-Painted Theme Cache Once the Session Has Ended

* fix: Bind the Readable Session Hint to the Signed-In Owner

* test: End the Session for Real in the Expired-Hint Scenarios

* fix: Clear the Session Hint When a Local Refresh Finds No Session

* test: Give the Refresh Specs the Cookie Surface the Session Hint Uses

* test: Count the Signed-Out Config Answer in the No-Cached-Paint Scenarios

* fix: Retire the Session Hint on Every Rejected OpenID Refresh

* fix: Retire the Session Hint When a Refresh Carries No Token

* fix: Retire the Session Hint on Account Deletion and Password Reset

* refactor: Own the Session Hint Lifecycle in the Typed Auth Cookies
2026-10-14 11:08:53 +02:00
Marco Beretta
c0f7822f2e
📧 fix: Log User IDs Instead of Emails in Admin Panel Auth Flow (#17032)
* fix: Log User IDs Instead of Emails in Admin Panel Auth Flow

* fix: Sort Imports in Admin Middleware Spec

* test: Cover Admin Exchange and Access Denial in Mock Scenarios

* test: Remove the Generated User After the Admin Denial Scenario
2026-10-13 08:42:57 +02:00
Marco Beretta
a06ee14b75
🔐 fix: Encrypt User Plugin Credentials With Random-IV v3 Format (#16996)
* fix: Encrypt User Plugin Credentials With Random-IV v3 Format

* test: Cover Credential Encryption Formats in Mock E2E Scenarios

* test: Round-Trip Real Credential Helpers in PluginService Spec

* 🙈 fix: Remove SharePoint Picker Payload Logging (#16997)

* fix: Add credentials.writeFormat to Gate v3 Credential Writes During Rollouts

* test: Expect 201 When the Legacy Write Format Override Is Created

* 🔊 fix: Clear TTS Audio Cache On Session End and Hash Its Keys (#16998)

* fix: Clear TTS Audio Cache On Session End and Hash Its Keys

* fix: Read Manual TTS Replays From the Hashed Cache Key

* fix: Purge Legacy TTS Cache Keys and Fence Writes Across Logout

* fix: Keep TTS Cache Writes Off the Playback Path

* test: Expect Hashed Keys in the StreamAudio Cache Lookup

* test: Use a Single-Token Reply Label in the TTS Cache Scenario

* fix: Settle TTS Cache Clear Before IdP Logout and Across Tabs

* test: Cover the TTS Cache Fence When Another Tab Logs Out

* test: Wait for the Second Tab Before Logging Out in the TTS Scenario

* fix: Latch TTS Cache Writes Shut Until the Tab Authenticates Again

* fix: Reopen TTS Cache Writes When Authentication Completes In Place

* fix: Leave for the IdP Even When TTS Cache Cleanup Fails

* fix: Retry a Failed Legacy TTS Purge and Fence Other Tabs on Manual Clear

* fix: Rerun the Legacy TTS Purge After Each Clear and Sign-In

* fix: Rerun the Legacy TTS Purge When Another Tab Clears

* fix: Fence Pre-Auth TTS Writes, Retry Failed Clears, and Fall Back to Storage Events

* fix: Version the Hashed TTS Cache Key Path

* fix: Move TTS Audio to a New Cache and Keep It Closed Until a Failed Clear Succeeds

* fix: Persist a Pending TTS Cache Delete Across Navigation

* fix: Reopen TTS Caching Only on Session Start and Fence Cache Reads

* fix: Keep the TTS Delete Fence in Cache Storage and Close Reads After Logout

* refactor: Keep Read-Aloud Audio in Tab Memory Instead of Cache Storage

* test: Return to the Conversation After Re-Login in the TTS Logout Scenario

* test: Close the Phone Sidebar Before Replaying in the TTS Logout Scenario

* fix: Bound the In-Memory TTS Cache by Size as Well as Count

* fix: Scope Cached TTS Audio to the Signed-In User

* fix: Keep the Settings Cache Delete Available While Legacy Audio Remains

* fix: Recheck Legacy TTS Audio After a Settings Clear and on Unowned Handoff

* fix: Fence TTS Writes Started Before an Account Signs In

* test: Opt the Fresh TTS Account Into Enter-to-Send
2026-10-12 16:33:08 +02:00
Marco Beretta
ee1d59e590
🕵️ fix: Redact Email Addresses and IPs From Auth Flow Logs (#16994) 2026-10-12 10:50:56 +02:00
Marco Beretta
903027733f
🪦 fix: Omit Email From Account Deletion Log (#16993) 2026-10-12 10:50:44 +02:00
Danny Avila
b2bcbf9380
🧯 feat: Recover Conversations Whose Attachments Keep Failing (#16965)
* 🧯 feat: Recover Conversations Whose Attachments Keep Failing

Once a branch carries a problem attachment, every turn resends it and
fails the same way. A failed response whose branch carries files now
offers "Retry without files" (re-asks the failed turn with no files as a
new version) and, when earlier turns carry files, "Branch without files"
(a copy up to the last good answer with every upload and code output
left out, with the failed message restored to the composer). File-shaped
errors say so in the card.

The edit view shows a user message's files as removable chips; "Update &
rerun" sends only the kept files and Save is disabled after a removal.
Fork is offered on a failed turn and gains a "Leave out files" option,
backed by a new `excludeFiles` fork option that drops `files`,
`attachments` and the conversation's `files` from the copy.

Bedrock rejects a request whose documents share a name, and history
resends every earlier document, so repeated names are now numbered
before formatting.

* 🧯 fix: Cover Steered Files, Hand Off the Whole Failed Turn, Name Replayed Documents Once

- Excluding files from a fork also strips attachments steered into a
  response (`content[].files` on steer parts), which replay like uploads,
  and the decision lives in `forkFileScope` in packages/api.
- The recovery card counts steered attachments as files, and reads the
  specific code inside a generic `error` envelope, so a rate limit is not
  offered files as the fix.
- "Branch without files" hands the failed turn to the copy's composer the
  way a message is put back for editing: text through the in-memory
  handoff, quotes, manual skills and the reasoning override through their
  compose-time atoms.
- Document names are deduplicated over the formatted payload after the
  steer stamp, so replayed steer documents are numbered too.
- Fork stays withheld on a failed response, whose copy would carry the
  error as an ordinary answer; the card's branch action copies up to the
  turn before.
- Remove-file buttons are natively disabled while the editor is locked.

* 🧯 fix: Keep Search Sources, Scope Root Retries, Skip Legacy Rate Limits

- A fork without files keeps metadata-only attachments (search sources,
  file search results) and drops only file-backed ones; the recovery card
  likewise counts only file-backed attachments as files.
- A turn sent at the root takes none of the conversation's file refs: its
  siblings' uploads (an edited first message, or one retried without its
  files) no longer come back through the unanchored-continuation fallback.
- Rows that carry a legacy LangChain model, key or rate-limit code are not
  offered files as the fix.

* 🧯 fix: Align File Exclusion With Replay's File Shapes, Skip Assistants, Verify the Copy

- Shared `messageCarriesFiles` (with `isFileContentPart`,
  `hasContentPartFiles`, `isFileAttachment`) in data-provider names every
  shape historical replay reads a file by: uploads, file-backed
  attachments, attached `files` on any content part, and `image_file`,
  `file` or direct `file_id` locators. The fork drops all of them and the
  recovery card detects all of them.
- Assistants conversations get no recovery actions: their upstream thread
  keeps every attachment, and those endpoints offer no fork either.
- "Branch without files" checks the returned copy; a server that ignored
  `excludeFiles` gets an error toast instead of a false recovery.

* 🧯 fix: Type Replay's Provider-Native File Locators for the Part Predicates
2026-10-10 08:43:39 -04:00
Marco Beretta
6e6dc1be11
🪢 fix: Settle Compaction Rows Past Anchor Collisions and Legacy Parts (#16552)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
* 📴 fix: Stamp Legacy Failure Parts When Settling a Compaction Row

* 📴 fix: Redirect the Collision Error Row to the Live Response Id

* 📴 fix: Withhold the Anchor-Colliding Error Row and Keep Pending Rows Fallbacks

* 📴 fix: Scope the Settled-Job Guard to Compactions and Copy Stamped Parts

* test: Cover the Underscore-Leaf Compaction Failure and Abandoned Replies in E2E

* test: Fail the Underscore-Leaf Compaction Through the Blank Summarizer

* refactor: Return the Final Error Row Id From the Settlement
2026-10-08 23:03:58 +02:00
Marco Beretta
578572327a
🎚️ feat: Filter OpenRouter Reasoning Efforts by the Selected Model (#16808)
* feat: Filter OpenRouter Reasoning Efforts by the Selected Model

* fix: Address Review Findings on OpenRouter Per-Model Reasoning Efforts

* fix: Report Catalog Failures, Share Lookups and Honor Direct Endpoints for Reasoning Efforts

* fix: Move Capabilities Handler Into packages/api and Harden Catalog Lookups

* fix: Scope Reasoning Capabilities to One Endpoint and Gate Editors Until They Load

* fix: Skip Catalog Reads for Explicit Definitions and Keep Staged Efforts While Loading

* fix: Retry the Reasoning Capabilities Query on Focus and Reconnect After a Failure

* fix: Remember Failed Catalog Lookups, Reject Locked Overrides Early and Keep Restored Efforts

* fix: Hide Efforts Until the Catalog Is Known, Keep Unlisted Models Unknown and Accept Auto

* fix: Mark OpenRouter Endpoints by Their Resolved Host so the Client Fetches Capabilities

* fix: Share One OpenRouter Catalog Rule, Build the Catalog URL Safely and Make the Lifetime Configurable

* fix: Forward Static Catalog Headers, Resolve Relative Next Links and Align Client Freshness

* fix: Limit Capabilities to Exposed Models and Revalidate Against the Server Entry Expiry

* fix: Hide Efforts After a Failed Refresh, Reject Malformed Pagination and Skip User-Scoped Catalogs

* fix: Use Own-Property Lookups, Skip the Catalog for Auto and Revalidate From the Remaining Lifetime

* fix: Treat Request Metadata Headers as Shared, Store Catalogs as Own Entries and Hide Efforts During Refresh

* fix: Keep Configured Query Parameters Across Catalog Pages and Treat Expired Idle Data as Unknown

* fix: Expose Only Configured Variants, Skip Identity Headers on Fixed Lists and Keep Staged Efforts
2026-10-08 18:04:13 +02:00
Danny Avila
6b5cf0a231
🏝️ fix: Apply the No-Workspace Decision Wherever an Agent's Code Route Resolves (#16798)
* 🏝️ fix: Apply the No-Workspace Decision Wherever an Agent's Code Route Resolves

A conversation set to run without attached workspaces failed mid-turn with
"Choose an attached workspace before using this agent." when its agent's
default machine was attached and the turn loaded a skill or another tool at
execution time. Request-start initialization honoured the decision, but the
execution-time tool loader re-resolved the agent's attached default and then
demanded a workspace selection the conversation intentionally never made.

The per-agent code rule now lives in one typed function,
resolveAgentCodeExecution (packages/api/src/code/agent.ts): it applies the
conversation's no-workspace opt-out, the run-code grant, the stateful
capability and the stateful environment policy, then resolves the base route.
Request-start initialization, lazy subagent metadata and graph members, the
execution-time and definition tool loaders, and the legacy execute_code
loader all go through it, so an opted-out agent lands on the managed default
route with no code tools at every site. Per-call subagent machine choices
offer and accept no attached machine in such a conversation, and a source
invariant test keeps new resolver call sites on the shared rule.

* fix: Pass the Implicit Stateful Route Rollout Into the Shared Code Rule

The per-agent code rule read the implicit stateful route rollout from the environment itself. It now takes it as a parameter, and the request boundaries (initializeAgent and withRequestCodeInputs) resolve it from the deployment configuration, so the rule stays a pure function of its inputs.

* fix: Carry the Initializer's Code Opt-Out Into Tool Definition Loading

initializeAgent hands the tool loaders a partial agent record (id, tools, provider, model) together with the code route it already resolved. Without the agent's route fields the definition loaders could not see a no-workspace opt-out and recomputed code execution as enabled, so tool classification could advertise the programmatic bash tool that execution then refuses. initializeAgent now passes attachedEnvironmentOptOut through every tool loader, and the shared rule keeps an opt-out its caller already decided.
2026-10-06 07:40:42 -04:00
Marco Beretta
cac13c42e7
🧷 fix: Finalize Stopped Compactions and Verify Their Anchor (#16551)
* 📴 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
2026-10-05 21:38:22 +02:00
Marco Beretta
edc96d549e
📴 fix: Persist Cancelled Compactions With Their Identity (#16436)
* 📴 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
2026-10-05 21:38:04 +02:00
lia-by-librechat[bot]
114394c6a0
🦉 feat: Compare Review Commit Ancestry Without Git (#16734)
* 🦉 feat: Compare Review Commit Ancestry Without Git

* test: Cover Attached Reviewer Compare Registration

* 🦉 feat: Compare Review Commit Ancestry Without Git

* test: Cover Attached Reviewer Compare Registration

* 🦉 feat: Use SDK GitHub Comparison With Host Eligibility Gates

* test: Await the Comparison Timeout Assertion

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-05 08:20:51 -04:00
Danny Avila
3a32d8b0d3
🏝️ fix: Let a No-Workspace Turn Carry a Remembered Approval Mode (#16763)
* 🏝️ 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.
2026-10-05 07:28:28 -04:00
Danny Avila
301f9ac634
🚕 feat: Add Per-Call Subagent Machine Selection (#16757)
* 🧭 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.
2026-10-05 06:21:15 -04:00
Atef Bellaaj
3c90cde7d8
🔗 feat: use LibreChat prompt groups as agent instructions (#16686)
* 🔗 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>
2026-10-04 21:27:26 -04:00
lia-by-librechat[bot]
0e3c9088f6
🫰 feat: Configure Tool Approval Modes Per Agent (#16707)
* 🫰 feat: Configure Tool Approval Modes Per Agent

* fix: Fence Remembered Tool Approval Authority

* fix: Unify Tool Approval Execution Invariants

* fix: Revalidate Learned Approval at MCP Invocation

* fix: Preserve One-Time MCP Review at Invocation

* fix: Execute Reviewed Calls on Templated MCP Connections

* fix: Scope Approval Witnesses to Executing Agents

* fix: Retain Approval Bindings for Hook-Rewritten Inputs

* fix: Pin Review Authority and Retire Settled Tool Calls

* fix: Fingerprint Effective MCP Request Headers

* fix: Preserve Routing Around Renewable MCP Token Fragments

* fix: Bind Tool Consent to OAuth Credential Generations

* test: Keep Mobile Approval Save Outside Drawer Escape Race

* fix: Fence OAuth Consent at MCP Transport Retries

* fix: Let Shared Agent Viewers Reset Personal Consent

* fix: Preserve Renewed Consent Across Reset Races

* fix: Resolve Verified Aliases for Personal Tool Reset

* fix: Fence Renewed OAuth Consent and Credential Review

* fix: Require Foreground Execution for Review-Only MCP Calls

* fix: Pin Invocation Ownership and Stable MCP Consent

* fix: Fence Superseded Tool Consent Completion Writes

* fix: Scope Consent Epochs to Effective MCP Authentication

* fix: Scope Approval Admission to Reachable Agent Tools

* fix: Preserve Approval Epochs for Runtime-Detected OAuth

* fix: Address Tool Approval Review Findings

* fix: Preserve Captured Consent When Tool Approval Is Inherited

* fix: Preserve Approval Admission Through Lazy Metadata

* fix: Fence Programmatic Reviews and Unresolved Lazy Approval Keys

* fix: Account for Normalized and Skill-Contributed Lazy Tools

* fix: Scope Lazy Approval to Selected Tool Spellings and Servers

* fix: Honor Disabled MCP Capability During Lazy Approval Admission

* test: Preserve Approval Merge Regressions After Rebase

* fix: Preserve One-Time Review During Non-OAuth Grant Outages

* fix: Retain One-Time Consent Across Resume Recovery

* fix: Preserve Reviewed Consent Through Transport Outages

* fix: Preserve Case-Variant Lazy Approval Hook Admission

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-04 13:14:48 -04:00
lia-by-librechat[bot]
38a9dab3f5
🦫 feat: Enforce Scheduled MCP Read-Only Authority (#16681)
* feat: enforce scheduled MCP read-only authority

* fix: preserve startup admission and enforce consent deadline

* fix: fail closed on malformed scheduled consent

* fix: preserve scheduled MCP authority failure receipts

* fix: preserve scheduled MCP handoffs and manual runs

* fix: persist mandatory scheduled tool policy denials

* fix: fence late scheduled consent and retain denial recovery

* fix: retain scheduled transport denials and prevent replay

* fix: merge retained scheduled denials during settlement

* fix: prevent enrolled schedule completion wakeup escapes

* fix: close scheduled consent admission and receipt races

* fix: retain scheduled completion authority across approval

* fix: retain safe scheduled authorization dependency denials

* fix: sanitize scheduled authorization preparation failures

* fix: bind schedule completion authority to task origin

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-03 20:39:43 -04:00
Marco Beretta
6f4e36665e
🗄️ perf: Cut Serial and Redundant Database Reads (#16711)
* perf: Cut Serial and Redundant Database Reads

* perf: Pick the Earliest Balance per User in MongoDB
2026-10-03 10:41:47 -04:00
Marco Beretta
7957d0b587
🧾 fix: Commit Resume Provenance With the Approval Claim (#16430)
* 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
2026-10-03 13:31:20 +02:00
Marco Beretta
fb1dd57a9b
🔓 feat: Remember Tool Approvals Per Conversation (#16557)
* 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
2026-10-03 11:47:32 +02:00
lia-by-librechat[bot]
de7755b4ca
🕊️ fix: Keep Attachment History From Locking Conversations (#16690)
* 🕊️ fix: Keep Attachment History From Locking Conversations

* test: Correct Attachment Regression Fixtures

* fix: Preserve Current Attachment Admission During Steering

* fix: Release Historical Attachment Counts After Failed Steering

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-02 20:21:19 -04:00
Danny Avila
2529b22a66
🔕 fix: Log Lost Generation Predecessor Fences as Warnings (#16689)
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.
2026-10-02 20:12:22 -04:00
lia-by-librechat[bot]
73d704656e
📔 feat: Preserve Owner Text During PII Redaction (#16311)
* 📔 feat: Preserve Owner Text During PII Redaction

* 🧵 fix: Keep Ordinary Chat Views Outside Private Text Provider

* 🧷 fix: Preserve Owner Text Across Copy and Edit Paths

* 🔏 fix: Protect PII on Denial and Abort Paths

* fix: preserve protected text through denial, stop, and owner reload

* test: cover preliminary private metadata in disconnect fixture

* test: carry preliminary metadata in resume controller fixture

* test: preserve Stop prerequisite identity in tenant fixture

* fix: keep protected owner text out of search and exports

* fix: preserve trusted PII placeholders through provider inspection

* fix: coordinate protected turns across Stop and native sharing

* fix: Preserve Private Text Admission and Query Lifecycles

* fix: Track Private Query Effect Dependencies

* fix: Fence Protected Admission and Screenshot Targets

* fix: Share Protected Admission and Preserve Native Token Trust

* test: Wait for Private Message Concurrency Indexes

* fix: Preserve Protected Admission Across Recovery and Titles

* fix: Coordinate Protected Root Admission and Early Stop

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-02 11:43:10 -04:00
Atef Bellaaj
7c4cfa8684
♻️ refactor: Native Prompts Behind a Shared Service and Adapter (#16506)
* ♻️ 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>
2026-10-02 08:40:39 -04:00
Danny Avila
2eee568542
🧳 feat: Choose Agent-Allowed Machines For New Chats (#16651)
* feat: Let New Chats Choose Agent-Allowed Machines

* test: Keep Machine Choice Contracts And Native Selectors In Sync

* fix: Preserve Graph Machine Choices And Reference Lifecycles

* fix: Explain Graph Workspace Requirements And Validate Machine Choices

* test: Cover Default And Non-Default Graph Machine Choices

* test: Keep Unauthorized Machine Duplication Mocks Isolated

* fix: Preserve Graph Agent Machine Ownership And Explain Requirements

* fix: Preserve Stable Workspace Ownership Across Runtime And Config Changes

* test: Wait For Verified Generation Readiness In Native Canaries
2026-10-02 08:38:14 -04:00
Marco Beretta
92432e95d5
🔐 feat: Enforce Required Two-Factor Authentication (#14731)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
* 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
2026-10-01 23:39:51 +02:00
Lia
bbb58a867e ⛴️ fix: Preserve Canary Sync Resolutions (#16457)
Retain the tracked-file integration outcomes recorded by original canary sync PR #16457.

No new implementation is introduced. Shared and ambiguous corrections are carried by the final sync-resolution commit so the resulting tracked tree equals frozen canary f66ad88e1c.

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16457
Resolution-Sources: ffa54e0259, 7fe6eab03e, 8f64336ee4, 207ee8b0df, 7f3f82f284, e9e5b36bd2, ff3f0f8bef, 6bd657753a, 84a53a4464, f66ad88e1c
2026-10-01 03:46:19 +00:00