fix(agent): avoid context timer during MCP shutdown - #1023
Conversation
Use a non-context Node timer for the MCP client close deadline so service disposal does not create a Cordis effect after the context becomes inactive. Constraint: Preserve the five-second close bound without keeping Node alive Rejected: Revert progressive MCP disclosure | broader unrelated behavior loss Confidence: high Scope-risk: narrow
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. Walkthrough本次变更调整 MCP 客户端关闭流程。代码使用 ChangesMCP 客户端关闭
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This narrowly changes the MCP shutdown timer behavior to preserve the close deadline without keeping the Node process alive; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the MCP client shutdown path in extension-agent to avoid relying on Koishi Context timers during teardown, addressing the startup/shutdown error reported in #1022.
Changes:
- Replaces a
ctx.setTimeout-based shutdown timeout withnode:timers/promisessetTimeout. - Uses an unref’ed timer (
{ ref: false }) so the timeout mechanism won’t keep the Node.js event loop alive during shutdown.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
#1022