Skip to content

No-op try/except in handle_submit catches AgentVersionNotAvailableError only to re-raise it #73

@nficano

Description

@nficano

Category: clean-code Severity: minor
Location: src/arcp/_runtime/_handlers.py:102-105

What

Catching an exception solely to raise it again is a no-op: AgentNotAvailableError (also raised by _resolve_agent) propagates identically with or without the handler, and AgentVersionNotAvailableError is re-raised unchanged. The try/except adds no behavior and obscures intent.

Evidence

    try:
        agent_fn, name, version = runtime._resolve_agent(submit.agent)
    except AgentVersionNotAvailableError:
        raise

Proposed fix

Remove the try/except and call runtime._resolve_agent(submit.agent) directly; both error types already propagate to _dispatch_one which maps them to session.error.

Acceptance criteria

  • The redundant try/except is removed and agent-resolution errors still surface as session.error; tests for unknown agent / unknown version still pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions