a2a/errors: missing error code constants DUPLICATE_ENTITY (-32005), BUDGET_EXCEEDED (-32006), VERSION_MISMATCH (-32007) and A2aVersionMismatchError maps to INTERNAL_ERROR #10326

Open
opened 2026-04-18 08:46:16 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit message: fix(a2a/errors): add missing DUPLICATE_ENTITY, BUDGET_EXCEEDED, VERSION_MISMATCH constants and map A2aVersionMismatchError
  • Branch name: fix/a2a-errors-missing-constants

Background and Context

src/cleveragents/a2a/errors.py documents three error codes in its taxonomy comments but does not define them as Python constants. Additionally, A2aVersionMismatchError is defined but map_domain_error() has no branch for it, causing it to fall through to INTERNAL_ERROR (-32603) instead of the documented -32007.

The module comment (lines 43–47) documents:

#   -32005  Duplicate entity
#   -32006  Budget exceeded
#   -32007  Version mismatch

But only these constants are defined (lines 50–57):

NOT_FOUND: int = -32001
AUTH_ERROR: int = -32002
FORBIDDEN: int = -32003
INVALID_STATE: int = -32004
PLAN_ERROR: int = -32008
CONFIGURATION_ERROR: int = -32009
VALIDATION_ERROR: int = -32602
INTERNAL_ERROR: int = -32603

Constants DUPLICATE_ENTITY = -32005, BUDGET_EXCEEDED = -32006, and VERSION_MISMATCH = -32007 are absent. Additionally, map_domain_error() (lines 120–162) has no branch for A2aVersionMismatchError, causing it to fall through to the final INTERNAL_ERROR catch-all.

Expected Behavior

  • errors.DUPLICATE_ENTITY == -32005
  • errors.BUDGET_EXCEEDED == -32006
  • errors.VERSION_MISMATCH == -32007
  • map_domain_error(A2aVersionMismatchError(...)) returns (-32007, ...)
  • All three constants exported in __all__

Acceptance Criteria

  1. errors.DUPLICATE_ENTITY is defined and equals -32005
  2. errors.BUDGET_EXCEEDED is defined and equals -32006
  3. errors.VERSION_MISMATCH is defined and equals -32007
  4. map_domain_error(A2aVersionMismatchError(...)) returns (VERSION_MISMATCH, ...) i.e. (-32007, ...)
  5. All three new constants are exported in __all__
  6. nox -s unit_tests passes with coverage ≥ 97%
  7. TDD tests from #10305 pass

Subtasks

  • Add DUPLICATE_ENTITY = -32005 constant
  • Add BUDGET_EXCEEDED = -32006 constant
  • Add VERSION_MISMATCH = -32007 constant
  • Add A2aVersionMismatchError branch in map_domain_error() before the generic CleverAgentsError catch
  • Export new constants in __all__
  • All TDD tests from #10305 pass

Definition of Done

  • All three constants defined and exported
  • map_domain_error(A2aVersionMismatchError(...)) returns VERSION_MISMATCH
  • TDD tests from #10305 pass
  • nox -s unit_tests passes with coverage ≥ 97%

Blocked By

#10305


Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit message**: `fix(a2a/errors): add missing DUPLICATE_ENTITY, BUDGET_EXCEEDED, VERSION_MISMATCH constants and map A2aVersionMismatchError` - **Branch name**: `fix/a2a-errors-missing-constants` ## Background and Context `src/cleveragents/a2a/errors.py` documents three error codes in its taxonomy comments but does not define them as Python constants. Additionally, `A2aVersionMismatchError` is defined but `map_domain_error()` has no branch for it, causing it to fall through to `INTERNAL_ERROR` (-32603) instead of the documented `-32007`. The module comment (lines 43–47) documents: ```python # -32005 Duplicate entity # -32006 Budget exceeded # -32007 Version mismatch ``` But only these constants are defined (lines 50–57): ```python NOT_FOUND: int = -32001 AUTH_ERROR: int = -32002 FORBIDDEN: int = -32003 INVALID_STATE: int = -32004 PLAN_ERROR: int = -32008 CONFIGURATION_ERROR: int = -32009 VALIDATION_ERROR: int = -32602 INTERNAL_ERROR: int = -32603 ``` Constants `DUPLICATE_ENTITY = -32005`, `BUDGET_EXCEEDED = -32006`, and `VERSION_MISMATCH = -32007` are absent. Additionally, `map_domain_error()` (lines 120–162) has no branch for `A2aVersionMismatchError`, causing it to fall through to the final `INTERNAL_ERROR` catch-all. ## Expected Behavior - `errors.DUPLICATE_ENTITY == -32005` - `errors.BUDGET_EXCEEDED == -32006` - `errors.VERSION_MISMATCH == -32007` - `map_domain_error(A2aVersionMismatchError(...))` returns `(-32007, ...)` - All three constants exported in `__all__` ## Acceptance Criteria 1. `errors.DUPLICATE_ENTITY` is defined and equals `-32005` 2. `errors.BUDGET_EXCEEDED` is defined and equals `-32006` 3. `errors.VERSION_MISMATCH` is defined and equals `-32007` 4. `map_domain_error(A2aVersionMismatchError(...))` returns `(VERSION_MISMATCH, ...)` i.e. `(-32007, ...)` 5. All three new constants are exported in `__all__` 6. `nox -s unit_tests` passes with coverage ≥ 97% 7. TDD tests from #10305 pass ## Subtasks - [ ] Add `DUPLICATE_ENTITY = -32005` constant - [ ] Add `BUDGET_EXCEEDED = -32006` constant - [ ] Add `VERSION_MISMATCH = -32007` constant - [ ] Add `A2aVersionMismatchError` branch in `map_domain_error()` before the generic `CleverAgentsError` catch - [ ] Export new constants in `__all__` - [ ] All TDD tests from #10305 pass ## Definition of Done - [ ] All three constants defined and exported - [ ] `map_domain_error(A2aVersionMismatchError(...))` returns `VERSION_MISMATCH` - [ ] TDD tests from #10305 pass - [ ] `nox -s unit_tests` passes with coverage ≥ 97% ## Blocked By #10305 --- **Automated by CleverAgents Bot** Agent: new-issue-creator
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#10326
No description provided.