Skip to content

[AUDIT-006] Reduce bare except Exception patterns; add structured error handling #2168

Open

Description

@groupthinking

[AUDIT-006] 800+ Bare Exception Handlers in src/ (🟠 HIGH)

Title: Reduce bare except Exception patterns; add structured error handling

Description:
Repository-wide search found ~800 except Exception / except: matches in src/, concentrated in:

  • src/youtube_extension/backend/services/*
  • src/youtube_extension/backend/api/*
  • src/agents/*

Impact: Failure opacity, difficult debugging, hidden errors

Files to Review:

  • src/youtube_extension/backend/services/ (all files)
  • src/youtube_extension/backend/api/ (all files)
  • src/agents/ (all files)

Required Actions:

  1. Audit critical paths (agents, routes, services) for bare exceptions
  2. Implement structured logging with failure reasons
  3. Add fail-closed patterns where appropriate (don't silent-fail on auth/security)
  4. Define exception handling standards doc

Acceptance Criteria:

  • All critical paths (auth, deployment, agents) use specific exceptions
  • Bare except: eliminated from critical paths
  • Failure reasons logged with context
  • Exception handling standards documented

Labels: 🟠 high, code-quality, logging, backend

Related: .github/AUDIT_FINDINGS_SESSION.md Section 6



Audit master doc: .github/AUDIT_FINDINGS_SESSION.md
Source session: https://github.com/groupthinking/EventRelay/tasks/36f6c3e5-60dc-4dfe-a151-ef2ab9114afa
Remediation phase: Phase 2: High (Weeks 2-4)

Cross-links: Previous: #2167 | Next: #2169 | Audit index: #2163

Activity

  1. linear-code commented on Sep 20, 2026

    @linear-code
    Contributor
  2. github-actions commented on Sep 20, 2026

    @github-actions
    Contributor

    👋 Thanks for opening this issue! It has been automatically labeled for triage.

  3. groupthinking commented on Sep 20, 2026

    @groupthinking
    OwnerAuthor

    Tracker: #2175

  4. groupthinking commented on Sep 21, 2026

    @groupthinking
    OwnerAuthor

    Verification review — reopened

    Commit bb06a041 added an exception-handling standards document, but the document itself says remediation is incremental and names backend/api/v1/router.py, services/agents/, and MCP orchestrator entrypoints as future priorities.

    That does not satisfy this issue's acceptance criteria that critical auth, deployment, and agent paths use specific exceptions, that bare handlers are removed from those paths, and that structured failure context is verified.

    Remaining evidence required:

    • machine-readable inventory of broad/bare handlers in the named critical paths;
    • targeted replacement or explicit boundary justification for each retained broad handler;
    • tests proving auth/deployment/agent failures remain fail-closed and preserve reason codes;
    • structured-log assertions for the repaired paths; and
    • a completion receipt tied to the exact verified head.

    Documentation is retained as a useful first step. The issue is reopened because implementation and verification remain incomplete.

  5. kk-agent commented on Sep 28, 2026

    @kk-agent
    Collaborator

    Max-aggressive cleanup 2026-09-28: EventRelay/UVAI product work is PARKED. Closing this stale/open item. Reopen if Hayden unparks the cut.

  6. groupthinking commented on Oct 8, 2026

    @groupthinking
    OwnerAuthor

    Reopened because parked was not remediated. Current-boundary repairs are in PR #2378: git add/commit failures no longer become successful deployment handoffs, identity lookup has typed failures and no fabricated owner, and absent deployment URL is a failure. Five injected failure tests passed without subprocess/network execution. Full agent/service critical-path audit remains open; documentation now names actual current paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions