fix(mcp): thread-safe MCP client across loops; workflow service MCP lifespan#279
Merged
Merged
Conversation
Route MCP client commands through the owner loop, initialize MCP in the workflow service lifespan, and add regression tests for cross-loop usage and route/service behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
…eadiness Only enqueue disconnect when connected; expose mcp_ready in workflow service health and return 503 when MCP init fails; add regression tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Return reconnected/reconnect_error in the update response; bound reconnect with timeout derived from server config; extend route tests. Co-authored-by: Cursor <cursoragent@cursor.com>
duguwanglong
approved these changes
May 18, 2026
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
run_coroutine_threadsafewhen callers run on a different loop, so disconnect and tool calls stay consistent across threads/loops.call_tool/disconnect, workflow tool integration, workflow run route (no duplicate MCP init), and service runtime lifespan behavior.