Skip to content

fix(workflow): preserve loop body failures#80

Open
WeiXianyang wants to merge 1 commit into
IPADS-SAI:e2e-fehfrom
WeiXianyang:fix/workflow-loop-failure
Open

fix(workflow): preserve loop body failures#80
WeiXianyang wants to merge 1 commit into
IPADS-SAI:e2e-fehfrom
WeiXianyang:fix/workflow-loop-failure

Conversation

@WeiXianyang

Copy link
Copy Markdown

Workflow loops currently evaluate break_if after executing the loop body even when the body has already reported a stopping failure.

That behavior can mask the original failure. For example, runner/mobiagent/workflow/examples/01_basic_gui_task_weixin_v2.json checks:

${steps.2.output.structured_output.contains_today_chat}

When the vlm_qa tool step fails, its output is empty. The loop then tries to evaluate break_if anyway and raises a secondary 'structured_output' KeyError instead of preserving the original tool failure.

Why this should be changed

The loop body failure is the actionable error. Evaluating break_if after a failed body depends on outputs that may not exist, and it can replace the real failure with a misleading variable-resolution error.

The condition is still evaluated after successful loop body iterations, so workflows such as the Weixin v2 chat collection flow can continue to use local loop aliases like steps.2 to read the current iteration's vlm_qa structured output.

This patch intentionally keeps the change minimal:

it only skips break_if evaluation when the loop body has already stopped it does not change loop alias resolution
it adds regression coverage for both the failure path and the successful current-iteration break_if path

Impact

Preserves the original loop body failure in workflow summaries and logs. Avoids misleading 'structured_output' KeyError failures after a tool step has already failed. Keeps successful loop break_if behavior unchanged for current-iteration tool outputs.

Workflow loops currently evaluate break_if after executing the loop body even when the body has already reported a stopping failure.

That behavior can mask the original failure. For example, runner/mobiagent/workflow/examples/01_basic_gui_task_weixin_v2.json checks:

${steps.2.output.structured_output.contains_today_chat}

When the vlm_qa tool step fails, its output is empty. The loop then tries to evaluate break_if anyway and raises a secondary 'structured_output' KeyError instead of preserving the original tool failure.

Why this should be changed

The loop body failure is the actionable error. Evaluating break_if after a failed body depends on outputs that may not exist, and it can replace the real failure with a misleading variable-resolution error.

The condition is still evaluated after successful loop body iterations, so workflows such as the Weixin v2 chat collection flow can continue to use local loop aliases like steps.2 to read the current iteration's vlm_qa structured output.

This patch intentionally keeps the change minimal:

it only skips break_if evaluation when the loop body has already stopped
it does not change loop alias resolution
it adds regression coverage for both the failure path and the successful current-iteration break_if path

Impact

Preserves the original loop body failure in workflow summaries and logs.
Avoids misleading 'structured_output' KeyError failures after a tool step has already failed.
Keeps successful loop break_if behavior unchanged for current-iteration tool outputs.

Signed-off-by: 23301078 <23301078@bjtu.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant