Repository navigation
fix: Infinite loops should use MAX_LOOP_COUNT as the upper limit - #8221
Merged
Merged
Conversation
shaohuzhang1
commented
Nov 30, 2026
| 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 |
Contributor
Author
There was a problem hiding this comment.
The change removes the use of number entirely in the LOOP branch, always using MAX_LOOP_COUNT.
Potential issues:
- Behavior change: If
numberwas meant to control the loop count, it’s now ignored. The previousnumber or MAX_LOOP_COUNTwould usenumberwhen truthy, falling back toMAX_LOOP_COUNTotherwise. - Comment mismatch: The comment says “infinite loop” (
无限循环) but uses a finiteMAX_LOOP_COUNT, so it’s not truly infinite. - Unused variable: In this branch,
numberbecomes 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: Infinite loops should use MAX_LOOP_COUNT as the upper limit