Title: improvement(oauth): serve still-valid tokens while refreshing ahead of expiry by waleedlatif1 · Pull Request #9509 · simstudioai/sim · GitHub
Open Graph Title: improvement(oauth): serve still-valid tokens while refreshing ahead of expiry by waleedlatif1 · Pull Request #9509 · simstudioai/sim
X Title: improvement(oauth): serve still-valid tokens while refreshing ahead of expiry by waleedlatif1 · Pull Request #9509 · simstudioai/sim
Description: Summary Every caller inside the 5-minute OAuth refresh window blocked on the provider refresh, even though its access token was still valid for minutes. Polls, workflow tools, selectors and live search all paid that wait, and a stalled refresh held them for up to 30s One decision, planAccessTokenRefresh, replaces the three copies in getOAuthToken, resolveCredentialTokenBundle and refreshTokenIfNeeded: For Google and Microsoft providers with more than 2 minutes left, the caller gets the still-valid token now and the existing coalesced refresh runs in the background. These providers keep a refreshed-away access token valid and the old refresh token usable, so an abandoned refresh loses nothing The start of the window is jittered per account, so credentials that expire together don't refresh together Every other provider, and any token with 2 minutes or less left, waits exactly as before. Rotation guards, revocation-against-version, dead flags, the leader lock, Microsoft refresh-token aging and Instagram renewal are unchanged resolveCredentialTokenBundle's existing signal now also stops a caller waiting on a shared OAuth refresh (via waitWithAbort), without cancelling the refresh for anyone else Live search passes its deadline signal into account resolution, so a hung token resolution can no longer hold a 20s search past its deadline. Document reads now start their 15s deadline before resolving the account Type of Change Bug fix Testing New tests, each failing on staging: A Google token with 4 minutes left returns at once while the provider is still pending, and the background refresh then rotates the row The headroom table runs per reader A cancelled caller stops waiting while a concurrent caller still gets the refreshed token, with one provider call Live search settles by its 20s deadline, and reads by 15s, when token resolution never settles Guards proven by breaking the code: providers outside Google/Microsoft and tokens under the 2-minute floor still wait lib/oauth, lib/sim-search/live, lib/concurrency and app/api/auth/oauth all pass (827 tests). bun run lint, block registry check, type-check and check:audits pass, except check:unused-exports, which flags an apps/docs generated import not built in a local checkout Integration suites (credential-revocation, shopify, managed-mcp, provider-discovery) and the full test suite run in CI Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing (new tests pass the test-audit authoring gate) 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 Every caller inside the 5-minute OAuth refresh window blocked on the provider refresh, even though its access token was still valid for minutes. Polls, workflow tools, selectors and live s...
X Description: Summary Every caller inside the 5-minute OAuth refresh window blocked on the provider refresh, even though its access token was still valid for minutes. Polls, workflow tools, selectors and live s...
Opengraph URL: https://github.com/simstudioai/sim/pull/9509
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8ced47dc-492b-0ccd-1dcc-8485caa01aa4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9CEC:13FAB0:1215DD:1AEB9D:6AFB1C16 |
| html-safe-nonce | 35462898fd5b478dec13e2a75a4ad5e0159c121810aad6f02108bbaf36a53918 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0VDOjEzRkFCMDoxMjE1REQ6MUFFQjlEOjZBRkIxQzE2IiwidmlzaXRvcl9pZCI6IjExNjQwMjMyMDIyOTI4OTg4MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d14147fccddf1d177f194b2065789b79edd7b72d1d4636c85a35d286011f20c9 |
| hovercard-subject-tag | pull_request:5095830250 |
| 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/9509/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 Every caller inside the 5-minute OAuth refresh window blocked on the provider refresh, even though its access token was still valid for minutes. Polls, workflow tools, selectors and live s... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24933791aba0f10b2f189f8b953a1452dd79933933ac13a0a67b8ad3acee3d9f |
| 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 | 030711cc180b563614a434f4376acf7da5d445fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width