LibreChat/api/server/controllers/agents/__tests__
Marco Beretta 2ad2c1c14b
🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466)
* perf: Serve JWT Bearer User Lookups From the Auth User Cache

* perf: Batch Agent Permission Reads on the File Access Path

* perf: Remember a Loaded Google Service Key Across Endpoint Config Reads

* perf: Run Independent Startup, Tool, Skill and Erasure Reads Concurrently

* fix: Drop JWT User Cache Writes That Race a User Mutation

Confirm each cache write with a second read and evict when the user changed,
so an in-flight lookup cannot repopulate an entry a credential change just
evicted. The cache mode now arrives through the loader dependencies.

* refactor: Move Agent Skill Access Reads Into packages/api

The chat-completions and Responses controllers call loadSkillAccess instead of
orchestrating the three reads in CJS. The preview route spec mocks the batched
file access helper the middleware now calls.

* test: Cover Agent File Access, JWT Bursts and Remote Skill Reads End to End

* fix: Serve a Cached JWT User Only While Its updatedAt Is Current

A cache hit now reads the stored updatedAt and deletion fence instead of the
fence alone, so a document cached from a read that raced a user mutation is
never served, even when the write landed after that mutation's eviction.

* refactor: Move Startup Migration Checks Into packages/api

* refactor: Inject the Startup Migration Checks Instead of Mongoose Models

* fix: Serve Cached OpenID Users Only While Their updatedAt Is Current

Moves the freshness check into getCurrentCachedAuthUserDoc and uses it on the
OpenID bearer path as well as the local JWT one, so a document cached from a
read that raced a credential or role change is never served there either.

Fixes berry-13/LibreChat#432

* fix: Compare Authorization Fields on Every Auth Cache Hit

updatedAt has millisecond resolution, so the freshness read also compares the
token retirement stamps, role, tenant and two-factor state.

* fix: Annotate the Auth Freshness Projection for Isolated Declarations

* perf: Reuse the OpenID Cache Freshness Read for Deletion Admission

A cache hit already proved the deletion fence is clear, so only users read from
the database take the separate fence query.

* refactor: Keep the OpenID Cache Freshness and Fence Decisions in packages/api

* test: Exercise JWT Cache Freshness Against Real User Methods in MongoDB

* fix: Stamp the JWT User Lookup So the Cache Write Fence Applies

* fix: Reload a Google Service Key File When It Changes or Disappears

The availability check remembers a loaded key only while the file's mtime and
size are unchanged, and fetches URL sources every time as before.

* fix: Recheck a Service Key File After a Permission Change
2026-10-30 00:24:08 +01:00
..
askUserQuestion.e2e.spec.js 🥢 fix: Fit MCP App Snapshots Within Message Documents (#16299) 2026-10-01 03:46:17 +00:00
callbacks.spec.js 🧯 fix: Guard SSE Writes and Interval Cleanups Against Crashes (#17462) 2026-10-27 23:06:58 +01:00
client.contextMetadata.spec.js 🧾 fix: Count the Tool Results a Tool-Limit Stop Retains (#15893) 2026-09-13 22:20:25 -04:00
client.eventActorPause.spec.js
client.memory.spec.js
client.retainedAnswers.spec.js ✂️ fix: Keep Parts After a Summary in the Summary-Bounded History Read (#16434) 2026-09-30 09:26:46 +02:00
client.steerWiring.spec.js 🎒 fix: Bound Agent Attachment Context (#15694) 2026-09-07 08:16:34 -04:00
client.subagentUsage.spec.js 🥢 fix: Fit MCP App Snapshots Within Message Documents (#16299) 2026-10-01 03:46:17 +00:00
client.traceContext.spec.js 🪬 feat: Configure Langfuse Trace User Identity and Metadata (#15667) 2026-09-06 17:30:23 -04:00
client.transactions.spec.js 🥢 fix: Fit MCP App Snapshots Within Message Documents (#16299) 2026-10-01 03:46:17 +00:00
hitlCheckpoint.e2e.spec.js 🥢 fix: Fit MCP App Snapshots Within Message Documents (#16299) 2026-10-01 03:46:17 +00:00
jobReplacement.spec.js
modelEndHandler.spec.js 🪙 fix: Price 1-Hour Prompt Cache Writes at the 1-Hour Rate (#17208) 2026-10-17 15:43:57 +02:00
openai.spec.js 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
protocol.spec.js
request.partialDisconnect.spec.js 🛟 fix: Promote Reconciled Compaction Snapshots to the Terminal Row (#16553) 2026-10-28 11:13:50 +01:00
request.resumeMetadata.spec.js 🛟 fix: Promote Reconciled Compaction Snapshots to the Terminal Row (#16553) 2026-10-28 11:13:50 +01:00
responses.unit.spec.js 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
resume.spec.js 🐘 fix: Preserve Authored Skills Across Approval Resumes (#17630) 2026-10-29 22:17:03 +01:00
steer.spec.js
toolContext.spec.js 🧮 feat: Surface Retained Tool-Message Context Usage (#15796) 2026-09-11 15:53:29 -04:00
usageEvents.integration.spec.js 🧮 feat: Surface Retained Tool-Message Context Usage (#15796) 2026-09-11 15:53:29 -04:00
usageEvents.live.spec.js
v1.duplicate-actions.spec.js
v1.spec.js 🔣 refactor: Replace Mongo Filters With Typed Criteria (#15580) 2026-09-04 11:54:21 -04:00