Describe the bug
SequentialWorkflow._run_drift_detection() reruns the pipeline in a while True loop until the drift score crosses the threshold. If the drift score stays low, the workflow keeps rerunning without any retry ceiling.
That can burn tokens indefinitely and prevents the workflow from terminating in a bounded way when the judge never improves.
To Reproduce
- Create a
SequentialWorkflow with drift_detection=True.
- Mock the drift agent so it always returns a score below the threshold.
- Mock
agent_rearrange.run() to return any string.
- Call
run().
At HEAD the loop is:
while True:
...
if score >= self.drift_threshold:
break
result = self.agent_rearrange.run(**run_kwargs)
with no retry budget or timeout.
Expected behavior
Drift-triggered reruns should stop after a bounded number of attempts (or an explicit time budget) and return the latest result or raise a controlled failure.
Additional context
Describe the bug
SequentialWorkflow._run_drift_detection()reruns the pipeline in awhile Trueloop until the drift score crosses the threshold. If the drift score stays low, the workflow keeps rerunning without any retry ceiling.That can burn tokens indefinitely and prevents the workflow from terminating in a bounded way when the judge never improves.
To Reproduce
SequentialWorkflowwithdrift_detection=True.agent_rearrange.run()to return any string.run().At HEAD the loop is:
with no retry budget or timeout.
Expected behavior
Drift-triggered reruns should stop after a bounded number of attempts (or an explicit time budget) and return the latest result or raise a controlled failure.
Additional context
master(cc1667a1).swarms/structs/sequential_workflow.py:231-257.