Skip to content

fix(mcp): deduplicate managed servers - #4591

Merged
seratch merged 1 commit into
openai:mainfrom
hsusul:fix/mcp-manager-deduplicate-servers
Aug 22, 2026
Merged

fix(mcp): deduplicate managed servers#4591
seratch merged 1 commit into
openai:mainfrom
hsusul:fix/mcp-manager-deduplicate-servers

Conversation

@hsusul

@hsusul hsusul commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

MCPServerManager already deduplicated its connection attempt list by server identity, but retained repeated instances in its configured and active lists. Passing the same server object twice therefore connected it once while exposing it twice and cleaning it up twice.

Normalize the constructor iterable with the manager's existing identity-based deduplication helper. First-occurrence ordering is preserved, and distinct server objects remain distinct. This changes no transport, retry, timeout, failure, or parallel-worker behavior.

Test plan

  • Added a lifecycle regression showing that a repeated server instance appears once in all_servers, connects once, appears once in the active result, and cleans up once.
  • uv run pytest tests/mcp/test_mcp_server_manager_cleanup_state.py tests/mcp/test_mcp_server_manager.py tests/mcp/test_connect_disconnect.py -q85 passed
  • make typecheck — mypy passed for 307 source files; Pyright reported 0 errors
  • .agents/skills/code-change-verification/scripts/run.sh — format and lint passed; the broad suite completed with 9029 passed, 28 skipped, 3 failed. The failures were unrelated native-sandbox and timing-sensitive tests. The timing-sensitive failures passed when rerun individually; test_python_skill_uses_absolute_root_from_nested_workdir remains unavailable on this host because its native sandbox command does not create the expected output file.
  • git diff --check — passed

Issue number

N/A

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

@seratch seratch added this to the 0.22.x milestone Aug 22, 2026
@seratch
seratch merged commit 042d84a into openai:main Aug 22, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants