tenacity exception classifier

    1

    Audit and fix dangerous Tenacity retry logic to prevent infinite loops and swallowed exceptions.

    $10

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    tenacity exception classifier

    Example session with this skill installed

    Review the retry logic in my service layer. I'm seeing 404 errors causing infinite retry loops and I'm losing the original stack traces.

    • Read your context and instructions
    • Compiled the tenacity exception classifier

    I have completed the audit of your retry logic. I identified 3 critical issues where permanent failures were being retried and root causes were being swallowed by Tenacity's default behavior.

    Tenacity Exception Audit Report

    Finding IDSeverityLocationIssue
    EXC-3-4a1bCriticalservices/api_client.py:42Retrying on all HTTPStatusError including 404/401
    EXC-5-9f2dHighservices/orders.py:112Missing reraise=True hiding root cause
    EXC-1-c3e8Criticalgateways/stripe.py:15Bare @retry decorator (infinite, no backoff)

    Detailed Findings & Fixes

    Finding EXC-3-4a1b: Dangerous HTTP Retries
    The current implementation retries on any httpx.HTTPStatusError. This includes 404 Not Found and 401 Unauthorized, which will never succeed on a retry and may trigger security lockouts.

    Recommended Fix:
    Use a transient-only predicate. I have generated a patch that implements a status-code filter.

    
    # Generated Patch: ./output/patches/EXC-3-4a1b.py
    import httpx
    from tenacity import retry, retry_if_exception, stop_after_attempt, wait_exponential_jitter
    
    _TRANSIENT_CODES = {408, 429, 500, 502, 503, 504}
    
    def is_transient_http_error(exc: BaseException) -> bool:
        if isinstance(exc, httpx.ConnectError):
            return True
        if isinstance(exc, httpx.HTTPStatusError):
            return exc.response.status_code in _TRANSIENT_CODES
        return False
    
    @retry(
        retry=retry_if_exception(is_transient_http_error),
        stop=stop_after_attempt(3),
        wait=wait_exponential_jitter(initial=1, max=10),
        reraise=True
    )
    def fetch_data():
        ...
    

    Next steps

    1. Review the full report in ./output/tenacity-exception-classifier-report.md.
    2. Apply the specific fixes from ./output/patches/.
    3. Verify that your logging captures the is_transient_http_error predicate logic.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    Improper retry logic leads to infinite loops, account lockouts from 401/403 errors, and swallowed root causes. Developers often use broad decorators that retry on programming bugs or permanent API failures, wasting resources and masking critical defects.

    What it does

    • Identifies dangerous bare @retry decorators and over-broad Exception catches.
    • Flags incorrect retry behavior on HTTP 4xx errors, authentication failures, and logic errors like KeyError or ValueError.
    • Detects hidden root causes where reraise=True is missing from Tenacity configurations.
    • Generates precise, named transient-error predicates and refactored retry logic tailored to your specific HTTP client and exception hierarchy.

    Frameworks & tools

    Python, Tenacity, Requests, HTTPX.

    Why this beats prompting it yourself

    General LLMs often suggest generic retry blocks that don't account for the difference between transient network blips and permanent logic errors. This skill performs a deep static analysis of your project's exception hierarchy to ensure custom exceptions are classified correctly before suggesting a fix.

    Use cases

    • Auditing a legacy codebase for fragile or unbounded retry loops.
    • Hardening API clients against rate limits and authentication failures.
    • Debugging RetryError stacks that hide the original exception.

    Known limitations

    Analysis is read-only and static. It does not execute code, handle non-UTF-8 files, or support Python 2 syntax.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.

    Static analysis only; no code execution. Skips non-UTF-8 files, Python 2, and large repos over 5,000 files. Requires manual application of generated patches.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 2 months ago

    Software
    Python

    Permissions

    No special permissions declared or detected

    Listed2 months ago
    Updated1 month ago

    What's inside

    Frequently Asked Questions

    The skill analyzes your Python source code to find broad `@retry` decorators that catch permanent failures (like 401 Unauthorized or ValueErrors) and suggests precise predicates to ensure your application only retries on truly transient network issues.

    This skill is designed for AI agents with file-system access (like GitHub Copilot Extensions, OpenDevin, or custom LangChain agents) that can pass Python code snippets or file contents to the skill for static analysis.

    Yes, the classifier specifically looks for missing `reraise=True` parameters in Tenacity configurations, helping you avoid the common frustration of `RetryError` masking the actual root cause of a failure.

    The skill supports modern Python projects using the Tenacity library, with specific logic optimized for popular HTTP clients like Requests and HTTPX.

    The classifier performs static analysis of your exception hierarchy and returns a structured report of vulnerabilities along with refactored, production-ready code blocks to replace your unsafe decorators.

    New in Code Quality & Review