Repository navigation
fix(oauth): take over a lapsed refresh lease, share overlapping service-account key reads, and label unsearched accounts - #9537
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThe PR lets a waiting OAuth caller take over an expired refresh lease, shares overlapping service-account key reads, and labels accounts that never started searching.
|
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…re overlapping service-account reads, and label unsearched accounts
…a held lease - A failed blocking refresh now falls back to the stored token only on a distinct lease-held outcome: this caller followed another lease holder for its whole wait, its last read still found the chain it started from, and no leader flagged it dead. A dead flag, a terminal refresh error, a vanished account or a leader exception stay failures. - The in-process refresh settles after the follower's full wait plus headroom instead of the default 30s, which fired before the follower's last read could count; a leader hung in this process still fails its callers, now at that bound.
…tored token - A follower whose wait ends with nothing now tries the lock once more: a leader whose process died leaves its lease to lapse, and the follower leads the refresh instead of failing. Losing that try still returns nothing. - Drops the stored-token fallback and its lease-held outcome, which served tokens below the five-minute floor a served token keeps. - The leader rereads the dead flag under the lock, so a follower taking over after a leader that failed terminally does not call the provider again. - The in-process refresh settles after the follower wait plus a full leader run and headroom.
905e9fd to
59bc945
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Follow-ups from a release audit of #9509 (OAuth refresh-ahead) and #9514 (live search latency), rebased on #9528's five-minute floor.
withLeaderLocknow 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 returnsnullas before.coalesceLocally. A later mint still reads again, so revocation is re-checked on every mint.not_startedreason instead of a provider timeout withprovider_validation. The status and message users see are unchanged.refresh-or-reusenow names Instagram as its only user.Type of Change
Testing
New tests; each fails on the code before it:
null.not_started.createConcurrencyLimit: FIFO order, peak never above the limit, and the slot is released on a throw.Checks run:
lib/oauth,lib/concurrency,lib/sim-search/live,lib/knowledge/search,lib/core/utils.bun run lint, type-check andcheck:auditspass.Checklist
test-auditauthoring gate)