mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
Atomic file claiming (#11675) added a unique partial index on (filename, conversationId, context, tenantId) for execute_code outputs. Records written before it inserted a new document per regeneration, so any deployment that re-ran a cell producing the same filename carries duplicates the index cannot span: Mongo aborts the build with E11000 and the constraint is silently absent — the claim path still works, but without its database-level guard against concurrent inserts. Adds config/migrate-code-file-duplicates.js to normalize that legacy data, following the existing migration conventions (dry-run default, --batch-size, runAsSystem for cross-tenant scans). Renames rather than deletes: each duplicate is a distinct stored object, typically still referenced by a message attachment, so removing one would strip a real artifact from a user's history. The newest record keeps the canonical name — matching the claim path's latest-write-wins behavior — and older copies gain a ' (n)' suffix that skips names already taken in the conversation. Attachments embed their own filename, so rendered history is unchanged. After a successful apply the script builds the index directly (targeted createIndex, not syncIndexes) so the operator learns immediately whether the constraint is now in place. |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| translations | ||
| add-balance.js | ||
| ban-user.js | ||
| circular-deps.mjs | ||
| connect.js | ||
| create-user.js | ||
| delete-banner.js | ||
| delete-user.js | ||
| deployed-update.js | ||
| flush-cache.js | ||
| helpers.js | ||
| invite-user.js | ||
| jest.config.js | ||
| list-balances.js | ||
| list-users.js | ||
| migrate-agent-permissions.js | ||
| migrate-code-file-duplicates.js | ||
| migrate-orphaned-agent-files.js | ||
| migrate-prompt-permissions.js | ||
| migrate-shared-link-permissions.js | ||
| migrate-terms-timestamp.js | ||
| packages.js | ||
| prepare.js | ||
| reset-meili-sync.js | ||
| reset-password.js | ||
| reset-terms.js | ||
| set-balance.js | ||
| smart-reinstall.js | ||
| stop-backend.js | ||
| test-subdirectory-setup.sh | ||
| update-banner.js | ||
| update.js | ||
| user-stats.js | ||