RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(agent): save incomplete Compiler drafts and gate Run (#21365)
Sbaaoui Idrissd3cd3df397ce
diff --git a/internal/agent/component/dynamic_params.go b/internal/agent/component/dynamic_params.goindex 52d8a180d1..6cbfb13aac 100644--- a/internal/agent/component/dynamic_params.go+++ b/internal/agent/component/dynamic_params.go@@ -16,7 +16,8 @@ func ValidateDynamicEntries(dsl map[string]any) error {}// ValidateDraftDynamicEntries allows unfinished Message content, DataOperations-// entries, and Invoke mappings in saved drafts. All other checks remain unchanged.+// entries, Invoke mappings, and Compiler configuration in saved drafts.+// All other checks remain unchanged.func ValidateDraftDynamicEntries(dsl map[string]any) error {return validateDynamicEntries(dsl, true)}@@ -99,7 +100,7 @@ func validateDynamicParams(component string, params map[string]any, draft bool)return fmt.Errorf("[%s] %w", component, err)}case "compiler":- if !isNonBlankString(params["compilation_template_id"]) && !isNonBlankString(params["compilation_template_group_id"]) {+ if !draft && !isNonBlankString(params["compilation_template_id"]) && !isNonBlankString(params["compilation_template_group_id"]) {return fmt.Errorf("[%s] %w", component, ErrCompilationTemplateRequired)}}diff --git a/internal/agent/component/dynamic_params_test.go b/internal/agent/component/dynamic_params_test.goindex 396b940431..289be8f295 100644--- a/internal/agent/component/dynamic_params_test.go+++ b/internal/agent/component/dynamic_params_test.go@@ -101,7 +101,7 @@ func TestValidateDynamicEntries(t *testing.T) {case "invoke variable row not a map", "invoke variable nil row", "invoke variable with numeric key", "invoke variables not an array", "invoke variables object":invokeDraft = false}- if test.component["component_name"] == "Message" || test.component["component_name"] == "DataOperations" || invokeDraft {+ if test.component["component_name"] == "Message" || test.component["component_name"] == "DataOperations" || test.component["component_name"] == "Compiler" || invokeDraft {if draftErr != nil {t.Fatalf("draft rejected unfinished entries: %v", draftErr)}diff --git a/web/src/pages/agent/hooks/use-run-preflight.test.ts b/web/src/pages/agent/hooks/use-run-preflight.test.tsindex a0f5633412..38890d69df 100644--- a/web/src/pages/agent/hooks/use-run-preflight.test.ts+++ b/web/src/pages/agent/hooks/use-run-preflight.test.ts@@ -98,7 +98,7 @@ describe('Run preflight', () => {useSaveGraphBeforeOpeningDebugDrawer(show),);useGraphStore.setState({- nodes: [node('Message', { text: 'hello' }), node('Compiler', {})],+ nodes: [node('Message', { text: 'hello' }), node('Parser', {})],});await act(async () => {await result.current.handleRun();diff --git a/web/src/pages/agent/utils/__tests__/canvas-checklist.test.ts b/web/src/pages/agent/utils/__tests__/canvas-checklist.test.tsindex 808ed8518a..92da74f9ec 100644--- a/web/src/pages/agent/utils/__tests__/canvas-checklist.test.ts+++ b/web/src/pages/agent/utils/__tests__/canvas-checklist.test.ts@@ -1052,6 +1052,7 @@ describe('collectCanvasIssues: compiler template group', () => {nodeId: 'Compiler:c1',type: CanvasIssueType.MissingRequired,messageKey: 'knowledgeConfiguration.compilationTemplateRequired',+ blocksRun: true,}),);});diff --git a/web/src/pages/agent/utils/canvas-checklist.ts b/web/src/pages/agent/utils/canvas-checklist.tsindex 42a1e800ee..386b375864 100644--- a/web/src/pages/agent/utils/canvas-checklist.ts+++ b/web/src/pages/agent/utils/canvas-checklist.ts@@ -687,13 +687,16 @@ export function collectCanvasIssues({// Same always-on policy as the Agent model check: an empty operator// must flag on load, not only after edits.const groupId = form?.compilation_template_group_id;- if (!groupId) {+ if (!form?.compilation_template_id?.trim() && !groupId?.trim()) {issues.push({...target,type: CanvasIssueType.MissingRequired,messageKey: 'knowledgeConfiguration.compilationTemplateRequired',+ blocksRun: true,});} else if (+ !form?.compilation_template_id?.trim() &&+ groupId &&compilationTemplateGroupIds &&!compilationTemplateGroupIds.has(groupId)) {