Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

Reject undefined workflow durations before calculating throughput

Rudy Celekli70b07c744269
diff --git a/testing/testing-workflow-optimizer.md b/testing/testing-workflow-optimizer.md
index 5610b162..286b903a 100644
--- a/testing/testing-workflow-optimizer.md
+++ b/testing/testing-workflow-optimizer.md
@@ -97,7 +97,16 @@ class WorkflowOptimizer:
def analyze_current_workflow(self, process_steps: List[ProcessStep]) -> WorkflowMetrics:
"""Comprehensive current state analysis"""
+ if not process_steps:
+ raise ValueError("A workflow needs at least one process step")
+ for step in process_steps:
+ duration = step.duration_minutes
+ if (isinstance(duration, bool) or not isinstance(duration, (int, float))
+ or not np.isfinite(duration) or duration < 0):
+ raise ValueError("Step durations must be finite nonnegative minutes")
total_duration = sum(step.duration_minutes for step in process_steps)
+ if not np.isfinite(total_duration) or total_duration <= 0:
+ raise ValueError("Total workflow duration must be finite and positive")
total_cost = sum(
(step.duration_minutes / 60) * step.cost_per_hour
for step in process_steps