Skip to content

fix(llm): suppress spurious "trying again" warning on the final retry attempt - #1267

Merged
harry0703 merged 1 commit into
harry0703:mainfrom
Mihir7027:fix/llm-retry-spurious-warning
Aug 26, 2026
Merged

fix(llm): suppress spurious "trying again" warning on the final retry attempt#1267
harry0703 merged 1 commit into
harry0703:mainfrom
Mihir7027:fix/llm-retry-spurious-warning

Conversation

@Mihir7027

Copy link
Copy Markdown
Contributor

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.

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.
@harry0703
harry0703 merged commit 96800e2 into harry0703:main Aug 26, 2026
3 checks passed
@harry0703

Copy link
Copy Markdown
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!

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.

2 participants