π§Ή Refactor error handling in debug_log to log OSErrors instead of silently passing#11
π§Ή Refactor error handling in debug_log to log OSErrors instead of silently passing#11google-labs-jules[bot] wants to merge 1 commit into
Conversation
Narrow exception block to catch `OSError` instead of general `Exception`, and add print statement to `sys.stderr` when failed to write log. This change is to avoid silently suppressing actual programming bugs and provides visibility into IOError/PermissionError logging failures without crashing the application.
|
π 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Closing in favor of #17, which consolidates all 16 open hook PRs into one coherent change (they overlapped and conflicted with each other, so they could not be merged independently). Closing without merging: narrowing debug_log from except Exception to OSError plus printing to stderr makes a best-effort logger less crash-safe and noisier inside a hook. #17 keeps the logger crash-safe; the genuine fix was for state saves (see #4), which #17 includes. |
Understood. Acknowledging that this work is now obsolete as it has been superseded by #17, and stopping work on this task. |
π― What: Modified
hooks/security_guard.pyandhooks/secret_scanner.py'sdebug_logfunctions. Replacedexcept Exception: passwithexcept OSError as e:and added a print statement.π‘ Why: Silently catching
Exceptionhides unrelated errors (NameError,TypeError) and maskingIOErrorfailures makes logging issues difficult to debug.β Verification: Ran pytest tests directly and manually checked that
python -m py_compileworks, plus completed code review ensuringsys.stderrwas safe. Made sure__pycache__artifacts are removed.β¨ Result: Improved maintainability, debuggability, and consistency across codebase hook scripts.
PR created automatically by Jules for task 12771404410622688068 started by @zknpr