Title: improvement(mcp): trace OAuth state writes to diagnose invalid_state clobber by waleedlatif1 · Pull Request #5772 · simstudioai/sim · GitHub
Open Graph Title: improvement(mcp): trace OAuth state writes to diagnose invalid_state clobber by waleedlatif1 · Pull Request #5772 · simstudioai/sim
X Title: improvement(mcp): trace OAuth state writes to diagnose invalid_state clobber by waleedlatif1 · Pull Request #5772 · simstudioai/sim
Description: Summary MCP OAuth (app.withgauge.com/mcp and others) fails on the callback with invalid_state ("Authorization expired"). Staging DB + logs confirm the authorization state is cleared ~5s after /oauth/start saves it, before the user authorizes — but clearState was silent, so the clobber never appeared in logs. Verified this is the only path that can null an existing row's state: safeDecrypt never touches state (it's a hash, not encrypted), and the discovery/connection paths short-circuit (if (!row.tokens)) before ever running the SDK auth() flow. Adds a caller context to saveState/clearState and logs every write, so the exact clobber source is pinned on the next repro — then the precise fix follows. Type of Change Improvement (diagnostic instrumentation) Testing Tested manually — lint, typecheck, and 29 OAuth unit tests pass. Instrumentation is behavior-preserving (optional param defaults to unknown). Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary MCP OAuth (app.withgauge.com/mcp and others) fails on the callback with invalid_state ("Authorization expired"). Staging DB + logs confirm the authorization state is cleared ~5s ...
X Description: Summary MCP OAuth (app.withgauge.com/mcp and others) fails on the callback with invalid_state ("Authorization expired"). Staging DB + logs confirm the authorization state is clea...
Opengraph URL: https://github.com/simstudioai/sim/pull/5772
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9f1782be-56ef-1eaa-dbb5-f7756815ccca |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9F48:3BB26F:383807D:4E40545:6A635BF9 |
| html-safe-nonce | af62996a3069c30e8a61dd5b34e9a6afd27c0057bd66b5091d63facb07486d20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjQ4OjNCQjI2RjozODM4MDdEOjRFNDA1NDU6NkE2MzVCRjkiLCJ2aXNpdG9yX2lkIjoiNzUyNjE5NzM1NDkzNTA0OTIwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 318fb18260624aa1f1c72f9dc6417ae3f8b45109ae42f45b1b9212f5791580ab |
| hovercard-subject-tag | pull_request:4093652318 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5772/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary MCP OAuth (app.withgauge.com/mcp and others) fails on the callback with invalid_state ("Authorization expired"). Staging DB + logs confirm the authorization state is cleared ~5s ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 59e55daad7174ca59d63c6974d58276ccb5477442e550bebb3c035e1bef11c94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 71b1218de2f2ab29c4d5ce72568e68e2c56044c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width