Implement JSON-RPC 2.0 wire format and method routing #10863

Open
opened 2026-04-26 07:52:04 +00:00 by HAL9000 · 3 comments
Owner

Metadata

  • Commit Message: feat(jsonrpc): implement JSON-RPC 2.0 wire format and method routing
  • Branch: feature/m9-jsonrpc-wire-format-and-routing

Background and context

The project needs a standalone, spec-compliant JSON-RPC 2.0 wire format and method routing module. The A2A subsystem already uses JSON-RPC 2.0 models and the LSP server has embedded JSON-RPC handling, but there is no reusable, generic JSON-RPC 2.0 layer.

Per milestone v3.8.0 (M9) scope: A2A JSON-RPC 2.0 wire format and method routing.

Spec reference: https://www.jsonrpc.org/specification

Current behavior

JSON-RPC 2.0 handling is duplicated across a2a/models.py, lsp/server.py, and lsp/transport.py. There is no standalone, reusable JSON-RPC 2.0 router with batch support, notification handling, and registered method handlers.

Expected behavior

A new src/cleveragents/jsonrpc/ module provides:

  1. Strict Pydantic models for JsonRpcRequest, JsonRpcResponse, JsonRpcError, JsonRpcNotification, JsonRpcBatchRequest, JsonRpcBatchResponse
  2. Standard error codes with code/message/data structure
  3. JsonRpcRouter for registering method handlers and dispatching single/batch/notification messages
  4. JsonRpcDispatcher that handles the full dispatch lifecycle
  5. Full Behave BDD unit tests

Acceptance criteria

  • JsonRpcRequest model validates jsonrpc=2.0, non-empty method, optional params, optional id
  • JsonRpcNotification model is a request without id field
  • JsonRpcResponse model enforces mutual exclusion of result and error
  • JsonRpcError model has code (int), message (str), optional data fields
  • Standard error codes defined: -32700 ParseError, -32600 InvalidRequest, -32601 MethodNotFound, -32602 InvalidParams, -32603 InternalError
  • JsonRpcRouter supports register(method, handler) and dispatches to registered handlers
  • JsonRpcDispatcher handles single requests, notifications, and batch arrays
  • Batch requests return a batch response array
  • Empty batch array returns InvalidRequest error
  • All quality gates pass

Subtasks

  • Create src/cleveragents/jsonrpc/init.py with public API
  • Create src/cleveragents/jsonrpc/errors.py with standard error codes
  • Create src/cleveragents/jsonrpc/models.py with Pydantic models
  • Create src/cleveragents/jsonrpc/router.py with JsonRpcRouter
  • Create src/cleveragents/jsonrpc/dispatcher.py with JsonRpcDispatcher
  • Create features/jsonrpc_wire_format.feature with BDD scenarios
  • Create features/steps/jsonrpc_wire_format_steps.py with step implementations
  • Run nox quality gates - all green

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line matches the Commit Message in Metadata exactly.
  • The commit is pushed to the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a PR to master, reviewed, and merged.

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

