Skip to content

refactor(canvas): reject failed parallel state clones - #20443

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
6ba3i:fix/agent-parallel-clone-failure-c2
Sep 30, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
6ba3i:fix/agent-parallel-clone-failure-c2

Conversation

@6ba3i

@6ba3i 6ba3i commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Parallel items could silently lose saved state when cloning failed. This change stops the item and reports the error before execution.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 39f3462c-15d1-4fec-875b-5ff4b480fc32

📥 Commits

Reviewing files that changed from the base of the PR and between 866575c and 2b9bcaa.

📒 Files selected for processing (4)
  • internal/agent/canvas/parallel_subgraph.go
  • internal/agent/canvas/parallel_subgraph_test.go
  • internal/agent/workflowx/parallel.go
  • internal/agent/workflowx/parallel_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Parallel context builders now return errors. The workflow reports builder errors and skips the affected sub-workflow invocation. The canvas builder returns state-clone errors instead of creating a fallback state.

Changes

Parallel context error propagation

Layer / File(s) Summary
Builder error contract and per-item handling
internal/agent/workflowx/parallel.go, internal/agent/workflowx/parallel_test.go
The builder option now accepts a context and error. Per-item execution returns builder errors as item results and skips sub-workflow invocation. The test covers this behavior on the resume path.
Canvas state-clone error handling
internal/agent/canvas/parallel_subgraph.go, internal/agent/canvas/parallel_subgraph_test.go
The canvas builder returns clone errors and no longer creates a fallback state. The test checks that a clone failure reaches workflow invocation as an error.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: wangq8, jinhai-cn

Merge Risk: ⚪ Minimal · up to 2b9bc

Failed state clones now return errors rather than executing with fallback state. The supplied evidence indicates the affected item is not invoked; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 2b9bc

The change prevents an item from executing with incomplete copied state and does not add demonstrated access or privileges. Remaining uncertainty concerns safe recovery after a resumed run fails, particularly when sibling work has already progressed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated failure scope is the enclosing parallel invocation: a failing item cannot execute its sub-workflow, but its ordinary error prevents aggregate output delivery. The examined change does not demonstrate expanded tenant, service, credential, or data-store authority.

Trust Boundaries and Controls

  • observed — The callback receives the existing context, item, and index and attaches cloned runtime state on success. On failure, workflowx checks the error before the sensitive execution step. The added resume test verifies that a builder error prevents any sub-workflow invocation in its single-pending-item scenario.

Resilience and Maintainability Implications

  • inferred — Recovery after an ordinary builder error remains unresolved. Parallel execution emits no replacement snapshot, while the runner consumes its in-memory interrupt identifier before invocation and saves identifiers on interrupt returns. An independently supplied persisted identifier is supported, but its retention and the outer checkpoint owner's behavior after failure were not established. Actual state loss or unsafe replay is therefore not asserted.

Hardening Proposals

  • proposed — Define whether context-construction failures during resume are terminal or retryable. If retryable, establish ownership of the prior snapshot and sibling progress across the ordinary-error return so retries cannot unintentionally restart completed work.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: failed parallel state clones are rejected instead of silently falling back.
Description check ✅ Passed The description explains the problem and the intended behavior change. It omits the required "### Summary" heading, but the required summary content is present.
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.
  • Fix all pre-merge checks with AI

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

A rabbit checks the context flow,
And sees clone errors clearly show.
No fallback state is made in haste,
Failed items stop before the workflow’s gate.
The pending task waits, ears aglow.

Comment @coderabbitai help to get the list of available commands.

@6ba3i
6ba3i requested a review from wangq8 September 30, 2026 06:16
@6ba3i 6ba3i added the ci Continue Integration label Sep 30, 2026
@wangq8
wangq8 requested a review from yuzhichang September 30, 2026 08:02
@yuzhichang
yuzhichang merged commit d62b4ed into infiniflow:main Sep 30, 2026
6 checks passed
@6ba3i
6ba3i deleted the fix/agent-parallel-clone-failure-c2 branch October 14, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants