🧹 fix: Let file deletes succeed when the Code API refuses the sandbox delete - #86
Closed
TomasPalsson wants to merge 1 commit into
Closed
TomasPalsson wants to merge 1 commit into
TomasPalsson wants to merge 1 commit into
Conversation
… Sandbox Delete A file with a code environment reference also deletes its sandbox copy. When the Code API refused that call (409 execution_profile_mismatch after the switch to a stateful-only self-hosted Code API), the whole delete was marked failed, so the record and its agent references stayed and every later code turn aborted with 'Failed to provision N file(s) to the code environment'. The sandbox copy is a cache that expires on its own, so its delete failure is now logged and ignored.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Author
|
Superseded by the upstream fix LibreChat-AI#16671 (narrower: only 409 execution_profile_mismatch is tolerated, in deleteCodeEnvFile). It is cherry-picked onto sync/v0.8.8-rc4 as a single commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On vis-prod and apro-prod, users cannot delete agent files whose bytes are gone from
/app/uploads. The agent keeps the dead file, and every code turn fails withFailed to provision N file(s) to the code environment.Datadog (request
465bac5d-…, vis-prod, 2026-10-02 13:37Z):execution_profile_mismatch(expecteddefault, actualstateful).createDeleteFileWithSecondaryStoragerethrows that error, so the file goes intofailedFileIds. The DB record and the agent references stay.Fix
The sandbox copy is a cache that expires on its own. A failed code environment delete is now logged as a warning, and the file record and agent references are removed anyway. Vector DB delete failures still block, as before.
Tests
processDeleteRequest › removes metadata and agent references when the code environment rejects the delete. It fails before this change and passes after.process.spec.jsandprocess.integration.spec.js: 119 passed.routes/files/*.test.jsfail to load locally (flowsCache is not a function) with or without this change. That is an environment issue, not this change.