fix: workflow incorrectly marked as completed while nodes are still executing#26
Conversation
Code Review by Qodo
1. print() in propagate_skip_from_edge()
|
| if edge_states["has_taken"]: | ||
| # Enqueue node | ||
| # Start execution and enqueue node | ||
| print(f"Starting execution for node: {downstream_node_id}") |
There was a problem hiding this comment.
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
| # 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) |
There was a problem hiding this comment.
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
Benchmark PR from agentic-review-benchmarks#13