Skip to content

Refresh closed MCP connections before ordinary turns - #554

Merged
GraciousGazelles merged 5 commits into
mainfrom
fix/refresh-closed-mcp-connections
Jul 31, 2026
Merged

GraciousGazelles merged 5 commits into
mainfrom
fix/refresh-closed-mcp-connections

Conversation

@GraciousGazelles

Copy link
Copy Markdown
Collaborator

Summary

  • detect initialized MCP transports that have closed between ordinary turns
  • reuse the existing dirty-refresh path so healthy connections stay intact
  • prove an unchanged stdio MCP configuration is restarted and its replacement catalogue reaches the next provider request

Validation

  • git diff --check
  • hosted checks required; no local Rust build or test was run

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to detect and replace closed MCP server connections during a session turn by checking connection liveness and marking the runtime dirty if any connection has lost its transport. It also adds an integration test to verify this behavior. The review feedback highlights two important areas for improvement: first, the potential for an infinite crash loop or resource exhaustion if a server repeatedly crashes immediately after startup, which could be mitigated with a cooldown or backoff mechanism; second, the performance overhead of sequentially querying connection liveness on every step of a turn, which could be addressed by rate-limiting or caching the liveness status.

Comment thread codex-rs/core/src/session/mcp.rs Resolved
@GraciousGazelles
GraciousGazelles added this pull request to the merge queue Jul 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 31, 2026
@GraciousGazelles
GraciousGazelles added this pull request to the merge queue Jul 31, 2026
Merged via the queue into main with commit 1a559fe Jul 31, 2026
91 of 93 checks passed
@GraciousGazelles
GraciousGazelles deleted the fix/refresh-closed-mcp-connections branch July 31, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant