[BUG] SequentialWorkflow drift detection can rerun indefinitely on persistent low scores
**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**
1. Create a `SequentialWorkflow` with `drift_detection=True`.
2. Mock the drift agent so it always returns a score below the threshold.
3. Mock `agent_rearrange.run()` to return any string.
4. Call `run()`.
At HEAD the loop is:
```python
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**
- Confirmed locally against `master` (`cc1667a1`).
- Relevant code: `swarms/structs/sequential_workflow.py:231-257`.
- In a local source-derived repro with an always-low judge score, the workflow reran hundreds of times in well under a second before I interrupted it.
- Related feature issue/PR: #1517 and #1522. I did not find an existing issue for the missing rerun cap itself.
关闭于 22 天前 0 条评论