Skip to content

fix: Infinite loops should use MAX_LOOP_COUNT as the upper limit - #8221

Merged
shaohuzhang1 merged 1 commit into
v3from
pr@v3@fix_loop
Nov 30, 2026
Merged

shaohuzhang1 merged 1 commit into
v3from
pr@v3@fix_loop

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: Infinite loops should use MAX_LOOP_COUNT as the upper limit

iterator = _generate_while_loop(MAX_LOOP_COUNT, start_index=start_index)
else:
iterator = _generate_loop_number(number, start_index=start_index)
self._workflow_params = workflow_params

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change removes the use of number entirely in the LOOP branch, always using MAX_LOOP_COUNT.

Potential issues:

  • Behavior change: If number was meant to control the loop count, it’s now ignored. The previous number or MAX_LOOP_COUNT would use number when truthy, falling back to MAX_LOOP_COUNT otherwise.
  • Comment mismatch: The comment says “infinite loop” (无限循环) but uses a finite MAX_LOOP_COUNT, so it’s not truly infinite.
  • Unused variable: In this branch, number becomes unused, which may indicate a bug or leftover logic.

Optimization / suggestion:

If the intent is truly an infinite loop with a safety cap, keep MAX_LOOP_COUNT but update the comment to reflect that. If number should still matter, revert to something like:

iterator = _generate_while_loop(number or MAX_LOOP_COUNT, start_index=start_index)

or clarify the purpose explicitly:

# Use MAX_LOOP_COUNT as a hard upper bound for safety
iterator = _generate_while_loop(MAX_LOOP_COUNT, start_index=start_index)

@shaohuzhang1
shaohuzhang1 merged commit cb2c2e1 into v3 Nov 30, 2026
3 of 4 checks passed
@shaohuzhang1
shaohuzhang1 deleted the pr@v3@fix_loop branch November 30, 2026 08:07
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