fix(llm): suppress spurious "trying again" warning on the final retry attempt - #1267
Merged
harry0703 merged 1 commit intoAug 26, 2026
Merged
Conversation
generate_script and generate_terms both guarded the "trying again…" log message with `if i < _max_retries:`. Because the loop body is `for i in range(_max_retries)`, i tops out at _max_retries-1, so the condition was always True and the warning fired even on the last iteration when no further retry would actually happen. Changed the guard to `if i < _max_retries - 1:`, matching the identical pattern already used in generate_social_metadata (line 958). Added unit tests that verify the warning fires exactly _max_retries-1 times when every attempt fails.
Owner
|
Thank you for this focused fix. We verified the retry boundaries for both script and search-term generation, including single-attempt, exhausted-retry, and eventual-success cases. The warning count now matches the actual number of retries, and the PR has been merged. Appreciate your contribution! |
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.
generate_script and generate_terms guarded the "trying again…" log with if i < _max_retries:. Since the loop is for i in range(_max_retries), i maxes out at _max_retries - 1, making the condition always True — the misleading warning fired even on the last attempt when no retry would follow.
Changed the guard to if i < _max_retries - 1:, matching the identical pattern already present in generate_social_metadata (line 958). Added unit tests verifying the warning fires exactly _max_retries - 1 times when every attempt fails.