Skip to content

Commit 6c4c52d

Browse files
authored
Fix a bug that sometimes TraceGraph does not follow ordering.
1 parent 3636d7c commit 6c4c52d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

opto/trace/propagators/graph_propagator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def init_feedback(self, node, feedback: Any):
103103

104104
def _propagate(self, child: MessageNode):
105105
graph = [(p.level, p) for p in child.parents] # add the parents
106+
graph = sorted(graph, key=lambda x: x[0]) # sort by level, heapq in TraceGraph requires this
106107
feedback = self.aggregate(child.feedback) + TraceGraph(graph=graph, user_feedback=None)
107108
assert isinstance(feedback, TraceGraph)
108109

0 commit comments

Comments
 (0)