-
Notifications
You must be signed in to change notification settings - Fork 2.4k
mcp/developer: Refactor to use tokio SplitStream #3894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mcp/developer: Refactor to use tokio SplitStream #3894
Conversation
|
@cgwalters very interesting - I know from past experience stderro/out for shell and commands can be tricky when on different platform and when running bundled in the electron app (signed) for macos - are you able to verify it works well in that scenario as well? (lost a day or 2 to that once, different ways to spawn). How can we validate that? edit: seems fine to me - doesn't change how the streams are started. |
|
I do like this and does look better, I am sure there are latent bugs in the old code here so I think this one is worth a real close look, nice one @cgwalters - how has it been performing for you? |
|
this seems to work really well, hard to know what to look for but so far so good, and much much better than old code (and I think the dependency was already pulled in from another crate so no extra cost really). This could wipe out a few tricky bugs - and yes I think the old way could lose the end of a stream if there is no newline and it ends. @DOsinga I think this may be worth getting in ASAP very nice @cgwalters edit, if goose is right about this, very big: 1. Deadlock Scenario with
|
I was working on a PR with a lot larger output set sizes and I *think* I was seeing the last chunk of output sometimes being lost. That said I asked Gemini to try to reproduce the failure with a case and I couldn't get it to fail offhand. In looking at the original code here it looks OK... Async rust is hard; `tokio::select!` in particular can cause subtle bugs. For a lot more on this see https://blog.yoshuawuyts.com/futures-concurrency-3 and various previous and future blog entries. Anyways this code is I think cleaner, deduplicating the code to send the notification message. Signed-off-by: Colin Walters <[email protected]>
ee7b82c to
032f920
Compare
You're right! I asked AI to generate a test case based on that and indeed it fails with the old code and passes with the new. |
michaelneale
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah have given this a good run and seems solid.
* 'main' of github.com:block/goose: remove fallback routing to hub/home for unknown routes (#3954) Use cross in linux bundle workflow (#3950) fix: disable signing for release branches until we figure out keys for this flow (#3951) Sanitize Tags Unicode Block (#3920) Add a message about DCO to CONTRIBUTING.md (#3741) Move hardcoded LLM prompts to template files (#3934) docs: migrate streamable config to consolidated component (#3936) feat: streamline list args on cli (#3937) mcp/developer: Refactor to use tokio SplitStream (#3894) feat: first time automated ollama install experience and openrouter (#3881) chore: rmcp 0.5.0 (#3935) add gpt-5 to openai provider format (#3924) added gpt5 context limit (#3927) show status of osx codesigning and increase timeout (#3926) Bump auto-compact threshold to 80% (#3925) FIX: gemini tool call hanging (#3898) feat(deps): upgrade rmcp to 0.4.1 (#3918) Fix dark mode rendering of config form and centered providers grid for wider screens. (#3837) fix: extension list not refreshing after installing from deeplink (#3878)
* 'main' of github.com:block/goose: remove fallback routing to hub/home for unknown routes (#3954) Use cross in linux bundle workflow (#3950) fix: disable signing for release branches until we figure out keys for this flow (#3951) Sanitize Tags Unicode Block (#3920) Add a message about DCO to CONTRIBUTING.md (#3741) Move hardcoded LLM prompts to template files (#3934) docs: migrate streamable config to consolidated component (#3936) feat: streamline list args on cli (#3937) mcp/developer: Refactor to use tokio SplitStream (#3894) feat: first time automated ollama install experience and openrouter (#3881) chore: rmcp 0.5.0 (#3935) add gpt-5 to openai provider format (#3924) added gpt5 context limit (#3927) show status of osx codesigning and increase timeout (#3926) Bump auto-compact threshold to 80% (#3925)
Signed-off-by: Colin Walters <[email protected]> Signed-off-by: Jack Wright <[email protected]>
I was working on a previous PR with a lot larger output set sizes and I think I was seeing the last chunk of output sometimes being lost.
That said I asked Gemini to try to reproduce the failure with a case and I couldn't get it to fail offhand. In looking at the original code here it looks OK...
Async rust is hard;
tokio::select!in particular can cause subtle bugs. For a lot more on this seehttps://blog.yoshuawuyts.com/futures-concurrency-3 and various previous and future blog entries.
Anyways this code is I think cleaner, deduplicating the code to send the notification message.