LibreChat/api/server/services/Endpoints/agents
Claude a0b38c3196
🔐 fix: Resolve Tool Grants Once Per Request and Pair Every Capability Gate
Four review rounds found thirteen issues, all one class: a boundary the
permission check had not been copied into. Rounds 2 and 3 each found gaps
created by the previous round's fix, and a manual sweep of tool constructors
and upload routes still missed the `codeEnvAvailable` family entirely — because
the thing worth enumerating is not "paths that reach a tool" but "reads of the
capability".

There are 28 such reads. This replaces per-site permission checks with one
resolution per request, pairs every read that is a gate, and pins the list so a
new one cannot be added silently.

- `resolveToolRoleGrants` resolves `RUN_CODE` and `FILE_SEARCH` together and
  memoizes on the request. Both perf findings disappear by construction: gates
  share one role read instead of each issuing its own.

- Newly paired gates: `codeEnvAvailable` in the OpenAI-compatible, Responses and
  memory-agent initializers (`initializeAgent` rebuilds `bash_tool`, `read_file`
  and the workspace file tools from it, and hands their handlers the code
  environment); the capability checks in agent upload processing and in
  agent-management upload purposes; and the library chat-completion service,
  behind an optional `getRoleByName` dependency so embedders are not broken.

- The v1 Knowledge upload posts `assistant_id` with no `tool_resource`, so there
  is no resource to authorize. It now reads the assistant's own native tools and
  requires their grants, instead of treating a missing resource as unrestricted.

- The startup role read moved off the critical path into the existing
  `Promise.all`, and the direct tool-call check passes `req` so the shared
  loader gate reuses its result rather than repeating the lookup.

- `toolCapabilityGates.spec.js` pins every file that reads either capability
  with a count and a reason. A new read fails the suite until it is classified,
  so the next boundary announces itself instead of waiting for a reviewer.
2026-09-07 04:50:22 +00:00
..
addedConvo.js 🚧 fix: Narrow Chat MCP Selections to What the Picker May Offer (#15478) 2026-09-01 18:47:36 -04:00
addedConvo.spec.js 🛟 fix: Stop Agents When Code Resources Cannot Recover (#14651) 2026-08-07 00:33:28 -04:00
backgroundCompletion.js 🛎️ feat: Wake Agents on Background Tool Completion (#15350) 2026-08-30 08:56:41 -04:00
build.js 🚧 fix: Narrow Chat MCP Selections to What the Picker May Offer (#15478) 2026-09-01 18:47:36 -04:00
eventChildLease.js 📨 feat: Continue Bound Child Agents from Events (#15112) 2026-08-23 01:15:57 -04:00
index.js 🚧 chore: merge latest dev build to main repo (#3844) 2024-08-31 16:33:51 -04:00
initialize.js 🔐 fix: Resolve Tool Grants Once Per Request and Pair Every Capability Gate 2026-09-07 04:50:22 +00:00
initialize.spec.js 🌳 feat: List Attached Workspace Trees (#15527) 2026-09-04 10:52:34 -04:00
skillDeps.js 📓 feat: Author Files in Attached Workspaces (#15548) 2026-09-04 12:16:23 -04:00
skillDeps.spec.js 📓 feat: Author Files in Attached Workspaces (#15548) 2026-09-04 12:16:23 -04:00
subagentThreadStore.js 💓 fix: Detect Silently Dead Redis Sockets With Deadline-Bounded Heartbeats (#15539) 2026-09-03 09:45:16 -04:00
subagentThreadStore.spec.js 💓 fix: Detect Silently Dead Redis Sockets With Deadline-Bounded Heartbeats (#15539) 2026-09-03 09:45:16 -04:00
title.js 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
title.test.js 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00