Skip to content

fix: replace bare except clauses with except Exception in ga.py#490

Open
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/ga-py-bare-except-e722
Open

fix: replace bare except clauses with except Exception in ga.py#490
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/ga-py-bare-except-e722

Conversation

@Kailigithub
Copy link
Copy Markdown
Contributor

Summary

Replace all 8 bare except: clauses in ga.py with except Exception:.

Why

Bare except: catches everything including SystemExit and KeyboardInterrupt, which can:

  • Prevent the agent from being stopped with Ctrl+C
  • Mask critical failures like out-of-memory errors
  • Make debugging harder by swallowing all exceptions silently

Changes

All 8 bare except:except Exception: in ga.py:

Line Context
48-49 code_run output printing fallback
159 file access stats JSON loading
289 timeout argument parsing
348 web_execute_js file save error
351 web_execute_js result printing
433 plan completion check
544 verbose prompt printing

Testing

  • python3 -m py_compile ga.py — passes
  • No behavior change — Exception covers the same error types these handlers were meant to catch

Replace all 8 bare `except:` clauses in ga.py with `except Exception:`.
Bare except catches SystemExit and KeyboardInterrupt which can mask
critical failures and make debugging harder.

Affected locations:
- code_run output printing (lines 48-49)
- file access stats loading (line 159)
- timeout argument parsing (line 289)
- web_execute_js file save error (line 348)
- web_execute_js result printing (line 351)
- plan completion check (line 433)
- verbose prompt printing (line 544)
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