LibreChat/api/server/services
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
..
__tests__ 🏝️ fix: Apply the No-Workspace Decision Wherever an Agent's Code Route Resolves (#16798) 2026-10-06 07:40:42 -04:00
Agents 🔗 feat: use LibreChat prompt groups as agent instructions (#16686) 2026-10-04 21:27:26 -04:00
Artifacts
Config 🔭 feat: Recover Stale Chunks Without the Error Page and Ship Client Logs to RUM (#16701) 2026-10-03 23:17:56 -04:00
Endpoints 🏝️ fix: Apply the No-Workspace Decision Wherever an Agent's Code Route Resolves (#16798) 2026-10-06 07:40:42 -04:00
Files 🔇 fix: Keep Reasoning Out of Read Aloud (#16790) 2026-10-05 23:44:39 +02:00
MCP 🫧 fix: Retire Cancelled MCP OAuth State (#15702) 2026-09-07 15:43:02 -04:00
Runs
Schedules ⏳ feat: Reset Balance Allowances Without Rollover (#16781) 2026-10-05 11:44:00 -04:00
Skills 📜 feat: Add Skills Discovery and Authoring to the Management API (#15642) 2026-09-06 17:26:26 -04:00
start 🦉 feat: Compare Review Commit Ancestry Without Git (#16734) 2026-10-05 08:20:51 -04:00
Threads ⚡ perf: Async Local File Saves and Compile Hot-Path Regexes Once (#16712) 2026-10-04 15:52:55 -04:00
Tools 🕊️ feat: Supply Authorized Scheduled MCP Resource Bearers (#16699) 2026-10-04 22:20:50 -04:00
ActionService.js 🛖 fix: Scope OAuth Binding Cookies to the Public API Path (#16649) 2026-10-02 13:21:49 -04:00
ActionService.spec.js 🛖 fix: Scope OAuth Binding Cookies to the Public API Path (#16649) 2026-10-02 13:21:49 -04:00
AssistantService.js
AuthService.js 📧 feat: add email address change (#14597) 2026-10-01 03:46:16 +00:00
AuthService.spec.js ⏳ feat: Add Ephemeral Retention Mode for Forced Temporary Chats (#13811) 2026-10-01 03:46:19 +00:00
cleanup.js
createRunBody.js
createRunBody.spec.js
GraphApiService.js
GraphApiService.spec.js
GraphTokenService.js
initializeMCPs.js 🫗 fix: Bound MCP App Responses and In-Flight Work (#16300) 2026-10-01 03:46:17 +00:00
initializeMCPs.plugins.spec.js 🧩 feat: MCP Apps support (#13831) 2026-10-01 03:46:16 +00:00
initializeMCPs.spec.js 🫸 fix: Gate MCP App Views and Actions on User Intent (#16297) 2026-10-01 03:46:17 +00:00
initializeOAuthReconnectManager.js 🛂 fix: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04:00
initializeOAuthReconnectManager.spec.js 🛂 fix: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04:00
MCP.js 🕊️ feat: Supply Authorized Scheduled MCP Resource Bearers (#16699) 2026-10-04 22:20:50 -04:00
MCP.spec.js 🕊️ feat: Supply Authorized Scheduled MCP Resource Bearers (#16699) 2026-10-04 22:20:50 -04:00
MCPAuthorizationFenceRetry.js 🛂 fix: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04:00
MCPAuthorizationFenceRetry.spec.js 🛂 fix: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04:00
MCPRequestContext.js
OboPolicyService.js
OboTokenService.js
OboTokenService.spec.js
OpenIDRefreshFlight.js
OpenIDRefreshFlight.spec.js 🪫 fix: Recharge Direct OpenID MCP Bearer Sessions (#15704) 2026-09-07 21:05:26 -04:00
OpenIDRefreshRecovery.js
OpenIDSessionRefresh.js 🪫 fix: Recharge Direct OpenID MCP Bearer Sessions (#15704) 2026-09-07 21:05:26 -04:00
OpenIDSessionRefresh.spec.js 🪫 fix: Recharge Direct OpenID MCP Bearer Sessions (#15704) 2026-09-07 21:05:26 -04:00
PermissionService.js 🧲 fix: Match Directory Users to Existing Principals (#15855) 2026-09-12 07:36:22 -04:00
PermissionService.spec.js 🚥 fix: Preserve Insights With Guarded ACL Role Updates (#16170) 2026-09-21 23:40:52 -04:00
PluginService.js
PluginService.spec.js
RefreshTokenBridge.js
RefreshTokenBridge.spec.js
systemGrant.spec.js
ToolService.js 🏝️ fix: Apply the No-Workspace Decision Wherever an Agent's Code Route Resolves (#16798) 2026-10-06 07:40:42 -04:00
twoFactorService.js 🗝️ fix: Strengthen Two-Factor Recovery Credentials (#16742) 2026-10-04 12:16:37 -04:00
twoFactorService.spec.js 🗝️ fix: Strengthen Two-Factor Recovery Credentials (#16742) 2026-10-04 12:16:37 -04:00