fix(acp)!: preserve JSON-RPC frames across transport adapters#275
Merged
Conversation
Carry complete single, batch, and malformed frames through component, tracing, HTTP, WebSocket, and polyfill boundaries. Preserve grouped responses and HTTP request provenance, including duplicate and null IDs. BREAKING CHANGE: Channel now carries TransportFrame instead of Result<RawJsonRpcMessage, Error>. FramedChannel and into_framed_channel_and_future are removed.
There was a problem hiding this comment.
Pull request overview
This PR updates the ACP Rust SDK’s in-process transport boundary so protocol components and transport adapters preserve complete JSON-RPC frames (single values, non-empty batches, and malformed wire input) end-to-end. It removes the legacy Result<RawJsonRpcMessage, Error>-based channel API in favor of a frame-aware Channel<TransportFrame>, and updates core routing plus HTTP/WebSocket/polyfill integrations to maintain batch grouping, request provenance, and duplicate/null ID behavior.
Changes:
- Make
ChannelcarryTransportFrame(single/batch/malformed) and removeFramedChannel/into_framed_channel_and_future. - Introduce public
TransportBatch/TransportBatchEntryand addTransportFrame::{parse_json,to_json}utilities to round-trip frames across text-based transports. - Update HTTP + WebSocket servers/clients and the MCP-over-ACP polyfill to preserve batch frames and correctly correlate grouped responses.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/agent-client-protocol/tests/protocol_v2.rs | Updates protocol v2 tests to send/receive TransportFrame::Single on channels. |
| src/agent-client-protocol/tests/jsonrpc_transport_close.rs | Adjusts close/drain tests for the new frame-based channel semantics. |
| src/agent-client-protocol/tests/jsonrpc_batch.rs | Updates documentation to reflect batch-aware frames at the channel boundary. |
| src/agent-client-protocol/src/stdio.rs | Switches stdio transport adapter to into_channel_and_future returning Channel. |
| src/agent-client-protocol/src/role/acp.rs | Migrates ACP role/router wiring to frame-based channels and malformed handling. |
| src/agent-client-protocol/src/lib.rs | Publicly re-exports TransportFrame / batch types; removes hidden FramedChannel export. |
| src/agent-client-protocol/src/jsonrpc/transport_actor.rs | Implements frame parsing/serialization and safe relaying of malformed multiline payloads. |
| src/agent-client-protocol/src/jsonrpc/outgoing_actor.rs | Updates protocol→transport forwarding to send TransportFrame::Single directly. |
| src/agent-client-protocol/src/jsonrpc/incoming_actor.rs | Updates frame entry extraction and response-destination assignment for new frame types. |
| src/agent-client-protocol/src/jsonrpc.rs | Makes TransportFrame/batch types public, removes legacy bridging, and redefines Channel as frame boundary. |
| src/agent-client-protocol/src/component.rs | Removes into_framed_channel_and_future and legacy negotiation adapter. |
| src/agent-client-protocol/src/acp_agent.rs | Updates AcpAgent to expose Channel via into_channel_and_future and use TransportFrame. |
| src/agent-client-protocol/CHANGELOG.md | Documents the breaking channel change and frame-preservation fixes with migration-guide link. |
| src/agent-client-protocol-polyfill/src/mcp_over_acp/http.rs | Preserves batch frames through MCP-over-ACP HTTP bridge; correlates malformed POST errors to the originating request. |
| src/agent-client-protocol-polyfill/CHANGELOG.md | Notes batch-frame preservation and malformed correlation fixes in polyfill changelog. |
| src/agent-client-protocol-http/src/websocket_server.rs | Switches WS handling to TransportFrame::parse_json, forwards batches intact, and adds grouped-response tests. |
| src/agent-client-protocol-http/src/http_server.rs | Adds batch-aware POST handling and session-aware routing while preserving grouped batch responses. |
| src/agent-client-protocol-http/src/connection.rs | Routes outbound frames (single/batch/malformed), supports duplicate IDs via queued pending routes, and adds tests. |
| src/agent-client-protocol-http/src/client.rs | Updates HTTP client transport to post/receive frames (including batches/malformed) and adds end-to-end preservation tests. |
| src/agent-client-protocol-http/CHANGELOG.md | Notes batch-frame preservation fixes for HTTP and WebSocket transports. |
| src/agent-client-protocol-conductor/src/snoop.rs | Updates conductor snooper to bridge with inspection using Channel instead of FramedChannel. |
| md/transport-architecture.md | Updates architecture doc to describe TransportFrame boundary and frame-based Channel. |
| md/SUMMARY.md | Adds the v2.0 migration guide to the mdBook ToC. |
| md/migration_v2.0.md | Adds a 2.0 migration guide describing the new Channel<TransportFrame> boundary and removed APIs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Carry complete single, batch, and malformed frames through component, tracing, HTTP, WebSocket, and polyfill boundaries. Preserve grouped responses and HTTP request provenance, including duplicate and null IDs.
BREAKING CHANGE: Channel now carries TransportFrame instead of Result<RawJsonRpcMessage, Error>. FramedChannel and into_framed_channel_and_future are removed.