fix(ai-slop): recognize logger.exception as capturing the error in silent-recovery - #355
Open
mtschoen wants to merge 3 commits into
Open
fix(ai-slop): recognize logger.exception as capturing the error in silent-recovery#355mtschoen wants to merge 3 commits into
mtschoen wants to merge 3 commits into
Conversation
…lent-recovery Python's logging.Logger.exception() always attaches the currently-handled exception's traceback (it is exactly .error(..., exc_info=True)), so an except-block that logs via logger.exception(...) is not silently dropping the failure cause even when the log call doesn't reference the exception binding by name. The silent-recovery detector previously required a literal identifier match, producing false positives on this common pattern. Now any .exception(...) call or exc_info=True keyword argument in the except body counts as capturing the error. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
aislop skipped this PRThis workspace does not have an active paid scanaislop plan. Choose a plan to resume hosted scans and PR gates: This comment appears once per PR. Further pushes will be skipped silently until the workspace has paid access. |
mtschoen
marked this pull request as ready for review
August 16, 2026 00:00
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4091651ff
ℹ️ 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".
The Python silent-recovery exemption matched `.exception(` unconditionally, so an except body calling `logger.exception(..., exc_info=False)` was treated as capturing the failure. Python forwards that value straight to `Logger.error`, which then omits the traceback, leaving the failure cause unobserved - exactly what the rule exists to catch. The exemption is now cancelled when the same line spells the literal `exc_info=False` (optional whitespace around the `=`). Only that literal is recognized: an `exc_info` bound to a variable or an expression stays exempt, since deciding its value would mean evaluating arbitrary Python, and under-reporting beats misfiring on valid code. A multi-line call that puts `exc_info=False` on a continuation line likewise stays exempt. Regression tests cover the flagged spellings (with and without whitespace around the `=`) and pin the deliberate non-detection; the existing `logger.exception(e)` and `exc_info=True` exemptions are unchanged. docs/rules.md now states the bound. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
aislop scan: 100/100 (Healthy) +Clean run — no errors, no warnings, no auto-fixable findings. |
…section The table row had grown to several times the length of its siblings; keep a one-clause pointer in the row and hold the exemption bounds in a "Rule notes" subsection after the table, matching how the Linting section already breaks detail out of its tables. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mtschoen
added a commit
to mtschoen/aislop
that referenced
this pull request
Aug 16, 2026
…tion exemption) into schoen/main # Conflicts: # docs/rules.md # src/engines/ai-slop/silent-recovery.ts # tests/silent-recovery.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a false positive in the ai-slop/silent-recovery Python detector: except-blocks that log via
logger.exception(...)orlogger.error(..., exc_info=True)were being flagged as silently dropping the caught exception, even though both forms attach the full traceback. The detector now recognizes either pattern as capturing the error and skips the flag.One review-driven bound: an explicit
exc_info=Falseon the same line cancels the exemption, since Python forwards that value toLogger.errorand the traceback is omitted. Any otherexc_infovalue (a variable, an expression) stays exempt rather than guessed at, and docs/rules.md records the bound.Test plan:
=, and the pinned exc_info-bound-to-a-variable non-detection)🤖 Generated with Claude Code