fix(mcp): run checkForUpdates async for mcp and serve subcommands#273
Closed
jgarrone82 wants to merge 2 commits intoGentleman-Programming:mainfrom
Closed
fix(mcp): run checkForUpdates async for mcp and serve subcommands#273jgarrone82 wants to merge 2 commits intoGentleman-Programming:mainfrom
jgarrone82 wants to merge 2 commits intoGentleman-Programming:mainfrom
Conversation
added 2 commits
April 28, 2026 08:34
Moves the update check to a goroutine for long-running server subcommands (mcp, serve) so the server starts immediately without blocking on a GitHub API network request. On Windows, http.DefaultClient with a Go context timeout does not guarantee the underlying OS socket (WSARecv) is cancelled within the deadline. With Claude Code's stream idle timeout of 300s, a hung update check means MCP never starts and the client waits the full 5 minutes before giving up. Interactive subcommands (save, search, tui, etc.) keep the synchronous check so the update message appears before command output. Closes Gentleman-Programming#269
2 tasks
Collaborator
|
Thanks for chasing #269. The direction is right, but I am closing this PR rather than merging the stale branch as-is because I am rebuilding the startup fix on current |
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
checkForUpdatesruns synchronously inmain()beforecmdMCPis called (cmd/engram/main.go:534). This means the MCP server does not start listening until the GitHub API call completes or times out.Root cause
http.DefaultClientwith no transport-level timeout (only a 2scontext.WithTimeout)WSARecvcall may not unblock immediatelyidleDeadlineMs=300000(5 minutes). If MCP never starts responding, Claude Code waits the full 5 minutes then kills the connectionObserved impact
Fix
Run the update check in a goroutine so
cmdMCPstarts immediately:Interactive subcommands (
save,search,tui, etc.) keep the synchronous check so the update message appears before command output.Environment
checkForUpdatescall)Closes #269