Skip to content

Feature: user select pipeline support - #16788

Merged
JinHai-CN merged 4 commits into
infiniflow:mainfrom
xugangqiang:feat/customize-pipeline
Jul 10, 2026
Merged

JinHai-CN merged 4 commits into
infiniflow:mainfrom
xugangqiang:feat/customize-pipeline

Conversation

@xugangqiang

Copy link
Copy Markdown
Contributor

Summary

Feature: user select pipeline support

1. e2e - execute pipeline to parse pdf file and save chunks to ES
2. chunks can be retrieved for using in chat
@xugangqiang xugangqiang added the ci Continue Integration label Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR migrates document ingestion toward IngestionTask records and message-queue publication, simplifies task context loading, makes dataflow execution pipeline-based, updates deletion behavior, and adjusts related tests and proxy routing.

Changes

IngestionTask/MQ migration

Layer / File(s) Summary
Ingestion-task cleanup and lookup
internal/dao/ingestion.go, internal/admin/service.go, internal/service/document.go, internal/service/document_test.go
Renames the deletion DAO method, updates cleanup callers, returns no error for missing document-task lookups, and aligns deletion fixtures with ingestion-task records.
TaskContext and pipeline resolution
internal/ingestion/task/task_context.go, internal/ingestion/service/ingestion_service.go, internal/ingestion/task/*_test.go
Reduces task context state, resolves pipeline IDs from document or knowledgebase data, and requires a configured pipeline ID before document execution.
Pipeline execution and output processing
internal/ingestion/task/dataflow_service.go, internal/ingestion/task/dataflow_*test.go
Renames execution APIs, makes output processing internal, loads DSL from user canvases, and updates execution tests.
Dataflow task handling
internal/ingestion/task/task_handler.go, internal/ingestion/task/task_handler_test.go, internal/ingestion/service/*test.go
Removes task-type dispatch, routes handling through Execute, validates context and pipeline IDs, and updates progress assertions.
Document ingestion task publishing
internal/service/document.go, internal/service/document_test.go
Creates ingestion tasks, publishes tasks.RAGFLOW messages through the queue engine, and verifies that legacy task rows are not created.

Hybrid proxy routing

Layer / File(s) Summary
API proxy path matching
web/vite.config.ts
Adds document-ingest matching and changes the memories matcher to the /api/v1/memories path.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant DocumentService
  participant IngestionTaskDAO
  participant MQEngine
  participant TaskHandler
  Client->>DocumentService: Ingest document
  DocumentService->>IngestionTaskDAO: CheckAndCreate ingestion task
  DocumentService->>MQEngine: Publish tasks.RAGFLOW message
  MQEngine->>TaskHandler: Deliver ingestion task
  TaskHandler->>TaskHandler: Execute pipeline and process output
Loading

Possibly related PRs

Suggested reviewers: yingfeng, yuzhichang, JinHai-CN

Poem

A rabbit queues tasks through the night,
Pipelines hop onward, IDs set right.
Old task rows fade from the den,
New messages run again and again.
Chunks bloom softly, progress in flight—
Hop, hop, the ingestion path is bright!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description only repeats the title and lacks the required summary details and background context. Expand the Summary with the problem being solved, why it matters, and a brief overview of the key implementation changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main change: user-selected pipeline support.

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.

@xugangqiang
xugangqiang force-pushed the feat/customize-pipeline branch from b2af266 to a8fa139 Compare July 9, 2026 12:38
@xugangqiang
xugangqiang marked this pull request as ready for review July 9, 2026 12:39
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. 💞 feature Feature request, pull request that fullfill a new feature. labels Jul 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/dao/ingestion.go (1)

260-283: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Delete orphaned IngestionTaskLog rows when deleting an IngestionTask.

The method queries IngestionTaskLog rows to collect files but never deletes them within the transaction. After the parent IngestionTask is deleted, these log rows become orphaned with a dangling task_id foreign key. The IngestionTaskLog entity has no cascade-delete GORM tag, so logs accumulate indefinitely.

🛡️ Proposed fix
 		err = tx.Model(&entity.IngestionTask{}).Where("id = ?", taskID).Delete(&entity.IngestionTask{}).Error
 		if err != nil {
 			return nil, err
 		}
 
+		if err = tx.Where("task_id = ?", taskID).Delete(&entity.IngestionTaskLog{}).Error; err != nil {
+			return nil, err
+		}
+
 		taskInfo := &TaskInfo{
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/dao/ingestion.go` around lines 260 - 283, The delete flow in the
IngestionTask cleanup path collects `IngestionTaskLog` records but never removes
them, leaving orphaned logs after `IngestionTask` deletion. Update the
transaction in the same method that queries `taskLogs` and deletes
`entity.IngestionTask` to also delete matching `IngestionTaskLog` rows for the
same `taskID` before or alongside the parent delete, ensuring the cleanup stays
atomic and no dangling `task_id` rows remain.
🧹 Nitpick comments (3)
internal/service/document.go (2)

1446-1451: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove or improve debug-style log statements.

The dash-prefixed messages ("-----------------go side, before/after insert document") look like temporary development artifacts. They lack structured context (e.g., docID) and add noise to every ingest request. Either remove them or include the document ID for production usefulness.

♻️ Proposed fix
-		common.Info("-----------------go side, before insert document")
 		if _, err := s.IngestDocuments(doc.KbID, userID, []string{doc.ID}); err != nil {
 			common.Error(fmt.Sprintf("go side, doc %s, IngestDocuments", docID), err)
 			return common.CodeExceptionError, err
 		}
-		common.Info("-----------------go side, after insert document")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/document.go` around lines 1446 - 1451, Remove the temporary
dash-prefixed debug logs around the document ingest flow in the document insert
path, or replace them with production-appropriate structured logs that include
useful context like docID. Update the logging in the insert/ingest block near
s.IngestDocuments so it no longer emits noisy “before/after insert document”
messages without identifiers, and keep the error path logging as the primary
signal.

729-730: 🗄️ Data Integrity & Integration | 🔵 Trivial

Address the FIXME: files from taskInfo are not deleted.

The Delete DAO method returns TaskInfo.FilesToDelete, but deleteDocumentFull only logs a warning and skips actual file cleanup. This can lead to orphaned storage objects. Would you like me to generate an implementation that deletes these files from storage?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/document.go` around lines 729 - 730, The Delete flow is only
logging a warning and never removing the files listed in taskInfo.FilesToDelete.
Update deleteDocumentFull in document.go to actually iterate over
TaskInfo.FilesToDelete and delete each referenced storage object, using the same
storage cleanup path used elsewhere in the document service. Keep the existing
Delete DAO behavior intact, and replace the FIXME/Warn-only handling with real
cleanup tied to the taskInfo result.
internal/handler/document.go (1)

1274-1275: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove or improve debug-style log statements.

The dash-prefixed messages ("---------- go side ingest request") look like temporary development artifacts. They lack structured context (e.g., userID, doc count) and fire on every ingest request. Either remove them or include meaningful fields.

♻️ Proposed fix
 func (h *DocumentHandler) Ingest(c *gin.Context) {
-	common.Info("---------- go side ingest request")
-
 	user, errorCode, errorMessage := GetUser(c)
 	if code, err := h.documentService.Ingest(userID, &req); err != nil {
 		common.ErrorWithCode(c, int(code), err.Error())
 		return
 	}
 
-	common.Info("---------- go side ingest request completed")
-
 	common.SuccessWithData(c, true, "success")

Also applies to: 1299-1300

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/handler/document.go` around lines 1274 - 1275, The debug-style log
in the ingest flow is a temporary artifact and should not be emitted as a
dash-prefixed message on every request. Update the logging in the ingest handler
around the request entry and related ingest path to either remove these
`common.Info` calls or replace them with structured logs that include meaningful
context such as userID and document count, using the ingest request handling
logic in `document.go` as the location reference.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/ingestion/service/ingestion_service.go`:
- Around line 291-298: defaultRunDocumentTask is losing cancellation/deadline
propagation because the incoming ctx is never attached to the TaskContext
returned by LoadFromIngestionTask. In ingestion_service.go, update
defaultRunDocumentTask to assign the passed-in ctx onto docTaskCtx.Ctx before
the TaskHandler uses it, so pipeline execution does not fall back to
context.Background(). Keep the fix localized to defaultRunDocumentTask and the
TaskContext setup.

In `@internal/ingestion/task/real_consumer_test.go`:
- Around line 151-154: Set a PipelineID on the seeded Knowledgebase or Document
used by LoadFromIngestionTask so TaskHandler.Handle does not pass an empty
dataflow ID into NewDataflowService. Update the test setup around the
LoadFromIngestionTask/Handle flow in real_consumer_test.go to populate
PipelineID on the task’s underlying Knowledgebase or Document, matching the
field that LoadFromIngestionTask copies.

In `@internal/service/document.go`:
- Around line 1576-1588: The ingestion flow in `CheckAndCreate`/`publishTask`
leaves an `IngestionTask` stuck in `CREATED` if `json.Marshal` or
`s.publishTask("tasks.RAGFLOW", payload)` fails, which blocks retries. Update
the task-creation path in `Document` service to clean up or roll back the newly
created task on any failure after `CheckAndCreate` succeeds, so a later retry
can create a fresh task. Use the `task` returned from `CheckAndCreate` and
ensure failures after that point do not leave an orphaned `CREATED` record.
- Around line 718-724: The document deletion flow in the code path using
GetByDocumentID is treating “no ingestion task” as a hard error, so the nil
check is never reached. Update the deletion logic around GetByDocumentID to
explicitly handle gorm.ErrRecordNotFound as a non-fatal case (or use a lookup
that returns nil without error), while still returning real DAO errors. Keep the
behavior aligned with the old taskDAO.DeleteByDocIDs path so documents without
ingestion tasks can still be deleted.

---

Outside diff comments:
In `@internal/dao/ingestion.go`:
- Around line 260-283: The delete flow in the IngestionTask cleanup path
collects `IngestionTaskLog` records but never removes them, leaving orphaned
logs after `IngestionTask` deletion. Update the transaction in the same method
that queries `taskLogs` and deletes `entity.IngestionTask` to also delete
matching `IngestionTaskLog` rows for the same `taskID` before or alongside the
parent delete, ensuring the cleanup stays atomic and no dangling `task_id` rows
remain.

---

Nitpick comments:
In `@internal/handler/document.go`:
- Around line 1274-1275: The debug-style log in the ingest flow is a temporary
artifact and should not be emitted as a dash-prefixed message on every request.
Update the logging in the ingest handler around the request entry and related
ingest path to either remove these `common.Info` calls or replace them with
structured logs that include meaningful context such as userID and document
count, using the ingest request handling logic in `document.go` as the location
reference.

In `@internal/service/document.go`:
- Around line 1446-1451: Remove the temporary dash-prefixed debug logs around
the document ingest flow in the document insert path, or replace them with
production-appropriate structured logs that include useful context like docID.
Update the logging in the insert/ingest block near s.IngestDocuments so it no
longer emits noisy “before/after insert document” messages without identifiers,
and keep the error path logging as the primary signal.
- Around line 729-730: The Delete flow is only logging a warning and never
removing the files listed in taskInfo.FilesToDelete. Update deleteDocumentFull
in document.go to actually iterate over TaskInfo.FilesToDelete and delete each
referenced storage object, using the same storage cleanup path used elsewhere in
the document service. Keep the existing Delete DAO behavior intact, and replace
the FIXME/Warn-only handling with real cleanup tied to the taskInfo result.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5c1fe55e-0e7e-4159-b9c0-5e9dd5e4c04c

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8b51c and a8fa139.

📒 Files selected for processing (17)
  • internal/admin/service.go
  • internal/dao/ingestion.go
  • internal/handler/document.go
  • internal/ingestion/service/execute_task_test.go
  • internal/ingestion/service/ingestion_service.go
  • internal/ingestion/service/real_consumer_dataflow_test.go
  • internal/ingestion/task/dataflow_e2e_test.go
  • internal/ingestion/task/dataflow_real_pipeline_integration_test.go
  • internal/ingestion/task/dataflow_service.go
  • internal/ingestion/task/dataflow_service_test.go
  • internal/ingestion/task/real_consumer_test.go
  • internal/ingestion/task/task_context.go
  • internal/ingestion/task/task_context_test.go
  • internal/ingestion/task/task_handler.go
  • internal/ingestion/task/task_handler_test.go
  • internal/service/document.go
  • internal/service/document_test.go

Comment on lines +151 to 154
tc, err := LoadFromIngestionTask(task)
if err != nil {
t.Fatalf("LoadTaskContext: %v", err)
t.Fatalf("LoadFromIngestionTask: %v", err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how TaskHandler.Handle uses PipelineID / dataflowID
ast-grep outline internal/ingestion/task/task_handler.go --match 'Handle|handleDataflow' --view expanded

# Search for PipelineID usage in the handler and dataflow service
rg -nC3 'PipelineID|dataflowID' internal/ingestion/task/task_handler.go internal/ingestion/task/dataflow_service.go --type=go

Repository: infiniflow/ragflow

Length of output: 10361


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the test and task-loading code around the relevant lines.
ast-grep outline internal/ingestion/task/real_consumer_test.go --view expanded
ast-grep outline internal/ingestion/task/task_context.go --view expanded
ast-grep outline internal/ingestion/task/task_loader.go --view expanded

printf '\n--- real_consumer_test.go (selected lines) ---\n'
sed -n '1,220p' internal/ingestion/task/real_consumer_test.go

printf '\n--- task_context.go (selected lines) ---\n'
sed -n '1,240p' internal/ingestion/task/task_context.go

printf '\n--- task_loader.go (selected lines) ---\n'
sed -n '1,240p' internal/ingestion/task/task_loader.go

Repository: infiniflow/ragflow

Length of output: 9420


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- task_handler.go ---'
cat -n internal/ingestion/task/task_handler.go

printf '\n%s\n' '--- search for task type / parser based dispatch ---'
rg -nC3 'handleDataflow|handleStandard|ParserID|TaskType|ParserType|PipelineID' internal/ingestion/task internal/entity internal/dao --type=go

Repository: infiniflow/ragflow

Length of output: 42346


Set a PipelineID on the seeded KB or Document.
LoadFromIngestionTask only copies PipelineID from Document or Knowledgebase; with both empty here, TaskHandler.Handle() passes an empty dataflow ID into NewDataflowService and fails with empty dataflow id.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/ingestion/task/real_consumer_test.go` around lines 151 - 154, Set a
PipelineID on the seeded Knowledgebase or Document used by LoadFromIngestionTask
so TaskHandler.Handle does not pass an empty dataflow ID into
NewDataflowService. Update the test setup around the
LoadFromIngestionTask/Handle flow in real_consumer_test.go to populate
PipelineID on the task’s underlying Knowledgebase or Document, matching the
field that LoadFromIngestionTask copies.

Comment thread internal/service/document.go Outdated
Comment on lines 718 to 724
ingestionTask, err := s.ingestionTaskDAO.GetByDocumentID(docID)
if err != nil {
return err
}
if ingestionTask == nil {
return nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

GetByDocumentID returns an error (not nil) when no task exists — the nil check is dead code and blocks document deletion.

GetByDocumentID uses First(), which returns gorm.ErrRecordNotFound when no record is found. The if err != nil { return err } guard catches this before the if ingestionTask == nil check is ever reached. Documents without ingestion tasks (e.g., those using the legacy non-pipeline path) will fail to delete entirely. The old taskDAO.DeleteByDocIDs was a no-op when no tasks existed, so this is a regression.

🐛 Proposed fix
 	// Delete tasks from DB
 	ingestionTask, err := s.ingestionTaskDAO.GetByDocumentID(docID)
 	if err != nil {
-		return err
-	}
-	if ingestionTask == nil {
-		return nil
-	}
-	taskInfo, err := s.ingestionTaskDAO.Delete(ingestionTask.ID, &ingestionTask.UserID)
-	if err != nil {
-		return err
+		if !dao.IsNotFoundErr(err) {
+			return err
+		}
+		// No ingestion task for this document; proceed with deletion
+	} else {
+		taskInfo, delErr := s.ingestionTaskDAO.Delete(ingestionTask.ID, &ingestionTask.UserID)
+		if delErr != nil {
+			return delErr
+		}
+		// FIXME: need to add logic to delete files in taskInfo
+		common.Warn(fmt.Sprintf("need to delete files from taskInfo: %v", taskInfo))
 	}
-	// FIXME: need to add logic to delete files in taskInfo
-	common.Warn(fmt.Sprintf("need to delete files from taskInfo: %v", taskInfo))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ingestionTask, err := s.ingestionTaskDAO.GetByDocumentID(docID)
if err != nil {
return err
}
if ingestionTask == nil {
return nil
}
ingestionTask, err := s.ingestionTaskDAO.GetByDocumentID(docID)
if err != nil {
if !dao.IsNotFoundErr(err) {
return err
}
// No ingestion task for this document; proceed with deletion
} else {
taskInfo, delErr := s.ingestionTaskDAO.Delete(ingestionTask.ID, &ingestionTask.UserID)
if delErr != nil {
return delErr
}
// FIXME: need to add logic to delete files in taskInfo
common.Warn(fmt.Sprintf("need to delete files from taskInfo: %v", taskInfo))
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/document.go` around lines 718 - 724, The document deletion
flow in the code path using GetByDocumentID is treating “no ingestion task” as a
hard error, so the nil check is never reached. Update the deletion logic around
GetByDocumentID to explicitly handle gorm.ErrRecordNotFound as a non-fatal case
(or use a lookup that returns nil without error), while still returning real DAO
errors. Keep the behavior aligned with the old taskDAO.DeleteByDocIDs path so
documents without ingestion tasks can still be deleted.

Comment on lines +1576 to +1588
task, err := s.ingestionTaskDAO.CheckAndCreate(task)
if err != nil {
return err
}
message := documentTaskMessage(task)
message["task_type"] = task.TaskType
message["kb_id"] = doc.KbID
message["tenant_id"] = kb.TenantID
message["dataflow_id"] = flowID
message["file"] = nil
if redisClient := redis.Get(); redisClient == nil || !redisClient.QueueProduct(documentParseQueueName(doc, priority), message) {
return fmt.Errorf("Can't access Redis. Please check the Redis' status.")
taskMessage := common.TaskMessage{
TaskID: task.ID,
TaskType: common.TaskTypeIngestionTask,
}
return nil
payload, err := json.Marshal(taskMessage)
if err != nil {
return err
}
return s.publishTask("tasks.RAGFLOW", payload)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Orphaned IngestionTask on publish failure blocks retries.

If publishTask (or json.Marshal) fails after CheckAndCreate succeeds, the task remains in CREATED status with no message published. CheckAndCreate rejects documents with an existing CREATED task, so the user cannot retry — the document is permanently stuck.

🔒 Proposed fix: clean up task on failure
 	task, err := s.ingestionTaskDAO.CheckAndCreate(task)
 	if err != nil {
 		return err
 	}
 	taskMessage := common.TaskMessage{
 		TaskID:   task.ID,
 		TaskType: common.TaskTypeIngestionTask,
 	}
 	payload, err := json.Marshal(taskMessage)
 	if err != nil {
+		_, _ = s.ingestionTaskDAO.Delete(task.ID, &task.UserID)
 		return err
 	}
-	return s.publishTask("tasks.RAGFLOW", payload)
+	if err := s.publishTask("tasks.RAGFLOW", payload); err != nil {
+		_, _ = s.ingestionTaskDAO.Delete(task.ID, &task.UserID)
+		return err
+	}
+	return nil
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
task, err := s.ingestionTaskDAO.CheckAndCreate(task)
if err != nil {
return err
}
message := documentTaskMessage(task)
message["task_type"] = task.TaskType
message["kb_id"] = doc.KbID
message["tenant_id"] = kb.TenantID
message["dataflow_id"] = flowID
message["file"] = nil
if redisClient := redis.Get(); redisClient == nil || !redisClient.QueueProduct(documentParseQueueName(doc, priority), message) {
return fmt.Errorf("Can't access Redis. Please check the Redis' status.")
taskMessage := common.TaskMessage{
TaskID: task.ID,
TaskType: common.TaskTypeIngestionTask,
}
return nil
payload, err := json.Marshal(taskMessage)
if err != nil {
return err
}
return s.publishTask("tasks.RAGFLOW", payload)
task, err := s.ingestionTaskDAO.CheckAndCreate(task)
if err != nil {
return err
}
taskMessage := common.TaskMessage{
TaskID: task.ID,
TaskType: common.TaskTypeIngestionTask,
}
payload, err := json.Marshal(taskMessage)
if err != nil {
_, _ = s.ingestionTaskDAO.Delete(task.ID, &task.UserID)
return err
}
if err := s.publishTask("tasks.RAGFLOW", payload); err != nil {
_, _ = s.ingestionTaskDAO.Delete(task.ID, &task.UserID)
return err
}
return nil
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/document.go` around lines 1576 - 1588, The ingestion flow in
`CheckAndCreate`/`publishTask` leaves an `IngestionTask` stuck in `CREATED` if
`json.Marshal` or `s.publishTask("tasks.RAGFLOW", payload)` fails, which blocks
retries. Update the task-creation path in `Document` service to clean up or roll
back the newly created task on any failure after `CheckAndCreate` succeeds, so a
later retry can create a fresh task. Use the `task` returned from
`CheckAndCreate` and ensure failures after that point do not leave an orphaned
`CREATED` record.

@xugangqiang
xugangqiang marked this pull request as draft July 9, 2026 13:12
@xugangqiang
xugangqiang marked this pull request as ready for review July 9, 2026 13:12
@xugangqiang
xugangqiang marked this pull request as draft July 9, 2026 13:18
@xugangqiang
xugangqiang marked this pull request as ready for review July 9, 2026 13:18
@xugangqiang
xugangqiang marked this pull request as draft July 10, 2026 01:42
@xugangqiang
xugangqiang marked this pull request as ready for review July 10, 2026 01:42
@xugangqiang
xugangqiang force-pushed the feat/customize-pipeline branch from 3736514 to df3c310 Compare July 10, 2026 01:59
@xugangqiang
xugangqiang marked this pull request as draft July 10, 2026 02:11
@xugangqiang
xugangqiang marked this pull request as ready for review July 10, 2026 02:11
@JinHai-CN

Copy link
Copy Markdown
Member

LGTM

@JinHai-CN
JinHai-CN merged commit 7db3982 into infiniflow:main Jul 10, 2026
7 checks passed
@xugangqiang
xugangqiang deleted the feat/customize-pipeline branch August 7, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration 💞 feature Feature request, pull request that fullfill a new feature. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants