Skip to content

📎 fix: Respect fileConfig.disabled for Agents Endpoint Upload Button#12238

Merged
danny-avila merged 3 commits into
devfrom
fix/agents-fileconfig-disabled
Mar 15, 2026
Merged

📎 fix: Respect fileConfig.disabled for Agents Endpoint Upload Button#12238
danny-avila merged 3 commits into
devfrom
fix/agents-fileconfig-disabled

Conversation

@danny-avila

@danny-avila danny-avila commented Mar 15, 2026

Copy link
Copy Markdown
Owner

Summary

Fixed a boolean operator precedence bug in AttachFileChat that caused fileConfig.endpoints.agents.disabled to have no effect, and added regression tests covering the upload guard for both the agents and assistants endpoints.

  • Regrouped the else if condition in AttachFileChat.tsx from isAgents || (endpointSupportsFiles && !isUploadDisabled) to (isAgents || endpointSupportsFiles) && !isUploadDisabled, ensuring the !isUploadDisabled guard applies to both branches.
  • Refactored mockFileConfig in AttachFileChat.spec.tsx from a const to a mutable let with a beforeEach reset, matching the existing pattern used for mockAgentsMap and mockAgentQueryData.
  • Added four regression tests in a new upload disabled rendering describe block: agents endpoint with fileConfig.agents.disabled: true returning null, agents endpoint with disableInputs: true returning null, assistants endpoint without disabled config rendering AttachFile as a positive control, and assistants endpoint with fileConfig.assistants.disabled: true returning null.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

Verified via the new unit tests in AttachFileChat.spec.tsx. To reproduce the bug manually before this fix: configure fileConfig.endpoints.agents.disabled: true in librechat.yaml, start the app, switch to an agents conversation, and confirm the attach file button no longer renders.

Test Configuration:

Run from the client workspace:

npx jest AttachFileChat

All 20 tests in AttachFileChat.spec.tsx should pass, including the 4 new tests in the upload disabled rendering block.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

The isAgents check was OR'd without the !isUploadDisabled guard,
bypassing the fileConfig.endpoints.agents.disabled setting and
always rendering the attach file menu for agents.
Copilot AI review requested due to automatic review settings March 15, 2026 01:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the attach-file UI rendering logic so the agents endpoint no longer bypasses fileConfig’s disabled flag, ensuring uploads can be properly disabled per endpoint configuration.

Changes:

  • Updates the conditional that decides whether to render AttachFileMenu so !isUploadDisabled applies to both isAgents and endpointSupportsFiles cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread client/src/components/Chat/Input/Files/AttachFileChat.tsx
Cover the isUploadDisabled rendering gate for agents and assistants
endpoints, preventing silent reintroduction of the bypass bug.
@danny-avila danny-avila force-pushed the fix/agents-fileconfig-disabled branch from b677a03 to 475f521 Compare March 15, 2026 02:28
@danny-avila danny-avila changed the title fix: respect fileConfig.disabled for agents endpoint upload button 📎 fix: Respect fileConfig.disabled for Agents Endpoint Upload Button Mar 15, 2026
@danny-avila danny-avila force-pushed the fix/agents-fileconfig-disabled branch from 3c30eba to 334d918 Compare March 15, 2026 14:22
Verify agents-disabled propagates when no provider is set,
when provider has no specific config (agents as fallback),
and that provider-specific enabled overrides agents disabled.
@danny-avila danny-avila force-pushed the fix/agents-fileconfig-disabled branch from 334d918 to 8a60058 Compare March 15, 2026 14:30
@danny-avila danny-avila merged commit 93a628d into dev Mar 15, 2026
7 checks passed
@danny-avila danny-avila deleted the fix/agents-fileconfig-disabled branch March 15, 2026 14:35
jcbartle pushed a commit to jcbartle/LibreChat that referenced this pull request May 11, 2026
…anny-avila#12238)

* fix: respect fileConfig.disabled for agents endpoint upload button

The isAgents check was OR'd without the !isUploadDisabled guard,
bypassing the fileConfig.endpoints.agents.disabled setting and
always rendering the attach file menu for agents.

* test: add regression tests for fileConfig.disabled upload guard

Cover the isUploadDisabled rendering gate for agents and assistants
endpoints, preventing silent reintroduction of the bypass bug.

* test: cover disabled fallback chain in useAgentFileConfig

Verify agents-disabled propagates when no provider is set,
when provider has no specific config (agents as fallback),
and that provider-specific enabled overrides agents disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: fileConfig.endpoints.agents.disabled doesn't hide upload button in chat input

2 participants