Skip to content

fix(executor): loop sentinel-end wrongly queued#3148

Merged
Sg312 merged 2 commits intostagingfrom
fix/executor-loop-condition-execute
Feb 5, 2026
Merged

fix(executor): loop sentinel-end wrongly queued#3148
Sg312 merged 2 commits intostagingfrom
fix/executor-loop-condition-execute

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Feb 5, 2026

Summary

  • Fix loop sentinel-end being spuriously queued on deactivated paths when upstream condition branches away, causing forEach collection resolution to fail on blocks that never executed.
  • Subflow level errors should be highlighted correctly in preview

Type of Change

  • Bug fix

Testing

Added a test

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 5, 2026 11:08pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

This change adjusts EdgeManager.processOutgoingEdges to avoid queueing cascade "terminal control nodes" (loop/parallel sentinel end nodes) when the current node activates at least one outgoing edge. In branchy graphs (e.g., a condition choosing else), this prevents loop/parallel sentinels located entirely on the deactivated branch from being spuriously marked ready and executed.

A regression test is added to ensure sentinel_end and downstream nodes are not queued when an upstream condition deactivates the entire loop branch, while preserving the normal behavior where after-loop becomes ready on a real loop exit.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is narrowly scoped (a single additional guard) and directly covered by added regression tests; it aligns with the intended semantics that deactivated branches should not queue control sentinels unless the current node is a true dead-end.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/executor/execution/edge-manager.ts Adds a guard so cascade terminal control nodes (loop/parallel sentinels) are only queued in dead-end cases where no outgoing edges are activated, preventing spuriously queued sentinel-end on deactivated branches.
apps/sim/executor/execution/edge-manager.test.ts Adds regression assertions/tests ensuring sentinel_end and downstream nodes are not queued when an upstream condition deactivates the entire loop branch, while preserving normal loop exit behavior.

Sequence Diagram

sequenceDiagram
  participant Exec as Executor
  participant EM as EdgeManager
  participant DAG as DAG

  Exec->>EM: processOutgoingEdges(node, output)
  EM->>EM: shouldActivateEdge(...) per outgoing edge
  alt Edge not activated
    EM->>EM: deactivateEdgeAndDescendants(...)
    EM->>EM: cascadeTargets.add(terminalControlNodes)
  else Edge activated
    EM->>EM: activatedTargets.add(target)
    EM->>DAG: targetNode.incomingEdges.delete(node.id)
    EM->>EM: if isTargetReady(target) -> readyNodes.push(target)
  end

  alt Dead-end (activatedTargets.length == 0)
    EM->>EM: if isTargetReady(cascadeTarget) -> readyNodes.push(cascadeTarget)
  else Some edges activated
    EM-->>EM: do NOT queue cascade terminal control nodes on deactivated branches
  end

  EM-->>Exec: return readyNodes
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@Sg312 Sg312 merged commit 9dcf92b into staging Feb 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants