fix(gateway): regenerate MCP config after stale-session retry - #73
Merged
Conversation
pool.kill() calls cleanup_mcp_config, which deletes the MCP config file. The stale-session retry path reused the now-stale file path, so Claude failed to start with "MCP config file not found" and the conversation silently timed out. Regenerate the file before retrying, extract the call into write_mcp_config_file to deduplicate, and log regeneration failures instead of dropping them silently. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
aptend
force-pushed
the
fix/mcp-config-stale-session
branch
from
July 8, 2026 09:17
1b2d528 to
835d57d
Compare
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.
Problem
When a Claude conversation hit a stale session (
No conversation found with session ID: ...), the gateway's retry path failed withMCP config file not found, leaving the user with no response and a silent 5-min idle timeout.Root cause
pool.kill()callscleanup_mcp_config(), which deletes the MCP config file. The stale-session retry path reused the now-deleted file path when respawning Claude, so the new process exited immediately withError: Invalid MCP configuration: MCP config file not found.Trace from the incident:
Fix
kill()deletes it and before the retry reuses the path.write_mcp_config_file()to deduplicate the initial-spawn and retry paths.tracing::warn!) instead of silently dropping them.Scope
Only the Claude pool path is affected — Codex receives MCP config inline via
thread/startparams (mcp_config.thread_config()), not via the file, and has no stale-session retry path.🤖 Generated with Claude Code