fix(mcp): do not await startup lifecycle snapshot on critical path#468
Open
Pitchfork-and-Torch wants to merge 2 commits into
Open
Conversation
getSnapshot() enumerates simulator os_log sessions and peer processes. Awaiting it after stdio transport start delayed the first tools/list by ~10-17s, so short health-probe clients reported tools fetch failed. Fire-and-forget the snapshot with the same metrics/anomaly logging; deferred bootstrap already uses this pattern. Fixes getsentry#461
When getSnapshot is fire-and-forget, markPhase may advance to deferred-initialization before the snapshot resolves. Capture the running phase at schedule time for start metrics/anomaly attribution. Addresses review feedback on getsentry#468 / getsentry#461.
Author
|
Pushed a follow-up commit that pins start metrics/anomaly phase to the schedule-time Addresses the Sentry review note on phase race. |
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.
Summary
Fixes #461.
After the stdio transport is up,
startMcpServer()was still awaitinglifecycle.getSnapshot()before the server could settle into answering the firsttools/list. That snapshot work (simulator os_log session enumeration, peer process sample, etc.) is telemetry-only and was delaying the firsttools/listby ~10–17s on cold start. Short health-probe clients (e.g. Claude Codeclaude mcp list) then reportConnected · tools fetch failedeven though the server is healthy.Change
Move the startup snapshot off the critical path:
lifecycle.getSnapshot()with the same start metrics / anomaly loggingThis matches the existing deferred-initialization pattern immediately below the old await.
Why not delete the snapshot
The issue asks to keep the telemetry; only readiness should not block on it. Metrics and anomaly warnings still run asynchronously.
Test plan
xcodebuildmcp mcpover stdio:initializethen immediatetools/listshould return without the multi-second cold-start stall[mcp-lifecycle] start …still appears in logs shortly after startuplist_sims, etc.) still workNotes