Skip to content

fix(acp): detect transport close in incoming_protocol_actor#222

Draft
nikomatsakis wants to merge 1 commit into
agentclientprotocol:mainfrom
nikomatsakis:fix-hang
Draft

fix(acp): detect transport close in incoming_protocol_actor#222
nikomatsakis wants to merge 1 commit into
agentclientprotocol:mainfrom
nikomatsakis:fix-hang

Conversation

@nikomatsakis

@nikomatsakis nikomatsakis commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Problem: there is no "event" to indicate that the input event stream has closed. So a naive "proxy' pattern like:

Builder::new()
    .on_receive_dispatch(...)
    .connect_with(async |cx| { while let Some(m) = outgoing_messages.recv().await { cx.send(msg); } })

will hang forever. This PR contains one possible fix but, to be honest, I am not sure it's the right one. It causes an "Error" on incoming transport close which will therefore bring down the connect_with.

I'm going to open a stream on Zulip to discuss.

Fixes #223

The incoming actor's merged stream never ended when the transport closed
because the merge kept waiting on internal channels. Chain a sentinel
item after the transport stream so EOF is detected explicitly, then
return an error to abort the try_join! and let run_until cancel the
foreground task.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to detect "EOF" on transport

1 participant