Title: fix(oauth): take over a lapsed refresh lease, share overlapping service-account key reads, and label unsearched accounts by waleedlatif1 · Pull Request #9537 · simstudioai/sim · GitHub
Open Graph Title: fix(oauth): take over a lapsed refresh lease, share overlapping service-account key reads, and label unsearched accounts by waleedlatif1 · Pull Request #9537 · simstudioai/sim
X Title: fix(oauth): take over a lapsed refresh lease, share overlapping service-account key reads, and label unsearched accounts by waleedlatif1 · Pull Request #9537 · simstudioai/sim
Description: Summary Follow-ups from a release audit of #9509 (OAuth refresh-ahead) and #9514 (live search latency), rebased on #9528's five-minute floor. A follower takes over a lease its leader left to lapse. The problem: a refresh can be abandoned with its process, as a Trigger.dev run does with detached work. Its leader lease then stays held until the TTL. A caller that has to wait (5 minutes or less left) followed that dead lease for the full wait and got no token. The fix: withLeaderLock now tries the lock once more when a follower's wait and its last read both come up empty. If the follower wins, it leads the refresh itself. If it loses, a live holder has the lease, and it returns null as before. This works for every provider and keeps #9528's guarantee that a served token has at least five minutes left. Nothing serves a stored token below that floor. The leader re-reads the dead flag under the lock, so taking over after a leader failed terminally never calls the provider again with a dead chain. The refresh settle timeout now covers the follower wait plus one takeover lead. Before, the 30s coalesce timeout always fired before the follower's own 30s wait ended, so the follower's last read never counted. The timeout is derived from the lease constants. Overlapping service-account key reads are shared. Google delegation mints one token per subject concurrently, and each mint read and decrypted the same credential row. Concurrent reads now go through coalesceLocally. A later mint still reads again, so revocation is re-checked on every mint. A caller that joins a shared read can still cancel its own wait. Accounts that were never searched are labelled accurately in diagnostics. They get an internal not_started reason instead of a provider timeout with provider_validation. The status and message users see are unchanged. Doc fixes: The refresh-ahead safety note now states only what Google and Microsoft document. refresh-or-reuse now names Instagram as its only user. The account-open concurrency note describes the shared key read. Type of Change Bug fix Testing New tests; each fails on the code before it: Leader lock: A follower whose leader vanished takes over once and leads. A follower that loses the race returns null. Orphaned lease: Google and a non-allowlisted provider both get a freshly refreshed token, with one provider call. A live holder yields no token, never a stored one. The takeover finishes before the settle timeout. Taking over after a dead flag makes no provider call. A hung in-process leader is bounded by the settle timeout. Account gone and dead flag: both fail even with ample validity left. Service-account key: concurrent mints share one key read, and a cancelled mint stops waiting while the others finish. Diagnostics: an account that was never searched is logged as not_started. createConcurrencyLimit: FIFO order, peak never above the limit, and the slot is released on a throw. Live search sessions: a session that never opens frees its slot, and a session that opens late is closed. Checks run: Targeted suites pass: lib/oauth, lib/concurrency, lib/sim-search/live, lib/knowledge/search, lib/core/utils. bun run lint, type-check and check:audits pass. The full suite runs 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 Follow-ups from a release audit of #9509 (OAuth refresh-ahead) and #9514 (live search latency), rebased on #9528's five-minute floor. A follower takes over a lease its leader left to l...
X Description: Summary Follow-ups from a release audit of #9509 (OAuth refresh-ahead) and #9514 (live search latency), rebased on #9528's five-minute floor. A follower takes over a lease its leader left ...
Opengraph URL: https://github.com/simstudioai/sim/pull/9537
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:76bfe339-0c38-f27f-87dc-7aab95f233e9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BA0C:190EF6:7378A:A6CF6:6AFB1890 |
| html-safe-nonce | 732ac92118c5ff131e9b628988b471773613edec3622e42673611adb3827b50e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTBDOjE5MEVGNjo3Mzc4QTpBNkNGNjo2QUZCMTg5MCIsInZpc2l0b3JfaWQiOiI1MzM3NTI4OTEzMzU2MzMxMTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0528ecfbfa8e49d2e34b2f645b5ae3ca153b1bc82e6c7011b5cde1ce84b5552c |
| hovercard-subject-tag | pull_request:5100308152 |
| 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/9537/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 Follow-ups from a release audit of #9509 (OAuth refresh-ahead) and #9514 (live search latency), rebased on #9528's five-minute floor. A follower takes over a lease its leader left to l... |
| 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