fix: preserve upstream containment after transport close errors - #118
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesShutdown lifecycle
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/mcp-wrapper.test.ts`:
- Around line 222-225: Update the regression tests using RejectingCloseTransport
so they create one shared Error instance for the simulated close failure, inject
that instance into the transport, and assert MiftahServer.close() rejects with
the identical object via rejects.toBe(closeError) rather than checking only its
message.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a1017302-d05c-41da-a157-f5073d58a3b4
📒 Files selected for processing (2)
src/mcp/server/miftah-server.tstests/mcp-wrapper.test.ts
80347ab to
dd98314
Compare
Fixes #112.
Root cause
MiftahServer.close previously stopped at the first downstream transport-close rejection, skipping upstream manager shutdown and potentially leaving a stdio provider process alive.
Change
Each shutdown phase now runs independently. Miftah preserves and rethrows the first failure after resource-subscription cleanup, MCP transport shutdown, and upstream process-manager containment have all been attempted.
Regression coverage
The focused test starts a real fake stdio upstream, injects a rejecting downstream transport close, verifies the original error still reaches the caller, and verifies manager health is stopped with no retained PID.
Validation
A separate coverage-only doctor readiness cascade was observed and is tracked in #117; no coverage threshold, timeout, or test behavior was weakened here.
Summary by CodeRabbit