Skip to content

fix(YouTube): fix bare except, browser leak, recursion limits#235

Open
tatenda-source wants to merge 2 commits intoFujiwaraChoki:mainfrom
tatenda-source:fix/youtube-except-recursion-browser
Open

fix(YouTube): fix bare except, browser leak, recursion limits#235
tatenda-source wants to merge 2 commits intoFujiwaraChoki:mainfrom
tatenda-source:fix/youtube-except-recursion-browser

Conversation

@tatenda-source
Copy link
Copy Markdown

Summary

  • Replace bare except: with except Exception as e: and log the error
  • Ensure browser cleanup via finally block instead of only on success
  • Add max retry limits (5) for script, metadata, and prompt generation
  • Use integer division for prompt count to avoid float in prompts
  • Add zero-division guard when no images generated
  • Check empty video list before indexing
  • Validate video_path exists before upload
  • Check pipeline step return values in generate_video()

Closes #225

Test plan

  • Generate and upload a video end-to-end
  • Verify browser closes on both success and failure
  • Verify retry limits prevent infinite recursion

🤖 Generated with Claude Code

…lidation

Closes FujiwaraChoki#225

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86a2aaedf6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/classes/YouTube.py
Comment on lines +193 to +198
if not hasattr(self, '_script_retries'):
self._script_retries = 0
self._script_retries += 1
if self._script_retries > 5:
warning("Max retries reached for script generation. Using current script.")
self._script_retries = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset retry counters after successful generation

_script_retries is incremented for oversized scripts but only reset when the max is exceeded, so a successful retry leaves a nonzero counter behind. Since the same YouTube instance is reused for multiple generations in the interactive flow, later videos can hit the max retry path too early and skip intended retries even when this run is the first failure. The same state-leak pattern appears in metadata/prompt retry counters as well, so counters should be cleared on successful generation.

Useful? React with 👍 / 👎.

Clears _script_retries, _metadata_retries, and _prompts_retries
after successful generation so reused YouTube instances don't
hit the max retry path prematurely on later videos.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

fix(YouTube): bare except, browser leak, unbounded recursion, and other bugs

1 participant