fix(mcp): restore live connector preservation and bounded shutdown - #932
Open
breedx wants to merge 1 commit into
Open
fix(mcp): restore live connector preservation and bounded shutdown#932breedx wants to merge 1 commit into
breedx wants to merge 1 commit into
Conversation
Keep materialized connector objects/status during manager refresh. Cancel registered lifecycle tasks under the registry lock, then drain outside it with a five-second deadline. Retain ownership on incomplete cleanup and deduplicate the shutdown callback. Restart ordering and pending startup ownership remain separate concerns.
This was referenced Sep 11, 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.
Refreshing MCP configuration should not replace live connectors, and stopping a healthy connector should not deadlock on its own cleanup lock. This restores the narrow preservation and bounded-shutdown fix from #924 after its revert in #931.
Resubmission
GitHub cannot reopen a merged PR, so this is a new reviewable submission against current
main(007c53b2, v0.0.833).Change
Validation
Current upstream lock installed in a dedicated environment: Linux, Python 3.13.13, core plugins 0.0.45, Pydantic AI 2.35.0, MCP 1.27.1, and fastmcp-slim 3.4.7.
pytest -q -o addopts= tests/mcp/test_shutdown_preservation.py: 9 passed, including real local stdio transport cleanup.git diff --checkpassed.tests/mcp tests/agents tests/tools tests/command_line/mcp tests/test_completions_and_small_modules.py tests/test_claude_refresh_review.py): 1,898 passed, 7 skipped, 1 warning.AsyncMockMixin._execute_mock_callin the browser control tests. Runningtests/tools/browser/test_browser_control.pyindependently on both this candidate and unpatched007c53b2reproduces the same warning: 26 passed, 1 warning in each lane. It was not suppressed.tests/command_line/test_autosave_menu.py::TestSessionBrowser::test_open_project_and_select_sessionexpectingTODAYfrom entries timestamped one/two hours beforedatetime.now()just after midnight. The same isolated assertion fails on both unpatched007c53b2and this candidate. This patch changes neither the browser nor that test; no clock-dependent rerun or assertion suppression was used.Local tests use disposable HOME/XDG, no inherited credentials, and blocked socket connect/DNS/bind. Prior bug-regression baseline controls and independent review are documented in #924; those historical counts are not being presented as new results.
Boundaries
This does not fix restart/reload/remove ordering, pending startup ownership, late startup registration, manager/CLI completion reporting, or completion-time agent rebinding. Connector-entry containment is separate. The deadline bounds caller waiting, not process termination; operations remain on their owning event loop. No release or deployment qualification is claimed.