mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
fix(workflows): fix hanging and excessive execution (#3253)
The crux of the issue here is that the internal step chains created when a loop is invoked were hijacking the execution order of subsequent steps defined by the user. Specifically, when we had a sequence like this: ```ts workflow .step(step1) .after(step1) .while(async () => true, step2) .then(step3) .step(step4) ``` - firstly, the internally generated `__loop_check` step in the `.while()` call was not getting injected as a subscriber of `step1`. This led to execution hang-ups after the `.after()` call. - secondly, the `.while()` call generates a `.after()` step internally, which hijacks any subsequently defined `.step()` calls. This led to `step4` getting called on every loop iteration I've added a test case to validate the fix for these behaviours. https://linear.app/kepler-crm/issue/MASTRA-2661/[bug]-in-afterawhile-bstepcthend-d-never-executes-is-lost-in-the Closes #3150
This commit is contained in:
parent
7599d770a5
commit
5b4e19fffc
3 changed files with 350 additions and 58 deletions
Loading…
Add table
Add a link
Reference in a new issue