Skip to content

fix: narrow exception in agent integration lookup from Exception to specific types - #3915

Open
Quratulain-bilal wants to merge 2 commits into
github:mainfrom
Quratulain-bilal:fix/agents-narrow-exception-v2
Open

fix: narrow exception in agent integration lookup from Exception to specific types#3915
Quratulain-bilal wants to merge 2 commits into
github:mainfrom
Quratulain-bilal:fix/agents-narrow-exception-v2

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

Bare except Exception silently swallows all errors including MemoryError, RecursionError, etc.

Fix

Narrow to (ImportError, KeyError, ValueError) which are the realistic failure modes.

Testing

  • Verified normal agent integration lookup works
  • Verified fallback separator is used when integration is not found

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Narrows exception handling during integration lookup to avoid suppressing unexpected failures.

Changes:

  • Catches only ImportError, KeyError, and ValueError.
  • Preserves fallback separator behavior for expected failures.
Show a summary per file
File Description
src/specify_cli/agents.py Narrows separator lookup exception handling.

Review details

Tip

Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/specify_cli/agents.py
…pecific types

Bare 'except Exception' silently swallows all errors including
MemoryError, RecursionError, etc. Narrow to (ImportError, KeyError,
ValueError) which are the realistic failure modes.
…pecific types

Narrow except Exception to (ImportError, KeyError, ValueError) which
are the realistic failure modes from invoke_separator_for_mode().

Add regression tests:
- RuntimeError (non-whitelisted) propagates through register_commands
- KeyError (whitelisted) falls back to default separator

Co-authored-by: GitHub Copilot (model: mimo-v2.5-free, supervised)
@Quratulain-bilal
Quratulain-bilal force-pushed the fix/agents-narrow-exception-v2 branch from bf20059 to 47e1952 Compare August 10, 2026 21:47
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.

3 participants