JSON RPC 2.0 Batch support + fix broken Streamable HTTP transport#56
JSON RPC 2.0 Batch support + fix broken Streamable HTTP transport#56RomanEmreis merged 17 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ec251d795
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33756e8b8e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7698cb817
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bf8a1e0b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ch processing at the client side - if one item is failing the whole batch will fail too
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8b4b6e3c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ction teardown for client in case of errors
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e70dc89e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ponse envelopes immediately via pending.complete, collecting non-Response envelopes
into deferred. The second loop processes those requests and notifications. A slow elicitation/sampling request handler in the second pass can no longer
block responses that were already received in the same batch.
Comment 2 — dispatch_request now always returns Response. Unknown methods produce ErrorCode::MethodNotFound.into_response(req_id), where req_id is
captured before req is moved into the match. The single-message Message::Request arm also benefits: it no longer has the else { return; } branch that was
silently killing the entire receive loop on unknown method requests.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1cd78b77ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab7c1ba77c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…untime) (which routes every Response envelope to the pending queue), the MessageEnvelope::Response arm now checks runtime.pending_requests().pop(&resp.full_id())
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2592329696
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c048f67a32
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Implements JSON-RPC 2.0 batch request/response support (spec §6) on both the server and client sides of
Neva, plus a complete
examples/batch/workspace demonstrating the feature.What Changed
Core Types (
neva/src/types.rs)MessageBatch— a non-empty wrapper aroundVec<MessageEnvelope>enforcing the spec's "batch must contain at least one object" rule atconstruction and deserialization
Message::Batch(MessageBatch)variant with#[serde(untagged)]ordering:Batchis last so single-message deserialization is tried firstMessageBatchimplementsIntoIteratorfor ergonomic iteration over envelopesServer (
neva/src/app.rs)Message::Batchby processing each request concurrently and collecting responses into a single batch replyClient Handler (
neva/src/client/handler.rs)Message::Batch: iterates envelopes and dispatches eachResponseto its waiting channel viapending.complete(resp);non-response envelopes in a batch (protocol violations per spec) are silently ignored for robustness
send_batch— registers pending slots for all requests, sends the batch atomically, and cleans up slots on send failure to prevent leakstimeout()/pending()accessors needed byClient::call_batchClient (
neva/src/client.rs+ newneva/src/client/batch.rs)Client::call_batch(items: Vec<MessageEnvelope>) -> Result<Vec<Response>>— sends a batch and awaits all responses concurrently usingtry_join_all(short-circuits on first error)
Client::batch() -> BatchBuilder<'_>— entry point for the fluent builder APIBatchBuilder<'a>with 9 builder methods:list_tools()tools/listrequestcall_tool(name, args)tools/callrequest (setsmetafor progress tracking)list_resources()resources/listrequestread_resource(uri)resources/readrequestlist_resource_templates()resources/templates/listrequestlist_prompts()prompts/listrequestget_prompt(name, args)prompts/getrequest (setsmetafor progress tracking)ping()pingrequestnotify(method, params)send()Example (
examples/batch/)A self-contained workspace (
client+server) demonstrating batch in action:addtool, agreetingprompt, and three notes resources (daily,weekly,monthly)list_tools,list_resources,list_prompts,call_tool,read_resource × 2,get_prompt,ping— then parses and logs each responseOther
CONTRIBUTING.md,CODE_OF_CONDUCT.md,SECURITY.md, issue/PR templates, cleaned-up.gitignoreneva/Cargo.toml,neva_macros/Cargo.toml)Test Coverage
handler.rs:batch_responses_are_distributed_individually— verifies mixed-envelope batch (Response + Request + Response) dispatches only the tworesponses to their pending channels
client.rs:call_batch_returns_error_when_disconnected— verifies early error when no handler is attachedRunning the Example