feat: delete failed ingestion documents - #2188
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Summary
Previously, a document that failed to ingest was a dead end in the Knowledge table: only
activerows had any actions, so afailedrow couldn't be removed. It also disappeared from the UI on refresh even though the backend still held the failed task entry in memory (~1h), so the failure silently lingered with no way to clear it.This PR adds a delete (trash) action on failed rows that removes the document from the list for good, and makes failed rows persist across refresh so the action is reliably reachable.
Changes
Backend — dismiss a failed task file
src/services/task_service.py: newdismiss_files()that removes terminalFAILEDfile entries from the in-memory task store (adjusting counters, and dropping the whole task record once it has no files left). OnlyFAILEDentries are dismissible.src/api/tasks.py:DismissFilesBody+dismiss_fileshandler (404 unknown task, 400 no-op, 200 on success).src/app/routes/internal.py: registersPOST /tasks/{task_id}/files/dismiss.tests/unit/test_task_service_dismiss_files.py: unit tests (remove + drop empty task, keep task with remaining files + counter adjustment, skip non-failed/unknown paths, unknown-task → None).Frontend — delete action on failed rows
frontend/app/api/mutations/useDismissTaskFilesMutation.ts: new hook wrapping the dismiss endpoint; invalidatestasks/listFiles/search.frontend/components/knowledge-row-actions.tsx: new cell component rendering a trash icon for failed rows. Delete best-effort clears any indexed chunks (delete-by-filename, which 404s harmlessly for never-indexed docs) then dismisses the failed task entry. Gated behind the existingknowledge:deletepermission.frontend/app/knowledge/page.tsx: renders the delete action forfailedrows (active rows keep the existing three-dot menu; other statuses have no action).frontend/contexts/task-context.tsx: rebuildfailedoverlays on initial load so failed rows survive a page refresh instead of vanishing while the backend still holds them.Before
Screen.Recording.2026-07-29.at.3.24.07.PM.mov
After
Screen.Recording.2026-07-30.at.2.38.33.PM.mov
Testing
task_servicetests unaffected.