Repository navigation
Conversation
Remove the Go-side resume feature: ingestion pipeline checkpoint/resume,
agent canvas eino interrupt/resume with Redis checkpointing (RunTracker,
CheckPointStore, StateSerializer, wait-for-user), and the resume/CV
builtin pipeline template plus its parser_id registration.
Deleted files:
- internal/ingestion/pipeline/template/ingestion_pipeline_resume.json
- internal/agent/dsl/testdata/resume.json
- internal/agent/canvas/{interrupt_resume,run_tracker,checkpoint_store,state_serializer}.go (+ tests)
- internal/handler/agent_wait_for_user_test.go
- internal/agent/workflowx/r3_interrupt_test.go
The ingestion pipeline now always runs a single non-resumable Invoke
(runPlain became run), and the agent canvas no longer pauses/resumes on
UserFillUp. loop/parallel workflowx helpers lost their resume snapshot
and checkpoint machinery. resume parser registration (ParserTypeResume,
parser_ids strings, parser_config) and its tests were dropped too.
Validated with: bash build.sh --test ./...
📝 WalkthroughWalkthroughThe pull request removes checkpoint, interrupt, resume, and distributed run-tracking support from canvas execution, workflow extensions, agent services, and ingestion pipelines. It also removes resume parser configuration and structured agent input handling. ChangesResume infrastructure removal
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
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 (3)
internal/agent/workflowx/parallel_options_test.go (1)
115-135: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winMake compile-option forwarding observable.
store.Getreads the test-local map directly, so it does not prove thatWithParallelCompileOptionsreachedsub.Compile. Replace the checkpoint option with a non-checkpoint compile option whose effect the test can assert.🤖 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/agent/workflowx/parallel_options_test.go` around lines 115 - 135, Update TestOptions_ParallelCompileOptionsForwarded to replace WithParallelCompileOptions(compose.WithCheckPointStore(store)) and the direct store.Get check with a non-checkpoint compile option whose runtime effect is observable in the test. Assert that effect after AddParallelNode compiles the sub-workflow, ensuring the option was forwarded to sub.Compile rather than merely using the test-local store.internal/service/agent.go (1)
313-316: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate the stale
runnerfield comment.The comment names the field
driver, but the field isrunner. It also states "V1 persistence is in-memory; a follow-up phase moves to Redis per plan §4.9". This PR removes the Redis checkpoint path, so the note now describes a plan that no longer exists.As per coding guidelines: "Remove commented-out Go code instead of leaving recovery notes, and keep package and doc comments aligned with the current runtime path rather than migration history."
📝 Proposed comment fix
- // driver is the per-process runner that drives canvas - // invocations and produces SSE events. V1 persistence is - // in-memory; a follow-up phase moves to Redis per plan §4.9. + // runner is the per-process runner that drives canvas + // invocations and produces SSE events. Run state is local to + // this process. runner *canvas.Runner🤖 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/agent.go` around lines 313 - 316, Update the documentation comment immediately above the runner field to identify runner correctly and describe only its current role in driving canvas invocations and producing SSE events. Remove the obsolete in-memory persistence and Redis migration-history statements.Source: Coding guidelines
internal/handler/agent.go (1)
1071-1079: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve
inputsin/api/v1/agents/chat/completions.The web client sends
inputsfor Begin operator values, butAgentChatCompletionsdrops this field and forwards onlyqueryor message content toRunAgent. Restore structured input propagation and add a contract test.🤖 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/agent.go` around lines 1071 - 1079, Update agentChatCompletionsRequest and the AgentChatCompletions flow to accept and preserve the client’s structured inputs for Begin operator values, forwarding them to RunAgent alongside the existing query or message content. Ensure inputs are retained for both supported request formats, and add a contract test verifying /api/v1/agents/chat/completions propagates them correctly.
🧹 Nitpick comments (8)
internal/ingestion/pipeline/pipeline.go (1)
210-227: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winInline the single-caller
runhelper intoRun.
runexisted to support the repeated resumable invocation loop. After the removal, it has one caller and takes four parameters thatRunalready holds. Inline it to keep one execution path in this file.Based on learnings and coding guidelines for
internal/{ingestion,parser,deepdoc}/**/*.go: "In actively refactored Go ingestion, parser, and DeepDOC code, collapse duplicate paths rather than preserving transitional wrappers."♻️ Proposed inlining
- return p.run(runCtx, current, compiled, runState) -} - -// run executes a single Invoke of the compiled workflow, records progress via -// the sink, and returns the merged output. -func (p *Pipeline) run(runCtx context.Context, current map[string]any, compiled *canvas.CompiledCanvas, runState *canvas.CanvasState) (map[string]any, error) { out, err := compiled.Workflow.Invoke(runCtx, current) if err != nil { if errors.Is(runCtx.Err(), context.Canceled) || errors.Is(runCtx.Err(), context.DeadlineExceeded) { return current, fmt.Errorf("pipeline: run cancelled: %w", runCtx.Err()) } return current, fmt.Errorf("pipeline: run canvas workflow: %w", err) } return finalizeResult(current, out, runState), 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/ingestion/pipeline/pipeline.go` around lines 210 - 227, Remove the single-caller Pipeline.run helper and inline its workflow invocation, cancellation handling, error wrapping, and finalizeResult call directly into Run’s invocation loop, using Run’s existing runCtx, current, compiled, and runState variables. Preserve the current return values and error behavior while leaving finalizeResult unchanged.Sources: Coding guidelines, Learnings
internal/service/user.go (1)
206-206: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDefault
ParserIDsis duplicated in two tenant-creation paths and the two copies disagree. This PR removedresume:Resumefrom both literals, but the copies still differ: one includestag:Tagand labelspaperas "Research Paper", the other omitstag:Tagand labelspaperas "Paper". Tenants therefore get different parser sets depending on the creation path.
internal/service/user.go#L206-L206: replace the inline literal with a shared exported default (for exampleentity.DefaultParserIDs) and keep this list as the single source of truth.internal/admin/service.go#L255-L255: use the same shared default instead of the local literal, or document why the admin path must omittag:Tag.🤖 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/user.go` at line 206, Define one exported default ParserIDs value, such as entity.DefaultParserIDs, as the single source of truth and update internal/service/user.go:206-206 to use it instead of the inline literal. Update internal/admin/service.go:255-255 to use the same shared default, preserving the consistent parser set including tag:Tag and the “Research Paper” label.internal/agent/workflowx/parallel.go (1)
185-204: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the dead
nodeKeyparameter threaded through the parallel helpers. Checkpoint-ID and address-segment generation was the only consumer ofnodeKey. After this removal, neither helper reads the value, and Go does not report unused function parameters. Both helpers are unexported, so the cleanup stays insideinternal/agent/workflowx.
internal/agent/workflowx/parallel.go#L185-L204: delete thenodeKey stringparameter fromrunParallelInvokeand drop it from therunParallelFanoutcall at Line 204.internal/agent/workflowx/parallel.go#L258-L265: delete thenodeKey stringparameter fromrunParallelFanout; the body never reads it.internal/agent/workflowx/parallel_test.go#L218-L218: remove the"par"argument from therunParallelFanoutcall.internal/agent/workflowx/parallel_test.go#L268-L268: remove the"par"argument from therunParallelInvokecall.internal/agent/workflowx/parallel_test.go#L367-L367: remove the"par"argument from therunParallelInvokecall.Also update the
AddParallelNodecall site atinternal/agent/workflowx/parallel.goLine 155, which passeskey.Based on coding guidelines: "Treat legacy code as a liability rather than a compatibility target; prefer deletion over shims, deprecated branches, wrapper APIs, and dual-track migrations."
🤖 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/agent/workflowx/parallel.go` around lines 185 - 204, Remove the unused nodeKey parameter from runParallelInvoke and runParallelFanout, and stop forwarding it between them; also update the AddParallelNode call site in internal/agent/workflowx/parallel.go (Line 155) to omit key. In internal/agent/workflowx/parallel_test.go (Line 218, Line 268, and Line 367), remove the "par" argument from the affected helper calls. Do not add compatibility wrappers or shims.Source: Coding guidelines
internal/agent/workflowx/loop.go (1)
336-372: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueClose the buffered iteration readers that
sendIterationsnever consumes.
streamReadersaccumulates oneschema.StreamReader[T]per iteration at Line 372. Two paths leave some of those readers unclosed:
- In
LoopStreamFinalOnlymode,sendIterationsemits and closes only the last reader. All earlier readers stay open.- In the
case err := <-pipeErrCh:branch withLoopStreamFinalOnly,sendIterationsis not called at all. Every collected reader stays open.The readers come from
schema.StreamReaderFromArray, so the practical cost is bounded. Closing them still keeps the code aligned with the eino stream contract and avoids a real leak if the reader source ever changes.♻️ Proposed cleanup for unconsumed readers
go func() { defer outWriter.Close() select { case <-allClosed: // Produce finished; emit the iteration streams // according to streamMode, then signal any error // from the goroutine. sendIterations(streamReaders, streamMode, outWriter) + closeUnsentIterations(streamReaders, streamMode) // Drain any pending error from produce. select { case err := <-pipeErrCh: if err != nil { outWriter.Send(zero, err) } default: } case err := <-pipeErrCh: // Produce emitted an error before closing; the // readers produced so far are still useful only // for LoopStreamEveryIteration. Re-emit them, // then surface the error. if streamMode == LoopStreamEveryIteration { sendIterations(streamReaders, streamMode, outWriter) + } else { + for _, r := range streamReaders { + r.Close() + } } outWriter.Send(zero, err) } }()Add the helper next to
sendIterations:// closeUnsentIterations releases the readers that sendIterations // skipped for the given mode. func closeUnsentIterations[T any](readers []*schema.StreamReader[T], mode LoopStreamMode) { if mode != LoopStreamFinalOnly || len(readers) <= 1 { return } for _, r := range readers[:len(readers)-1] { r.Close() } }Also applies to: 397-423
🤖 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/agent/workflowx/loop.go` around lines 336 - 372, Close buffered iteration readers that are not consumed in LoopStreamFinalOnly mode. Add a closeUnsentIterations helper near sendIterations, invoke it after sendIterations where earlier readers are skipped, and invoke it in the pipeErrCh path before returning when sendIterations is not called; preserve existing behavior for other modes and the final reader.internal/agent/workflowx/loop_integration_test.go (1)
65-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the unused
drainStreamUntilErrorhelper.
readAllIntsis the only equivalent helper with active call sites.🤖 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/agent/workflowx/loop_integration_test.go` around lines 65 - 79, Remove the unused drainStreamUntilError helper function, including its entire implementation; retain readAllInts and its existing call sites unchanged.Source: Coding guidelines
internal/service/agent_cancel_test.go (1)
64-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAlign the test name with the assertions, or restore the marker assertion.
The test is named
TestCancelSessionRunFinishedSessionDoesNotCreateCancelMarker, but it no longer checks any cancel marker. It only checks that no local active entry appears. The name now describes coverage that does not exist.
CancelSessionRundocuments that it must not publish a session-scoped marker for a non-active session. That invariant is worth keeping under test. Either assert it withcanvas.CancelRequested, or rename the test to match what it verifies.🤖 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/agent_cancel_test.go` around lines 64 - 90, Update TestCancelSessionRunFinishedSessionDoesNotCreateCancelMarker to assert that cancelling the persisted and missing sessions does not publish a session-scoped canvas.CancelRequested marker, preserving the existing local active-entry assertion; alternatively, rename the test to accurately describe only the local active-session behavior it currently verifies.internal/service/agent_run_e2e_test.go (1)
23-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the unused
collectEventTypeshelper. It has no callers. The other checked helpers remain in use.🤖 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/agent_run_e2e_test.go` around lines 23 - 24, Remove the unused collectEventTypes helper from the agent run E2E test file, leaving the other checked helpers and failure-path tests unchanged.Source: Coding guidelines
internal/agent/canvas/runner.go (1)
198-205: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReturn only
errorfromsafeInvoke.Runis the only caller, and it discards the*CanvasStateresult. Remove the unused state variable and return value fromsafeInvoke.🤖 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/agent/canvas/runner.go` around lines 198 - 205, Update safeInvoke and its sole caller Run to return and handle only an error; remove the discarded *CanvasState result and the corresponding unused state variable while preserving the existing cancellation and pushErr handling.
🤖 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/agent/canvas/runner.go`:
- Around line 28-36: Update the normal-completion documentation near Run to
state that Runner closes the channel after buildRunFunc completes, while the
HTTP handler emits the done frame when it observes channel closure; do not claim
that Runner sends the done terminator directly. Keep the cancellation and error
outcome descriptions unchanged.
In `@internal/agent/runtime/state.go`:
- Around line 133-140: Correct the documentation for MarshalJSON to state that
RLock is held through SafeJSONMarshal, allowing readers but blocking writers
such as SetVar; clarify that snap initially references existing maps and slices
before SafeJSONMarshal copies and cleans them, and that atomic.Bool serializes
as {} rather than 8 bytes.
In `@internal/ingestion/pipeline/pipeline.go`:
- Around line 213-214: Update the doc comment for the run helper to remove the
claim that it records progress via the sink. Describe only that it invokes the
compiled workflow once and returns the merged output, leaving progress reporting
to Run and the framework callback.
In `@internal/service/canvas_decode_test.go`:
- Around line 270-271: Correct the doc comment for
TestNewAgentService_ConstructsPins by inserting the missing space so it reads
naturally as a description of the test constructing pins.
---
Outside diff comments:
In `@internal/agent/workflowx/parallel_options_test.go`:
- Around line 115-135: Update TestOptions_ParallelCompileOptionsForwarded to
replace WithParallelCompileOptions(compose.WithCheckPointStore(store)) and the
direct store.Get check with a non-checkpoint compile option whose runtime effect
is observable in the test. Assert that effect after AddParallelNode compiles the
sub-workflow, ensuring the option was forwarded to sub.Compile rather than
merely using the test-local store.
In `@internal/handler/agent.go`:
- Around line 1071-1079: Update agentChatCompletionsRequest and the
AgentChatCompletions flow to accept and preserve the client’s structured inputs
for Begin operator values, forwarding them to RunAgent alongside the existing
query or message content. Ensure inputs are retained for both supported request
formats, and add a contract test verifying /api/v1/agents/chat/completions
propagates them correctly.
In `@internal/service/agent.go`:
- Around line 313-316: Update the documentation comment immediately above the
runner field to identify runner correctly and describe only its current role in
driving canvas invocations and producing SSE events. Remove the obsolete
in-memory persistence and Redis migration-history statements.
---
Nitpick comments:
In `@internal/agent/canvas/runner.go`:
- Around line 198-205: Update safeInvoke and its sole caller Run to return and
handle only an error; remove the discarded *CanvasState result and the
corresponding unused state variable while preserving the existing cancellation
and pushErr handling.
In `@internal/agent/workflowx/loop_integration_test.go`:
- Around line 65-79: Remove the unused drainStreamUntilError helper function,
including its entire implementation; retain readAllInts and its existing call
sites unchanged.
In `@internal/agent/workflowx/loop.go`:
- Around line 336-372: Close buffered iteration readers that are not consumed in
LoopStreamFinalOnly mode. Add a closeUnsentIterations helper near
sendIterations, invoke it after sendIterations where earlier readers are
skipped, and invoke it in the pipeErrCh path before returning when
sendIterations is not called; preserve existing behavior for other modes and the
final reader.
In `@internal/agent/workflowx/parallel.go`:
- Around line 185-204: Remove the unused nodeKey parameter from
runParallelInvoke and runParallelFanout, and stop forwarding it between them;
also update the AddParallelNode call site in
internal/agent/workflowx/parallel.go (Line 155) to omit key. In
internal/agent/workflowx/parallel_test.go (Line 218, Line 268, and Line 367),
remove the "par" argument from the affected helper calls. Do not add
compatibility wrappers or shims.
In `@internal/ingestion/pipeline/pipeline.go`:
- Around line 210-227: Remove the single-caller Pipeline.run helper and inline
its workflow invocation, cancellation handling, error wrapping, and
finalizeResult call directly into Run’s invocation loop, using Run’s existing
runCtx, current, compiled, and runState variables. Preserve the current return
values and error behavior while leaving finalizeResult unchanged.
In `@internal/service/agent_cancel_test.go`:
- Around line 64-90: Update
TestCancelSessionRunFinishedSessionDoesNotCreateCancelMarker to assert that
cancelling the persisted and missing sessions does not publish a session-scoped
canvas.CancelRequested marker, preserving the existing local active-entry
assertion; alternatively, rename the test to accurately describe only the local
active-session behavior it currently verifies.
In `@internal/service/agent_run_e2e_test.go`:
- Around line 23-24: Remove the unused collectEventTypes helper from the agent
run E2E test file, leaving the other checked helpers and failure-path tests
unchanged.
In `@internal/service/user.go`:
- Line 206: Define one exported default ParserIDs value, such as
entity.DefaultParserIDs, as the single source of truth and update
internal/service/user.go:206-206 to use it instead of the inline literal. Update
internal/admin/service.go:255-255 to use the same shared default, preserving the
consistent parser set including tag:Tag and the “Research Paper” label.
🪄 Autofix
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 Plus
Run ID: 087409ba-ec0d-4049-a3e6-991e97c832cc
📒 Files selected for processing (52)
cmd/ragflow_server.gointernal/admin/service.gointernal/agent/canvas/checkpoint_store.gointernal/agent/canvas/checkpoint_store_test.gointernal/agent/canvas/compile.gointernal/agent/canvas/compile_test.gointernal/agent/canvas/interrupt_resume.gointernal/agent/canvas/interrupt_resume_test.gointernal/agent/canvas/node_body.gointernal/agent/canvas/run_tracker.gointernal/agent/canvas/run_tracker_test.gointernal/agent/canvas/runner.gointernal/agent/canvas/runner_cancel_test.gointernal/agent/canvas/state_serializer.gointernal/agent/canvas/state_serializer_test.gointernal/agent/component/fixture_stubs.gointernal/agent/dsl/testdata/resume.jsoninternal/agent/runtime/helpers.gointernal/agent/runtime/state.gointernal/agent/workflowx/loop.gointernal/agent/workflowx/loop_example_test.gointernal/agent/workflowx/loop_integration_test.gointernal/agent/workflowx/loop_options_test.gointernal/agent/workflowx/loop_test.gointernal/agent/workflowx/parallel.gointernal/agent/workflowx/parallel_helpers_test.gointernal/agent/workflowx/parallel_integration_test.gointernal/agent/workflowx/parallel_options_test.gointernal/agent/workflowx/parallel_test.gointernal/agent/workflowx/r3_interrupt_test.gointernal/common/parser_config.gointernal/entity/dataset.gointernal/handler/agent.gointernal/handler/agent_test.gointernal/handler/agent_wait_for_user_test.gointernal/ingestion/component/extractor.gointernal/ingestion/component/extractor_test.gointernal/ingestion/component/slice3_test.gointernal/ingestion/pipeline/builtin_registry_test.gointernal/ingestion/pipeline/pipeline.gointernal/ingestion/pipeline/pipeline_test.gointernal/ingestion/pipeline/template/ingestion_pipeline_resume.jsoninternal/ingestion/pipeline/template_integration_test.gointernal/ingestion/service/ingestion_service.gointernal/ingestion/task/pipeline_executor.gointernal/ingestion/task/pipeline_executor_defaults_test.gointernal/ingestion/task/task_context.gointernal/service/agent.gointernal/service/agent_cancel_test.gointernal/service/agent_run_e2e_test.gointernal/service/canvas_decode_test.gointernal/service/user.go
💤 Files with no reviewable changes (22)
- internal/ingestion/pipeline/template/ingestion_pipeline_resume.json
- internal/ingestion/pipeline/builtin_registry_test.go
- internal/entity/dataset.go
- internal/agent/canvas/checkpoint_store_test.go
- internal/common/parser_config.go
- internal/agent/canvas/checkpoint_store.go
- internal/agent/canvas/run_tracker_test.go
- internal/agent/canvas/state_serializer.go
- internal/handler/agent_test.go
- internal/ingestion/component/extractor_test.go
- internal/ingestion/task/pipeline_executor.go
- internal/agent/canvas/interrupt_resume_test.go
- internal/agent/workflowx/parallel_helpers_test.go
- internal/agent/dsl/testdata/resume.json
- internal/agent/canvas/state_serializer_test.go
- internal/agent/canvas/interrupt_resume.go
- internal/agent/workflowx/r3_interrupt_test.go
- internal/ingestion/pipeline/template_integration_test.go
- internal/handler/agent_wait_for_user_test.go
- internal/agent/canvas/compile_test.go
- internal/ingestion/pipeline/pipeline_test.go
- internal/agent/canvas/run_tracker.go
| // Run outcomes on a single Run() call: | ||
| // | ||
| // 1. Normal completion (runErr == nil): the buildRunFunc already | ||
| // emitted all workflow events (workflow_started, node_started, | ||
| // node_finished, message, message_end, workflow_finished) during | ||
| // execution. The Runner just sends the `done` terminator. | ||
| // 2. Eino interrupt (runErr is an *InterruptSignal or wrapped | ||
| // variant): emit `waiting_for_user` with the first interrupt | ||
| // id. Persist the id so the next call can resume via | ||
| // compose.ResumeWithData (signalled through root: | ||
| // __resume_interrupt_id__ + __resume_data__). | ||
| // 3. Cancel / timeout (errors.Is(err, context.Canceled) etc.): | ||
| // 2. Cancel / timeout (errors.Is(err, context.Canceled) etc.): | ||
| // silently close. The HTTP handler has already detached. | ||
| // 4. Other errors: emit `error` event with the err.Error() string. | ||
| // 3. Other errors: emit `error` event with the err.Error() string. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the documented done terminator behavior.
Line 33 states that the Runner sends the done terminator on normal completion. The Run body does not push a done event. It only closes the channel, and the HTTP handler writes the done frame when it observes none. Align the doc with the current runtime path.
As per coding guidelines: "keep package and doc comments aligned with the current runtime path rather than migration history".
📝 Proposed doc fix
// 1. Normal completion (runErr == nil): the buildRunFunc already
// emitted all workflow events (workflow_started, node_started,
// node_finished, message, message_end, workflow_finished) during
-// execution. The Runner just sends the `done` terminator.
+// execution. The Runner then closes the event channel; the HTTP
+// handler writes the `done` terminator.📝 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.
| // Run outcomes on a single Run() call: | |
| // | |
| // 1. Normal completion (runErr == nil): the buildRunFunc already | |
| // emitted all workflow events (workflow_started, node_started, | |
| // node_finished, message, message_end, workflow_finished) during | |
| // execution. The Runner just sends the `done` terminator. | |
| // 2. Eino interrupt (runErr is an *InterruptSignal or wrapped | |
| // variant): emit `waiting_for_user` with the first interrupt | |
| // id. Persist the id so the next call can resume via | |
| // compose.ResumeWithData (signalled through root: | |
| // __resume_interrupt_id__ + __resume_data__). | |
| // 3. Cancel / timeout (errors.Is(err, context.Canceled) etc.): | |
| // 2. Cancel / timeout (errors.Is(err, context.Canceled) etc.): | |
| // silently close. The HTTP handler has already detached. | |
| // 4. Other errors: emit `error` event with the err.Error() string. | |
| // 3. Other errors: emit `error` event with the err.Error() string. | |
| // Run outcomes on a single Run() call: | |
| // | |
| // 1. Normal completion (runErr == nil): the buildRunFunc already | |
| // emitted all workflow events (workflow_started, node_started, | |
| // node_finished, message, message_end, workflow_finished) during | |
| // execution. The Runner then closes the event channel; the HTTP | |
| // handler writes the `done` terminator. | |
| // 2. Cancel / timeout (errors.Is(err, context.Canceled) etc.): | |
| // silently close. The HTTP handler has already detached. | |
| // 3. Other errors: emit `error` event with the err.Error() string. |
🤖 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/agent/canvas/runner.go` around lines 28 - 36, Update the
normal-completion documentation near Run to state that Runner closes the channel
after buildRunFunc completes, while the HTTP handler emits the done frame when
it observes channel closure; do not claim that Runner sends the done terminator
directly. Keep the cancellation and error outcome descriptions unchanged.
Source: Coding guidelines
| // MarshalJSON serialises the CanvasState into the stable wire shape | ||
| // (canvasStateJSON). The struct contains a sync.RWMutex (unexported) | ||
| // and an atomic.Bool (indirected; serialises as 8 bytes without | ||
| // explicit handling), so the explicit hook defines the JSON form. | ||
| // | ||
| // Concurrency: the lock is held briefly while we snapshot the maps; | ||
| // readers may briefly block during marshal, which is fine for the | ||
| // checkpoint/serializer hot path. The lock is read-only so concurrent | ||
| // SetVar calls also proceed. | ||
| // readers may briefly block during marshal. The lock is read-only so | ||
| // concurrent SetVar calls also proceed. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
file="internal/agent/runtime/state.go"
printf '%s\n' '--- target file outline ---'
ast-grep outline "$file" --match 'MarshalJSON' --view expanded || true
printf '%s\n' '--- target implementation ---'
nl -ba "$file" | sed -n '1,220p'
printf '%s\n' '--- related symbols and callers ---'
rg -n -C 3 'SafeJSONMarshal|MarshalJSON|UnmarshalJSON|SetVar|type CanvasState' internal/agent/runtimeRepository: infiniflow/ragflow
Length of output: 13846
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- CanvasState and JSON methods ---'
sed -n '50,190p' internal/agent/runtime/state.go
printf '%s\n' '--- SafeJSONMarshal implementation ---'
sed -n '1,180p' internal/agent/runtime/json_safe.go
printf '%s\n' '--- relevant type declarations and field assignments ---'
sed -n '1,55p' internal/agent/runtime/state.goRepository: infiniflow/ragflow
Length of output: 12254
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- standalone atomic.Bool JSON probe ---'
if command -v go >/dev/null 2>&1; then
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
cat >"$tmpdir/main.go" <<'GO'
package main
import (
"encoding/json"
"fmt"
"sync/atomic"
)
func main() {
var b atomic.Bool
raw, err := json.Marshal(b)
if err != nil {
panic(err)
}
fmt.Printf("atomic.Bool=%s\n", raw)
type wrapped struct {
Flag atomic.Bool `json:"flag"`
}
raw, err = json.Marshal(wrapped{Flag: b})
if err != nil {
panic(err)
}
fmt.Printf("wrapped=%s\n", raw)
}
GO
(cd "$tmpdir" && go run main.go)
else
printf '%s\n' 'go compiler unavailable; using source-level checks only'
fi
printf '%s\n' '--- lock and serializer call order ---'
python3 - <<'PY'
from pathlib import Path
p = Path("internal/agent/runtime/state.go").read_text()
start = p.index("func (s *CanvasState) MarshalJSON()")
end = p.index("\n}\n\n// UnmarshalJSON", start) + 2
body = p[start:end]
print("RLock before SafeJSONMarshal:", body.index("s.mu.RLock()") < body.index("SafeJSONMarshal(snap)"))
print("RUnlock deferred before SafeJSONMarshal:", body.index("defer s.mu.RUnlock()") < body.index("SafeJSONMarshal(snap)"))
print("SafeJSONMarshal is final return:", "return SafeJSONMarshal(snap)" in body)
PY
printf '%s\n' '--- cleanForJSON copy behavior ---'
python3 - <<'PY'
from pathlib import Path
p = Path("internal/agent/runtime/json_safe.go").read_text()
checks = {
"map[string]any allocates output map": "out := make(map[string]any, len(m))" in p,
"map[string]map[string]any allocates output map": "out := make(map[string]map[string]any, len(val))" in p,
"[]map[string]any allocates output slice": "out := make([]any, len(val))" in p,
"generic slices allocate output slice": "cleaned := make([]any, length)" in p,
"SafeJSONMarshal cleans before json.Marshal": "cleaned := cleanForJSON(v)" in p and "return json.Marshal(cleaned)" in p,
}
for name, result in checks.items():
print(f"{name}: {result}")
PYRepository: infiniflow/ragflow
Length of output: 659
Correct the MarshalJSON documentation.
MarshalJSON holds RLock through SafeJSONMarshal, so other readers may proceed but writers such as SetVar block. snap initially references the existing maps and slices, but SafeJSONMarshal copies and cleans them before encoding. atomic.Bool encodes as {}, not as 8 bytes.
🤖 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/agent/runtime/state.go` around lines 133 - 140, Correct the
documentation for MarshalJSON to state that RLock is held through
SafeJSONMarshal, allowing readers but blocking writers such as SetVar; clarify
that snap initially references existing maps and slices before SafeJSONMarshal
copies and cleans them, and that atomic.Bool serializes as {} rather than 8
bytes.
Sources: Coding guidelines, MCP tools
| // run executes a single Invoke of the compiled workflow, records progress via | ||
| // the sink, and returns the merged output. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the helper doc comment.
run does not record progress. Run reports the component total through p.sink, and the framework callback records per-component events. If you keep the helper, describe only the Invoke and merge behavior.
🤖 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/pipeline/pipeline.go` around lines 213 - 214, Update the
doc comment for the run helper to remove the claim that it records progress via
the sink. Describe only that it invokes the compiled workflow once and returns
the merged output, leaving progress reporting to Run and the framework callback.
| // TestNewAgentService_ConstructsPins that the constructor produces a | ||
| // usable service (no panic on field init). |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the doc comment typo.
The comment reads TestNewAgentService_ConstructsPins that the constructor.... A space is missing between the test name and pins.
📝 Proposed fix
-// TestNewAgentService_ConstructsPins that the constructor produces a
-// usable service (no panic on field init).
+// TestNewAgentService_Constructs pins that the constructor produces a
+// usable service (no panic on field init).🤖 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/canvas_decode_test.go` around lines 270 - 271, Correct the
doc comment for TestNewAgentService_ConstructsPins by inserting the missing
space so it reads naturally as a description of the test constructing pins.
Summary
Removes the Go-side resume feature entirely. We are cancelling this feature, so all Go code, DSL fixtures, and the resume/CV builtin pipeline template are deleted. The Python side (
api/,rag/app/resume.py, agent templates) is intentionally untouched.What was removed
DSL JSON
internal/ingestion/pipeline/template/ingestion_pipeline_resume.json(resume builtin template,parser_id="resume")internal/agent/dsl/testdata/resume.jsonWhole files
internal/agent/canvas/interrupt_resume.go(+ test) — eino interrupt/resume wrappers,UserFillUpNodeBodyinternal/agent/canvas/run_tracker.go(+ test) — RedisRunTrackerinternal/agent/canvas/checkpoint_store.go(+ test) — RedisCheckPointStoreinternal/agent/canvas/state_serializer.go(+ test) —CanvasStateSerializerinternal/handler/agent_wait_for_user_test.gointernal/agent/workflowx/r3_interrupt_test.goIn-file removals
WithRequireResume,ErrResumeUnavailable,WithCheckPointStore/WithRunTracker,runResumable, DSL fingerprinting (guardDSLChange),cleanupCheckpoint;Pipeline.Runnow always runs a single non-resumable invoke (runPlain→run)saveInterruptID/getInterruptID/Peekandwaiting_for_userhandling, UserFillUp interrupt routing (UserFillUp now goes through the normal component path)service/agent.go/handler/agent.go/cmd/ragflow_server.go:runTracker/checkpointStore/stateSerializerfields and all__resume_*/compose.ResumeWithDataresume paths; wait-for-user form-input extractionworkflowxloop/parallel: resume snapshot/checkpoint machinery (ErrLoopResumeStateInvalid,ErrParallelResumeStateInvalid, bridge stores,parallelResumeBackdoorKey, replay)ParserTypeResume,"resume"in parser config,resume:Resumein parser_ids strings, related testsNot touched (per scope)
internal/channels/qqbot.go— QQ gateway WebSocket session resume (protocol-level)internal/harness/**— standalone graph framework with its own resume conceptssession_id(normal chat continuation)Validation
bash build.sh --test ./...passes (full Go unit suite)gofmtclean on all modified files