fix: workflow incorrectly marked as completed while nodes are still executing#39
Open
Conversation
Comment on lines
82
to
+86
| outgoing_edges = self._graph.get_outgoing_edges(node_id) | ||
| for edge in outgoing_edges: | ||
| self._state_manager.mark_edge_skipped(edge.id) | ||
| # Recursively propagate skip | ||
| self.propagate_skip_from_edge(edge.id) | ||
| self._state_manager.mark_edge_skipped(edge.id) |
There was a problem hiding this comment.
Bug: The reordering of propagate_skip_from_edge before mark_edge_skipped causes propagation to halt prematurely because the edge's state is still UNKNOWN when checked downstream.
Severity: HIGH
Suggested Fix
Revert the order of the calls within the for loop in _propagate_skip_to_node. Call self._state_manager.mark_edge_skipped(edge.id) before calling self.propagate_skip_from_edge(edge.id) to ensure the edge's state is updated before propagation continues.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: api/core/workflow/graph_engine/graph_traversal/skip_propagator.py#L82-L86
Potential issue: In `_propagate_skip_to_node`, the call to `propagate_skip_from_edge`
now occurs before `_state_manager.mark_edge_skipped`. When `propagate_skip_from_edge` is
called for an edge, it analyzes the states of incoming edges for the downstream node.
Because the current edge has not yet been marked as skipped, its state is `UNKNOWN`.
This causes the `analyze_edge_states` logic to return early, halting the skip
propagation prematurely. As a result, downstream nodes that should be skipped will
remain in an `UNKNOWN` state, potentially causing the workflow to be marked as complete
incorrectly.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmark PR from qodo-benchmark#441