Skip to content

Fix unreasonable code: retry logic, DOM checks, variable declarations#10

Open
wa008 wants to merge 1 commit intomainfrom
fix-unreasonable-code-11083860701229918613
Open

Fix unreasonable code: retry logic, DOM checks, variable declarations#10
wa008 wants to merge 1 commit intomainfrom
fix-unreasonable-code-11083860701229918613

Conversation

@wa008
Copy link
Copy Markdown
Owner

@wa008 wa008 commented Mar 13, 2026

This PR scans the codebase for unreasonable code and applies intelligent fixes to improve stability and reliability.
Key changes:

  1. main_run.py (Broken Retry Logic): Fixed a fake retry loop. Previously, the try-except block returned a 500 error immediately on the first exception, completely defeating the for i in range(3) loop. The patch correctly catches the exception, allows the loop to continue retrying, and only returns the error if all 3 attempts fail.
  2. content.js (DOM Check): Changed document.getElementById("my_overlay") === undefined to === null. This is an essential bug fix because getElementById returns null (not undefined) if an element is not found.
  3. content.js & popup.js (Variable Declarations): Added let to multiple undeclared variables (e.g., res_json, key, translatedText, extensionOn, language, etc.). This prevents the accidental creation of global variables.

PR created automatically by Jules for task 11083860701229918613 started by @wa008

- Fix retry logic in `main_run.py` to correctly retry the `original_request` 3 times instead of returning an error on the first exception.
- Fix DOM element existence check in `content.js` from `=== undefined` to `=== null`, as `document.getElementById` returns `null` if the element does not exist.
- Declare multiple variables with `let` in `content.js` and `popup.js` to prevent polluting the global scope or causing bugs.

Co-authored-by: wa008 <29834520+wa008@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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