Add --auto-restart option for automatic session recovery - #312
Open
jancurn wants to merge 2 commits into
Open
Conversation
jancurn
commented
Jul 21, 2026
jancurn
pushed a commit
that referenced
this pull request
Jul 21, 2026
…n list The CLI already kicks off a background restart for these sessions when listing them, so suggesting a manual command is pointless. Refs #312 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AEszDHmhkTf8EhhXg2H8NV
…d sessions Sessions created with `mcpc connect --auto-restart` no longer fail until an explicit `restart` when the server rejects their MCP session id: the stored session id is discarded and the session is restarted automatically with a fresh MCP session — on next use, or in the background whenever sessions are probed (e.g. `mcpc` or `mcpc grep`), the same way crashed bridges already reconnect. Previous server-side session state is lost on such a restart. Also fixes a related race: a server-side network failure (e.g. an expired session) reported by the bridge over IPC no longer makes the CLI restart the healthy bridge, which could overwrite the session's `expired`/`unauthorized` status with `active` and hide the real state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AEszDHmhkTf8EhhXg2H8NV
…n list The CLI already kicks off a background restart for these sessions when listing them, so suggesting a manual command is pointless. Refs #312 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AEszDHmhkTf8EhhXg2H8NV
jancurn
force-pushed
the
claude/mcpc-connect-auto-restart-5h2253
branch
from
July 23, 2026 08:56
4589776 to
185c630
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.
Adds a
--auto-restartoption tomcpc connect: sessions expired by the server are restarted automatically with a fresh MCP session (previous session state is lost), instead of failing every command until an explicitrestart. Recovery is opt-in and uses the same machinery as crashed-bridge reconnection — on next use of the session, or in the background whenever sessions are probed (e.g.mcpcormcpc grep), so things likemcpc grepkeep working unattended.--auto-restartonconnect(single and bulk), persisted asautoRestartinsessions.jsonensureBridgeReadyrecovers expired auto-restart sessions with a fresh session; retries once fresh when resumption is rejectedconsolidateSessionsschedules expired auto-restart sessions for background reconnection (with the existing cooldown)expiredstatus withactivesessions/auto-restart) covering direct and grep-triggered background recoveryhttps://claude.ai/code/session_01AEszDHmhkTf8EhhXg2H8NV