Repository navigation
Fix per-block ID collisions and add block cleanup for unstructured uploads - #6944
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to clean up unstructured block upload directories, adding a backend DELETE endpoint, frontend API integration, and a stable per-block UID (unstructured_upload_uid) to prevent ID collisions. Feedback on these changes highlights a directory traversal vulnerability in the backend path handling, a critical safety issue where legacy block cleanup could delete active files of other recipes, a React useEffect dependency optimization, and a UX improvement to maintain file list order when restoring files after a failed deletion.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 704faf7b64
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e43d2aba77
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf261e0e14
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4f424205a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Ran a focused check on this PR: https://github.com/Imagineer99/unsloth/actions/runs/28894496624 Looks good, the focused checks pass here. This covered the per-block upload quota, UID-only block cleanup, legacy node ID protection, and the frontend cleanup wiring. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aebb69ff78
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: abe3350605
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cedfbfcbf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Still exists server-side (counts toward quota); restore it at its | ||
| // original position. | ||
| deletedIdsRef.current.delete(entry.id); | ||
| onFilesChange((prev) => { |
There was a problem hiding this comment.
Avoid restoring files after the drop zone is stale
When the DELETE fails after the user has switched this seed away from the old unstructured block (or the drop zone has unmounted with a different blockId), this stale catch still calls onFilesChange. Because addSeedNode reuses the same seed config id while clearing the UID/file list, the restore can write the old file ID back into the new/non-unstructured seed, leaving saved UI state that points at the wrong upload block and causing later inspect/cleanup to operate on the wrong directory. Guard the restore with the current block/mounted state, or skip restoration once the drop zone is no longer active.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 17d14fa: guarded the failed-delete restore with a mounted ref plus a blockId ref, so a late DELETE rejection after the drop zone unmounts or its block uid changes no longer writes the stale file id back into the wrong block. Verified with a React runtime test covering same-block restore, unmount, and blockId-change.
|
Pushed a small follow-up to the drop zone ( The failed-delete restore branch could reinsert a file id into the wrong block. If Guarded the restore so it is skipped once the drop zone unmounts ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17d14fa11b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |

Fixes #6921 the users hit 413: Total upload limit (1GB) exceeded on small files (6.7MB) because upload quota accounting wasn't correctly scoped per block.
Core issue: config.id for a seed block resets to n1 on recipe import, so unstructured upload blocks from different recipes could collide on the same server-side block_id. Stale/orphaned files from old or unrelated blocks kept counting toward the shared quota, so new small uploads got rejected even though they were nowhere near 1GB on their own.