Skip to content

feat: delete failed ingestion documents - #2188

Open
richardz403 wants to merge 2 commits into
release-0.6.0from
delete-failed-ingest-documents
Open

feat: delete failed ingestion documents#2188
richardz403 wants to merge 2 commits into
release-0.6.0from
delete-failed-ingest-documents

Conversation

@richardz403

Copy link
Copy Markdown
Collaborator

Summary

Previously, a document that failed to ingest was a dead end in the Knowledge table: only active rows had any actions, so a failed row 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: new dismiss_files() that removes terminal FAILED file entries from the in-memory task store (adjusting counters, and dropping the whole task record once it has no files left). Only FAILED entries are dismissible.
  • src/api/tasks.py: DismissFilesBody + dismiss_files handler (404 unknown task, 400 no-op, 200 on success).
  • src/app/routes/internal.py: registers POST /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; invalidates tasks / 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 existing knowledge:delete permission.
  • frontend/app/knowledge/page.tsx: renders the delete action for failed rows (active rows keep the existing three-dot menu; other statuses have no action).
  • frontend/contexts/task-context.tsx: rebuild failed overlays 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

  • New backend unit tests pass; existing task_service tests unaffected.
  • Frontend typecheck/lint clean on changed files.
  • Manual: ingest a failing file → failed row shows a trash icon → delete removes it and it does not reappear on the next poll or after a page refresh.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3df428d9-96e2-47bb-9556-a1007fbd5090

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added frontend 🟨 Issues related to the UI/UX backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) tests enhancement 🔵 New feature or request labels Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 91a6c5a.

@github-actions github-actions Bot added enhancement 🔵 New feature or request and removed enhancement 🔵 New feature or request labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) enhancement 🔵 New feature or request frontend 🟨 Issues related to the UI/UX tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant