fix(mcp): preserve client lifecycle across toolkit copies#2152
Conversation
|
u010143241 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR resolves #2139 by introducing McpClientLifecycleOwner with reference counting, allowing multiple Toolkit copies to share MCP transport ownership. Key changes: ReActAgent.close() now properly closes the toolkit (was previously a no-op), HarnessAgent.close() propagates delegate.close(), and the build() path adds try-catch/finally for resource rollback on failure. The design is clean and effectively solves the MCP client resource leak issue.
(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)
Closes #2139.
Summary
Verification