## Metadata - **Commit Message**: `feat(jsonrpc): implement JSON-RPC 2.0 wire format and method routing` - **Branch**: `feature/m9-jsonrpc-wire-format-and-routing` ## Background and context The project needs a standalone, spec-compliant JSON-RPC 2.0 wire format and method routing module. The A2A subsystem already uses JSON-RPC 2.0 models and the LSP server has embedded JSON-RPC handling, but there is no reusable, generic JSON-RPC 2.0 layer. Per milestone v3.8.0 (M9) scope: A2A JSON-RPC 2.0 wire format and method routing. Spec reference: https://www.jsonrpc.org/specification ## Current behavior JSON-RPC 2.0 handling is duplicated across a2a/models.py, lsp/server.py, and lsp/transport.py. There is no standalone, reusable JSON-RPC 2.0 router with batch support, notification handling, and registered method handlers. ## Expected behavior A new src/cleveragents/jsonrpc/ module provides: 1. Strict Pydantic models for JsonRpcRequest, JsonRpcResponse, JsonRpcError, JsonRpcNotification, JsonRpcBatchRequest, JsonRpcBatchResponse 2. Standard error codes with code/message/data structure 3. JsonRpcRouter for registering method handlers and dispatching single/batch/notification messages 4. JsonRpcDispatcher that handles the full dispatch lifecycle 5. Full Behave BDD unit tests ## Acceptance criteria - JsonRpcRequest model validates jsonrpc=2.0, non-empty method, optional params, optional id - JsonRpcNotification model is a request without id field - JsonRpcResponse model enforces mutual exclusion of result and error - JsonRpcError model has code (int), message (str), optional data fields - Standard error codes defined: -32700 ParseError, -32600 InvalidRequest, -32601 MethodNotFound, -32602 InvalidParams, -32603 InternalError - JsonRpcRouter supports register(method, handler) and dispatches to registered handlers - JsonRpcDispatcher handles single requests, notifications, and batch arrays - Batch requests return a batch response array - Empty batch array returns InvalidRequest error - All quality gates pass ## Subtasks - [ ] Create src/cleveragents/jsonrpc/__init__.py with public API - [ ] Create src/cleveragents/jsonrpc/errors.py with standard error codes - [ ] Create src/cleveragents/jsonrpc/models.py with Pydantic models - [ ] Create src/cleveragents/jsonrpc/router.py with JsonRpcRouter - [ ] Create src/cleveragents/jsonrpc/dispatcher.py with JsonRpcDispatcher - [ ] Create features/jsonrpc_wire_format.feature with BDD scenarios - [ ] Create features/steps/jsonrpc_wire_format_steps.py with step implementations - [ ] Run nox quality gates - all green ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the first line matches the Commit Message in Metadata exactly. - The commit is pushed to the branch matching the Branch in Metadata exactly. - The commit is submitted as a PR to master, reviewed, and merged. --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
HAL9000 added this to the v3.8.0 milestone 2026-04-26 07:52:04 +00:00
HAL9000 self-assigned this 2026-04-26 07:52:04 +00:00
Author
Owner

Implementation Attempt - Tier 0: qwen - Failed

PR #10863 does not exist on this repository. The API returns a 404 error when trying to fetch the pull request.

Investigation:

  • GET /api/v1/.../pulls/10863 returned 404
  • Issue #10863 exists but is about JSON-RPC (not timeline docs)
  • PR title and issue title don't match
  • PR may be already merged or missing

Quality gate status: N/A - no valid PR to fix


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

**Implementation Attempt** - Tier 0: qwen - Failed PR #10863 does not exist on this repository. The API returns a 404 error when trying to fetch the pull request. Investigation: - GET /api/v1/.../pulls/10863 returned 404 - Issue #10863 exists but is about JSON-RPC (not timeline docs) - PR title and issue title don't match - PR may be already merged or missing Quality gate status: N/A - no valid PR to fix --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
Author
Owner

test

test
Author
Owner

Implementation Attempt — Tier 0: qwen — Failed

Critical mismatch discovered:

The assigned work was to fix PR #10863 titled "docs(timeline): verify timeline status for 2026-04-16 Cycle 2 [AUTO-TIME-3]", but:

  1. No PR #10863 exists — the Forgejo PR API returns 404.
  2. Issue #10863 exists but its title is "Implement JSON-RPC 2.0 wire format and method routing" — completely different work about JSON-RPC, not timeline verification.
  3. No PR matching the assigned title was found — searched all open/closed PRs for "timeline", "auto-time", "cycle 2", "AUTO-TIME-3" — zero matches.

Conclusion: The work prompt references a PR #10863 with a timeline status that does not exist in the repository. Issue #10863 exists but is about unrelated JSON-RPC work. The assigned work title and issue/PR number are mismatched.

Quality gate status: N/a — could not begin work due to invalid assignment.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

**Implementation Attempt** — Tier 0: qwen — Failed **Critical mismatch discovered:** The assigned work was to fix PR #10863 titled "docs(timeline): verify timeline status for 2026-04-16 Cycle 2 [AUTO-TIME-3]", but: 1. **No PR #10863 exists** — the Forgejo PR API returns 404. 2. **Issue #10863 exists** but its title is "Implement JSON-RPC 2.0 wire format and method routing" — completely different work about JSON-RPC, not timeline verification. 3. **No PR matching the assigned title was found** — searched all open/closed PRs for "timeline", "auto-time", "cycle 2", "AUTO-TIME-3" — zero matches. **Conclusion:** The work prompt references a PR #10863 with a timeline status that does not exist in the repository. Issue #10863 exists but is about unrelated JSON-RPC work. The assigned work title and issue/PR number are mismatched. **Quality gate status:** N/a — could not begin work due to invalid assignment. --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
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#10863
No description provided.