Fix refresh invalid_grant retry storms#392
Open
mattzcarey wants to merge 1 commit into
Open
Conversation
4953e79 to
9870f77
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.
Summary
mcp-common./tokenOAuth responses instead of raw 500s.invalid_grant.destroyeddisconnects and log them as warnings.Why
Fleet logs showed repeated upstream refresh-token
invalid_granterrors across MCP workers. Once the upstream refresh token is permanently dead, retrying the downstream grant loops forever and floods logs. This makes the shared OAuth handler fail fast and force reauthorization.Validation
pnpm --filter @repo/mcp-common testpnpm exec turbo check:types --filter=@repo/mcp-common --filter=cloudflare-ai-gateway-mcp-server --filter=auditlogs --filter=cloudflare-autorag-mcp-server --filter=cloudflare-browser-mcp-server --filter=cloudflare-casb-mcp-server --filter=dex-analysis --filter=dns-analytics --filter=graphql-mcp-server --filter=logpush --filter=cloudflare-radar-mcp-server --filter=containers-mcp --filter=workers-bindings --filter=workers-builds --filter=workers-observability --filter=docs-ai-search --filter=docs-vectorizepnpm check:format(passes; prettier plugin prints existingimport sorting aborted due to babel parsing errorwarning)