Skip to content

fix: workflow incorrectly marked as completed while nodes are still executing#26

Open
tomerqodo wants to merge 4 commits intoqodo_action_req_base_fix_workflow_incorrectly_marked_as_completed_while_nodes_are_still_executing_pr13from
qodo_action_req_head_fix_workflow_incorrectly_marked_as_completed_while_nodes_are_still_executing_pr13
Open

fix: workflow incorrectly marked as completed while nodes are still executing#26
tomerqodo wants to merge 4 commits intoqodo_action_req_base_fix_workflow_incorrectly_marked_as_completed_while_nodes_are_still_executing_pr13from
qodo_action_req_head_fix_workflow_incorrectly_marked_as_completed_while_nodes_are_still_executing_pr13

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#13

@qodo-code-review
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. print() in propagate_skip_from_edge() 📘 Rule violation ✧ Quality
Description
• The backend workflow traversal code emits output via print(), which bypasses the project’s
  logging system and makes production diagnostics/auditing inconsistent.
• This violates the requirement to use a module-level logger = logging.getLogger(__name__) and log
  through that logger instead of print() in non-test code.
• Using print() also makes it harder to control log levels, routing, and formatting across
  environments.
Code

api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[62]

+            print(f"Starting execution for node: {downstream_node_id}")
Evidence
PR Compliance ID 9 requires backend code to avoid print() and use a module-level logger. The new
code in skip_propagator.py adds a print() call inside the production execution path.

AGENTS.md
api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[59-64]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`api/core/workflow/graph_engine/graph_traversal/skip_propagator.py` uses `print()` in production code. Compliance requires using Python `logging` with a module-level `logger = logging.getLogger(__name__)` and no `print()` statements.

## Issue Context
The message is emitted when an incoming edge is taken and execution is started/enqueued. This should be a structured, level-controlled log entry.

## Fix Focus Areas
- api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[59-64]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Skip recursion blocked 🐞 Bug ✓ Correctness
Description
_propagate_skip_to_node() now calls propagate_skip_from_edge() before marking the outgoing
  edge as SKIPPED, so the downstream node’s incoming edge can still be UNKNOWN when analyzed.
• Because propagate_skip_from_edge() hard-stops on any UNKNOWN incoming edge, skip propagation can
  terminate prematurely and never reach deeper downstream nodes.
• Result: nodes that should be skipped can remain UNKNOWN (and may later execute or keep the
  workflow in an inconsistent state).
Code

api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[R81-86]

        # Mark all outgoing edges as skipped and propagate
        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)
Evidence
SkipPropagator stops propagation when any incoming edge is UNKNOWN. GraphStateManager’s
analyze_edge_states derives has_unknown from the real edge.state. Therefore, if an outgoing edge
is not marked SKIPPED before recursing, the next node can observe that incoming edge as UNKNOWN and
propagation halts, preventing the intended “all downstream-only-dependent nodes are skipped”
behavior.

api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[55-70]
api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[81-87]
api/core/workflow/graph_engine/graph_state_manager.py[119-146]
api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[95-97]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`_propagate_skip_to_node()` recurses into `propagate_skip_from_edge()` before marking the outgoing edge as SKIPPED. Since `propagate_skip_from_edge()` stops when any incoming edge is UNKNOWN, this can block skip propagation and leave downstream nodes unskipped.

### Issue Context
Skip propagation relies on `GraphStateManager.analyze_edge_states()` reading real `edge.state`. If the edge hasn’t been marked SKIPPED yet, downstream nodes can observe UNKNOWN and propagation halts.

### Fix Focus Areas
- api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[81-87]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



ⓘ The new review experience is currently in Beta. Learn more

Qodo Logo

if edge_states["has_taken"]:
# Enqueue node
# Start execution and enqueue node
print(f"Starting execution for node: {downstream_node_id}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. print() in propagate_skip_from_edge() 📘 Rule violation ✧ Quality

• The backend workflow traversal code emits output via print(), which bypasses the project’s
  logging system and makes production diagnostics/auditing inconsistent.
• This violates the requirement to use a module-level logger = logging.getLogger(__name__) and log
  through that logger instead of print() in non-test code.
• Using print() also makes it harder to control log levels, routing, and formatting across
  environments.
Agent prompt
## Issue description
`api/core/workflow/graph_engine/graph_traversal/skip_propagator.py` uses `print()` in production code. Compliance requires using Python `logging` with a module-level `logger = logging.getLogger(__name__)` and no `print()` statements.

## Issue Context
The message is emitted when an incoming edge is taken and execution is started/enqueued. This should be a structured, level-controlled log entry.

## Fix Focus Areas
- api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[59-64]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 81 to +86
# Mark all outgoing edges as skipped and propagate
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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Skip recursion blocked 🐞 Bug ✓ Correctness

_propagate_skip_to_node() now calls propagate_skip_from_edge() before marking the outgoing
  edge as SKIPPED, so the downstream node’s incoming edge can still be UNKNOWN when analyzed.
• Because propagate_skip_from_edge() hard-stops on any UNKNOWN incoming edge, skip propagation can
  terminate prematurely and never reach deeper downstream nodes.
• Result: nodes that should be skipped can remain UNKNOWN (and may later execute or keep the
  workflow in an inconsistent state).
Agent prompt
### Issue description
`_propagate_skip_to_node()` recurses into `propagate_skip_from_edge()` before marking the outgoing edge as SKIPPED. Since `propagate_skip_from_edge()` stops when any incoming edge is UNKNOWN, this can block skip propagation and leave downstream nodes unskipped.

### Issue Context
Skip propagation relies on `GraphStateManager.analyze_edge_states()` reading real `edge.state`. If the edge hasn’t been marked SKIPPED yet, downstream nodes can observe UNKNOWN and propagation halts.

### Fix Focus Areas
- api/core/workflow/graph_engine/graph_traversal/skip_propagator.py[81-87]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

1 participant