feat(acp): complete prompts asynchronously over SSE - #308
Open
RGHenderson wants to merge 3 commits into
Open
RGHenderson wants to merge 3 commits into
RGHenderson wants to merge 3 commits into
Conversation
Acknowledge long-running prompt requests after the agent accepts them, then deliver their correlated result, timeout, or process-exit error through the existing SSE stream.
Keep the generated ACP response update scoped without dropping schemas that remain part of the checked-in API contract.
Close replay and publication races, reconnect failed event streams, preserve error diagnostics, and guarantee one terminal response for timeout, exit, or shutdown.
RGHenderson
marked this pull request as ready for review
July 21, 2026 09:33
Author
|
@NathanFlurry WDYT? Left some open questions in the attached issue. |
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.
Summary
202 Acceptedoncesession/prompthas been written to the agentMotivation
Long-running prompt POSTs currently remain open for the entire agent turn. Their success therefore depends on every client and intermediary allowing sufficiently long response-header timeouts, even though the client already maintains an SSE stream capable of carrying correlated JSON-RPC responses.
Rationale
session/promptis the long-running operation that needs asynchronous HTTP acceptance. Registering its request ID before writing to the agent preserves response correlation and ring-buffer replay. Returning202only after the stdin write succeeds keeps validation and write failures synchronous, while detached timeout and process-exit handling ensure every accepted request still receives a terminal JSON-RPC envelope.Other requests keep their existing
200response-body behavior, and notifications retain their existing202behavior. This PR is independent of the request-scoped client reliability fix in #306.Closes #305.
Test plan
cargo fmt --all -- --checkcargo check -p acp-http-adapter -p sandbox-agentcargo test -p acp-http-adapterpnpm --filter acp-http-client typechecksandbox-agentand ranpnpm --filter acp-http-client testacp_round_trip_and_replayin CI (the local in-process image build stalled before creating a container)