fix(workspace): gracefully handle invalid MCP config entries during i…#1819
Open
xliu123321 wants to merge 1 commit into
Open
fix(workspace): gracefully handle invalid MCP config entries during i…#1819xliu123321 wants to merge 1 commit into
xliu123321 wants to merge 1 commit into
Conversation
…nitialize MCP deserialization and connection in LocalWorkspace.initialize() had no error handling, unlike skill loading in the same method. A single invalid .mcp entry (e.g. is_stateful: false for STDIO MCP) or a single connection failure would crash the entire workspace permanently. Changed the list comprehension to per-entry try/except so bad entries are skipped with a warning instead of crashing, and added per-entry error handling around stateful MCP connect(). Fixes agentscope-ai#1817
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.
AgentScope Version
2.0.1
Description
Fixes #1817
A single invalid MCP config entry in a workspace
.mcpfile (e.g.is_stateful: falsefor a STDIO MCP) or a single MCP connection failure would crashLocalWorkspace.initialize()entirely, making the whole workspace permanently non-functional — chat messages silently fail, workspace panels return 500.The root cause: MCP deserialization and connection in
initialize()had zero error handling, unlike skill loading in the samemethod which consistently wraps operations in try/except.
Changes:
mcp.connect()so one connection failure doesn't block others.Modified files:
src/agentscope/workspace/_local_workspace.py— 2 logic changes, no API changetests/workspace_local_test.py— 6 new testsHow to test: