Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(ingestion): show data pipeline on failed parse log entries (#19231)

euvre9d8df641dd79
diff --git a/internal/ingestion/task/pipeline_executor.go b/internal/ingestion/task/pipeline_executor.go
index a34eb590b2..5dc6c75f66 100644
--- a/internal/ingestion/task/pipeline_executor.go
+++ b/internal/ingestion/task/pipeline_executor.go
@@ -756,13 +756,16 @@ func recordPipelineLog(
// selection runs on a builtin registry pipeline: its canvasID is the
// parser_id, not a canvas row, so the log is titled with the document's
// parser_id, reuses the document thumbnail as avatar, and leaves
- // pipeline_id empty.
+ // pipeline_id empty. The canvas lookup must not depend on the DSL: terminal
+ // failure/cancel logs are recorded without a DSL, and their pipeline title
+ // and avatar must still resolve from the canvas row (mirrors the Python
+ // operation-log creation path).
pipelineTitle := doc.ParserID
pipelineAvatar := doc.Thumbnail
var pipelineID *string
if input.PipelineID != "" {
pipelineID = &input.PipelineID
- if db != nil && strings.TrimSpace(input.DSL) != "" {
+ if db != nil {
if canvas, err := dao.NewUserCanvasDAO().GetByID(ctx, db, input.PipelineID); err == nil && canvas != nil {
if canvas.Title != nil {
pipelineTitle = *canvas.Title
diff --git a/internal/ingestion/task/pipeline_executor_test.go b/internal/ingestion/task/pipeline_executor_test.go
index c052d56901..19ea8a1d5a 100644
--- a/internal/ingestion/task/pipeline_executor_test.go
+++ b/internal/ingestion/task/pipeline_executor_test.go
@@ -487,6 +487,69 @@ func TestRecordPipelineLog_CustomCanvasMissingFallsBackToParserID(t *testing.T)
}
}
+func TestRecordPipelineLog_TerminalWithoutDSLResolvesCanvasTitle(t *testing.T) {
+ cleanup := setupPipelineExecutorTestDB(t)
+ defer cleanup()
+
+ if err := dao.DB.Create(&entity.UserCanvas{
+ ID: "canvas-1",
+ UserID: "tenant-1",
+ Title: strPtr("My Pipeline"),
+ Avatar: strPtr("a.png"),
+ }).Error; err != nil {
+ t.Fatalf("seed canvas: %v", err)
+ }
+ if err := dao.DB.AutoMigrate(&entity.Knowledgebase{}); err != nil {
+ t.Fatalf("migrate knowledgebase: %v", err)
+ }
+ if err := dao.DB.Create(&entity.Knowledgebase{
+ ID: "kb-1",
+ TenantID: "tenant-1",
+ }).Error; err != nil {
+ t.Fatalf("seed knowledgebase: %v", err)
+ }
+ docName := "sample.avi"
+ run := "1"
+ if err := dao.DB.Create(&entity.Document{
+ ID: "doc-1",
+ KbID: "kb-1",
+ PipelineID: strPtr("canvas-1"),
+ ParserID: "naive",
+ ParserConfig: entity.JSONMap{},
+ Name: &docName,
+ Run: &run,
+ }).Error; err != nil {
+ t.Fatalf("seed document: %v", err)
+ }
+
+ // Mirrors Ingestor.recordTerminalPipelineLog: only the terminal status is
+ // known; pipeline_id and DSL are absent and must come from the document.
+ if err := RecordPipelineLog(t.Context(), dao.DB, PipelineLogInput{
+ KbID: "kb-1",
+ DocumentID: "doc-1",
+ Status: "3",
+ }); err != nil {
+ t.Fatalf("RecordPipelineLog: %v", err)
+ }
+
+ var log entity.PipelineOperationLog
+ if err := dao.DB.First(&log, "document_id = ?", "doc-1").Error; err != nil {
+ t.Fatalf("load pipeline log: %v", err)
+ }
+ if log.OperationStatus != "3" {
+ t.Fatalf("OperationStatus = %q, want terminal status", log.OperationStatus)
+ }
+ if log.PipelineID == nil || *log.PipelineID != "canvas-1" {
+ t.Fatalf("PipelineID = %v, want \"canvas-1\"", log.PipelineID)
+ }
+ if log.PipelineTitle == nil || *log.PipelineTitle != "My Pipeline" {
+ t.Fatalf("PipelineTitle = %v, want \"My Pipeline\"", log.PipelineTitle)
+ }
+ if log.Avatar == nil || *log.Avatar != "a.png" {
+ t.Fatalf("Avatar = %v, want \"a.png\"", log.Avatar)
+ }
+}
+
func TestRecordPipelineLog_SourceFrom(t *testing.T) {
cases := []struct {
name string