UAT: A2aLocalFacade.dispatch() re-raises A2aOperationNotFoundError instead of returning JSON-RPC 2.0 error response with code -32601 #5090

Open
opened 2026-04-09 00:59:52 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: A2A Protocol — local facade dispatch contract
Severity: High — breaks the dispatch() contract; callers receive an exception instead of a structured error response


What Was Tested

Code-level analysis of src/cleveragents/a2a/facade.py — the A2aLocalFacade.dispatch() method's error handling for unknown operations.

Expected Behavior (from spec)

Per ADR-047 (A2A Standard Adoption) and the JSON-RPC 2.0 specification (Section 5.1):

When a method is not found, the server MUST return an error response with code -32601 (Method not found).

The dispatch() method's documented contract is:

Returns an A2aResponse with result set on success or error set when the operation fails.

For an unknown method, the correct behavior is:

{
  "jsonrpc": "2.0",
  "id": "...",
  "error": {"code": -32601, "message": "Method not found: unknown/method"}
}

Actual Behavior

File: src/cleveragents/a2a/facade.py, lines 185–186

def dispatch(self, request: A2aRequest) -> A2aResponse:
    ...
    try:
        data = self._route_operation(request.method, request.params)
        ...
        return A2aResponse(id=request.id, result=data)
    except A2aOperationNotFoundError:
        raise  # ← BUG: re-raises instead of returning error response
    except Exception as exc:
        ...
        return A2aResponse(id=request.id, error=A2aErrorDetail(code=code, message=message))

When an unknown method is dispatched, A2aOperationNotFoundError is re-raised to the caller rather than being caught and converted to an A2aResponse with error.code = -32601. This breaks the method's own documented contract ("Returns an A2aResponse") and violates the JSON-RPC 2.0 specification.

Impact

Any caller of dispatch() that sends an unknown method name will receive an unhandled exception instead of a structured error response. This is particularly problematic for:

  • CLI commands that call dispatch() and expect an A2aResponse
  • Future stdio transport that reads JSON-RPC requests and must always write JSON-RPC responses

Code Location

  • src/cleveragents/a2a/facade.py — lines 185–186 (except A2aOperationNotFoundError: raise)

Fix Required

The except A2aOperationNotFoundError block should catch the exception and return an A2aResponse with the appropriate error code:

except A2aOperationNotFoundError as exc:
    return A2aResponse(
        id=request.id,
        error=A2aErrorDetail(code=-32601, message=str(exc)),
    )

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area:** A2A Protocol — local facade dispatch contract **Severity:** High — breaks the `dispatch()` contract; callers receive an exception instead of a structured error response --- ### What Was Tested Code-level analysis of `src/cleveragents/a2a/facade.py` — the `A2aLocalFacade.dispatch()` method's error handling for unknown operations. ### Expected Behavior (from spec) Per ADR-047 (A2A Standard Adoption) and the JSON-RPC 2.0 specification (Section 5.1): > When a method is not found, the server MUST return an error response with code `-32601` (Method not found). The `dispatch()` method's documented contract is: > Returns an `A2aResponse` with `result` set on success or `error` set when the operation fails. For an unknown method, the correct behavior is: ```json { "jsonrpc": "2.0", "id": "...", "error": {"code": -32601, "message": "Method not found: unknown/method"} } ``` ### Actual Behavior **File:** `src/cleveragents/a2a/facade.py`, lines 185–186 ```python def dispatch(self, request: A2aRequest) -> A2aResponse: ... try: data = self._route_operation(request.method, request.params) ... return A2aResponse(id=request.id, result=data) except A2aOperationNotFoundError: raise # ← BUG: re-raises instead of returning error response except Exception as exc: ... return A2aResponse(id=request.id, error=A2aErrorDetail(code=code, message=message)) ``` When an unknown method is dispatched, `A2aOperationNotFoundError` is re-raised to the caller rather than being caught and converted to an `A2aResponse` with `error.code = -32601`. This breaks the method's own documented contract ("Returns an `A2aResponse`") and violates the JSON-RPC 2.0 specification. ### Impact Any caller of `dispatch()` that sends an unknown method name will receive an unhandled exception instead of a structured error response. This is particularly problematic for: - CLI commands that call `dispatch()` and expect an `A2aResponse` - Future stdio transport that reads JSON-RPC requests and must always write JSON-RPC responses ### Code Location - `src/cleveragents/a2a/facade.py` — lines 185–186 (`except A2aOperationNotFoundError: raise`) ### Fix Required The `except A2aOperationNotFoundError` block should catch the exception and return an `A2aResponse` with the appropriate error code: ```python except A2aOperationNotFoundError as exc: return A2aResponse( id=request.id, error=A2aErrorDetail(code=-32601, message=str(exc)), ) ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 01:01:25 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — Spec compliance bug that breaks documented behavior
  • Milestone: v3.2.0
  • Story Points: 3 — M
  • MoSCoW: Must Have — Spec compliance is required

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: High — Spec compliance bug that breaks documented behavior - **Milestone**: v3.2.0 - **Story Points**: 3 — M - **MoSCoW**: Must Have — Spec compliance is required --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 modified the milestone from v3.2.0 to v3.5.0 2026-04-09 01:11:42 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#5090
No description provided.