Skip to content

fix: Avoid event loop timing causing out of order messages#130

Merged
benbrandt merged 3 commits intoagentclientprotocol:mainfrom
anvilpete:response-handler-wait
Apr 23, 2026
Merged

fix: Avoid event loop timing causing out of order messages#130
benbrandt merged 3 commits intoagentclientprotocol:mainfrom
anvilpete:response-handler-wait

Conversation

@anvilpete
Copy link
Copy Markdown
Contributor

Fixes #128.

Added a test for this out-of-order processing, and another to check for deadlock when sending a request from a request handler.

@anvilpete anvilpete force-pushed the response-handler-wait branch from b915e18 to ee088a5 Compare April 22, 2026 08:23
Send requests without awaiting `sendMessage` and remove the extra
zero-delay yield after processing each message.

This prevents unnecessary event-loop stalls while preserving pending
response rejection handling if the transport closes.
@benbrandt
Copy link
Copy Markdown
Member

Looks like the real issue was the await on the send message

@benbrandt benbrandt changed the title fix: Wait for response handler to run before processing the next message fix: Avoid event loop timing causing out of order messages Apr 23, 2026
@benbrandt benbrandt merged commit 8f514f3 into agentclientprotocol:main Apr 23, 2026
2 checks passed
@anvilpete
Copy link
Copy Markdown
Contributor Author

Even better - thanks!

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.

ACP events processed out of order

2 participants