mirror of
https://github.com/msitarzewski/agency-agents.git
synced 2026-10-21 18:54:53 +00:00
Preserve first matching workflow step for duplicate original names
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
1 file changed
+5
-3
@@ -182,12 +182,14 @@ class WorkflowOptimizer:
|
||||
opportunities: List[Dict]) -> List[ProcessStep]:
|
||||
"""Create optimized future state workflow"""
|
||||
optimized_steps = current_steps.copy()
|
||||
# Opportunities refer to the original names; display names change below.
|
||||
step_indexes = {step.name: i for i, step in enumerate(current_steps)}
|
||||
|
||||
for opportunity in opportunities:
|
||||
step_name = opportunity["step"]
|
||||
step_index = step_indexes[step_name]
|
||||
# Resolve against original names; earlier improvements rename the copy.
|
||||
step_index = next(
|
||||
i for i, step in enumerate(current_steps)
|
||||
if step.name == step_name
|
||||
)
|
||||
|
||||
current_step = optimized_steps[step_index]
|
||||
|
||||
|
||||
Reference in new issue
Block a user