Skip to content

Conversation

@Defozo
Copy link

@Defozo Defozo commented Nov 19, 2025

Summary

This PR introduces a new configuration option agents.preventFileVersionHistory in librechat.yaml.

When enabled, this option prevents the creation of a new Agent version snapshot each time a file is attached to an Agent.

Motivation:
This is particularly useful for RAG use cases where an Agent might have dozens or hundreds of documents attached over time. Currently, each file attachment triggers updateAgent, which creates a full duplicate of the Agent's state (including the growing file list) in the versions array. This leads to significant database document growth and can cause the Agent document to hit the 16MB MongoDB document size limit.

Related docs PR: LibreChat-AI/librechat.ai#446

Change Type

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Testing

  1. Enable the setting in librechat.yaml:
    agents:
      preventFileVersionHistory: true
  2. Start the application.
  3. Create or select an Agent.
  4. Upload and attach a file to the Agent (e.g., via File Search / RAG).
  5. Inspect the database or Agent Version history in the UI.
    • Expected: The file is attached successfully, but the version count/list does not increment for this specific action.
  6. Disable the setting (or remove it).
  7. Attach another file.
    • Expected: A new version snapshot is created.

Test Configuration

  • librechat.yaml configured with agents.preventFileVersionHistory: true

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 this feature

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.

1 participant