Skip to content

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

Fix: Add the pipeline's detached operators to the checklist. (#20127)

balibabu74b7aa406312
diff --git a/web/src/pages/agent/utils/__tests__/canvas-checklist.test.ts b/web/src/pages/agent/utils/__tests__/canvas-checklist.test.ts
index cf117cd335..85daef0cc5 100644
--- a/web/src/pages/agent/utils/__tests__/canvas-checklist.test.ts
+++ b/web/src/pages/agent/utils/__tests__/canvas-checklist.test.ts
@@ -82,6 +82,61 @@ describe('collectCanvasIssues: orphan steps', () => {
expect.objectContaining({ nodeId: 'File', type: CanvasIssueType.Orphan }),
);
});
+
+ it('flags pipeline node groups wired to each other but detached from File', () => {
+ const issues = collect({
+ nodes: [
+ makeNode('File', 'File'),
+ makeNode('Parser:p1', 'Parser'),
+ makeNode('Chunker:c1', 'TokenChunker'),
+ makeNode('Compiler:cp1', 'Compiler'),
+ makeNode('Indexer:i1', 'Indexer'),
+ makeNode('Extractor:e1', 'Extractor'),
+ makeNode('Extractor:e2', 'Extractor'),
+ ],
+ edges: [
+ makeEdge('File', 'Parser:p1'),
+ makeEdge('Parser:p1', 'Chunker:c1'),
+ makeEdge('Compiler:cp1', 'Indexer:i1'),
+ makeEdge('Extractor:e1', 'Extractor:e2'),
+ ],
+ });
+
+ const orphans = issues
+ .filter((x) => x.type === CanvasIssueType.Orphan)
+ .map((x) => x.nodeId);
+ expect(orphans).toEqual(
+ expect.arrayContaining([
+ 'Compiler:cp1',
+ 'Indexer:i1',
+ 'Extractor:e1',
+ 'Extractor:e2',
+ ]),
+ );
+ expect(orphans).not.toContain('File');
+ expect(orphans).not.toContain('Parser:p1');
+ expect(orphans).not.toContain('Chunker:c1');
+ });
+
+ it('flags no orphan on a fully connected pipeline', () => {
+ const issues = collect({
+ nodes: [
+ makeNode('File', 'File'),
+ makeNode('Parser:p1', 'Parser'),
+ makeNode('Chunker:c1', 'TokenChunker'),
+ makeNode('Indexer:i1', 'Indexer'),
+ ],
+ edges: [
+ makeEdge('File', 'Parser:p1'),
+ makeEdge('Parser:p1', 'Chunker:c1'),
+ makeEdge('Chunker:c1', 'Indexer:i1'),
+ ],
+ });
+
+ expect(
+ issues.filter((x) => x.type === CanvasIssueType.Orphan),
+ ).toHaveLength(0);
+ });
});
describe('collectCanvasIssues: dangling variable references', () => {
diff --git a/web/src/pages/agent/utils/canvas-checklist.ts b/web/src/pages/agent/utils/canvas-checklist.ts
index 0cc27366dc..6e6246f954 100644
--- a/web/src/pages/agent/utils/canvas-checklist.ts
+++ b/web/src/pages/agent/utils/canvas-checklist.ts
@@ -364,8 +364,12 @@ export function collectCanvasIssues({
}: CanvasChecklistInputs): CanvasIssue[] {
const nodeMap = new Map(nodes.map((x) => [x.id, x]));
// References always use `begin@key` even when the Begin node's id is a
- // legacy one (`begin:0`), so look the node up by label.
- const beginNode = nodes.find((x) => x.data?.label === Operator.Begin);
+ // legacy one (`begin:0`), so look the node up by label. The pipeline
+ // (dataflow) canvas names its entry node `File` instead of `Begin` — same
+ // structural anchor, different label.
+ const beginNode = nodes.find(
+ (x) => x.data?.label === Operator.Begin || x.data?.label === Operator.File,
+ );
const beginInputKeys = new Set(
Object.keys(beginNode?.data?.form?.inputs ?? {}),
);
@@ -381,7 +385,9 @@ export function collectCanvasIssues({
// only linked to their container by `parentId` — outer edges terminate at the
// container — so containment counts as connectivity too. The graph is walked
// undirected: any component detached from Begin, single node or a group, is
- // orphan regardless of edge direction.
+ // orphan regardless of edge direction. The anchor itself is always part of
+ // its own component, so it keeps the edges-only rule: an entry node with no
+ // edges at all (an empty pipeline) is still flagged.
const neighbors = new Map<string, string[]>();
const link = (a?: string, b?: string) => {
if (!a || !b || a === b) {
@@ -436,13 +442,11 @@ export function collectCanvasIssues({
operatorLabel: label ?? '',
};
- if (
- label &&
- !OrphanExemptOperators.includes(label) &&
- (beginComponentIds
+ const orphan =
+ beginComponentIds && node.id !== beginNode?.id
? !beginComponentIds.has(node.id)
- : !connectedNodeIds.has(node.id))
- ) {
+ : !connectedNodeIds.has(node.id);
+ if (label && !OrphanExemptOperators.includes(label) && orphan) {
issues.push({
...target,
type: CanvasIssueType.Orphan,