fix(mcp): bound OAuth callback steps and log each phase to pinpoint hangs#5807
Conversation
…angs The MCP OAuth callback could hang indefinitely after burning state, with no error, no timeout, and no log — the request stalls somewhere between the burn and token persistence with no observable I/O. Wrap each awaited callback step (loadPreregisteredClient, mcpAuthGuarded, clearVerifier, discoverServerTools) with a per-step timeout so a stalled operation surfaces as a labeled error instead of hanging forever, and log start/done for every step, every guarded OAuth fetch phase (validate/request/read-body), and the token-exchange DB writes. The last start without a matching done names the exact stall point.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview OAuth HTTP and persistence tracing: Timed steps do not cancel in-flight work—the race only stops the HTTP handler from waiting forever. Reviewed by Cursor Bugbot for commit 6aa4c9c. Configure here. |
Greptile SummaryThis PR bounds and instruments the MCP OAuth callback flow. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(mcp): widen callback step bounds and..." | Re-trigger Greptile |
…logs - Raise mcpAuthGuarded step bound 60s->120s and discoverServerTools 30s->60s so a legitimately slow multi-leg exchange (each internal fetch is already 30s-bounded) can't be falsely reported as failed. - Log only a pinned boolean, not the resolved IP, so self-hosted private endpoint addresses don't reach log sinks.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6aa4c9c. Configure here.
Promise.resolve(fn()) so a synchronously-returning (e.g. mocked) step can't throw on .catch — restores the callback route unit tests.
Summary
loadPreregisteredClient,mcpAuthGuarded,clearVerifier,discoverServerTools) with a per-step timeout so a stalled op surfaces as a labeled error instead of hanging forever.saveTokens/saveClientInformation).start/…inglog without its matchingdonenames the exact stall point on the next reproduction — so we can root-cause and fix properly.Type of Change
Testing
Type-checks and biome clean. Will be validated by reproducing the Gauge OAuth connect on staging and reading the new per-step logs.
Checklist