Skip to content

feat(config): add atomic saves and revision rollback - #143

Open
romy651 wants to merge 4 commits into
LibreChat-AI:mainfrom
fdj-united:feat/admin-config-atomic-mutate
Open

feat(config): add atomic saves and revision rollback#143
romy651 wants to merge 4 commits into
LibreChat-AI:mainfrom
fdj-united:feat/admin-config-atomic-mutate

Conversation

@romy651

@romy651 romy651 commented Sep 1, 2026

Copy link
Copy Markdown

Summary

Adds atomic, versioned configuration saves and revision rollback to the LibreChat Admin Panel.

  • send base saves, resets, imports, deletions, and restores through LibreChat's atomic mutation endpoint with expectedVersion
  • reject stale saves instead of silently overwriting a newer administrator's change
  • add configuration revision history and restore controls
  • connect revision handling to the same MongoDB database used by LibreChat
  • reconstruct indexed edits as complete array writes so dotted paths cannot turn arrays into numeric-key objects
  • merge custom endpoints by name and preserve stored secrets without copying YAML-only credentials into MongoDB
  • keep explicit secret and credential-container clears authoritative
  • validate indexed values, bounds, reset paths, ambiguous unions, and unsafe field paths before submitting a mutation
  • enforce the backend's combined 100-operation mutation limit

Backend dependency: danny-avila/LibreChat#15458

The backend must be merged and deployed before, or in the same release train as, this PR.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Translation update

Testing

  • bun run lint
  • bun run test — 28 test files and 920 tests
  • bun run build

Coverage includes atomic save payloads, revision lifecycle and restore behavior, CAS conflicts, indexed-array reconstruction, custom endpoint keyed merges, secret preservation and explicit clearing, mutation limits, unsafe path rejection, and reset-path validation.

Test Configuration

  • Bun 1.3.14
  • macOS
  • server-function tests use mocked LibreChat API, session, and capability boundaries
  • revision lifecycle tests use the in-memory revision store

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my code
  • I have commented in complex areas of the code
  • I have made pertinent README and environment-example updates
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective
  • Local unit tests pass with my changes

Romuald Wandji added 3 commits September 1, 2026 12:06
Keep a revision before each save, import, or reset, and add History on the configuration page. Persist to Mongo when MONGO_URI is set so a mistaken change can be rolled back.
Pin mongodb@6 so the Bun server can connect, and default to the LibreChat database when the URI has no path.
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