Uh oh!
There was an error while loading. Please reload this page.
improvement(oauth): coalesce token refresh + cache terminal failures - #4706
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Refresh failure handling is hardened. New concurrency utilities and tests added. Introduces Reviewed by Cursor Bugbot for commit b424129. Configure here. |
74180a1 to
9a07693CompareGreptile SummaryThis PR eliminates the OAuth token-refresh race condition by introducing a two-layer coalescing strategy:
Confidence Score: 5/5Safe to merge; the coalescing logic is well-tested and all Redis operations degrade gracefully to pre-PR behaviour when unavailable. The concurrency primitives are correct, the fallback paths (Redis down → uncoordinated leader, lock release failure → TTL expiry) are exercised by tests, and all four refresh call sites now go through the coalesced path. The one non-blocking concern is that a handful of OAuth app-level error codes in the terminal set could cause user-visible reconnect requirements after a server misconfiguration. apps/sim/lib/oauth/terminal-errors.ts — the TERMINAL_ERRORS set includes app-level OAuth config errors alongside user-level credential errors. Important Files Changed
Reviews (4): Last reviewed commit: "improvement(oauth): coalesce token refre..." | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
9a07693 to
5669c4fCompare5669c4f to
3554a5dCompare3554a5d to
d6b870fComparewaleedlatif1
commented
May 21, 2026
waleedlatif1
commented
May 21, 2026
@cursor review |
d6b870f to
b6c7967CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
b6c7967 to
92b42c1CompareUh oh!
There was an error while loading. Please reload this page.
92b42c1 to
99d9265Comparewaleedlatif1
commented
May 21, 2026
waleedlatif1
commented
May 21, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
99d9265 to
b424129Comparewaleedlatif1
commented
May 21, 2026
waleedlatif1
commented
May 21, 2026
@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 b424129. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Summary
account.idso concurrent workflow runs trigger exactly one provider call instead of racing — fixes 201 silentinvalid_refresh_tokenerrors / 30d for Slack alone{ok: false}body errors inrefreshOAuthToken(previously silently dropped to WARN with noproviderId)invalid_refresh_token,access_denied, etc.) for 1h to stop futile retry storms; flag clears on reconnectperformCoalescedRefreshhelper consolidates the three refresh call sites; reuses existingacquireLock/releaseLock+redisConfigMockfrom@sim/testingType of Change
Testing
lib/concurrency/__tests__/singleflight.test.ts,lib/concurrency/__tests__/leader-lock.test.ts,lib/oauth/__tests__/terminal-errors.test.tsaddedChecklist