feat: add SetShouldRefreshGate to gate OAuth token sweep ticks - #5812
Merged
Pratham-Mishra04 merged 1 commit intoAug 8, 2026
Merged
Conversation
|
|
This was referenced Aug 3, 2026
Merged
Merged
refactor: migrate OAuth flow state/PKCE fields from
oauth_configs to new mcp_oauth_flows table
#5709
Merged
Merged
Merged
This was referenced Aug 6, 2026
Pratham-Mishra04
force-pushed
the
08-03-chore_add_resolve-pr-comments-stack_skill
branch
from
August 6, 2026 21:53
3d5c3f0 to
35682af
Compare
Pratham-Mishra04
force-pushed
the
08-03-feat_allow_gating_oauthtokenrefreshworker_sweeps
branch
from
August 6, 2026 21:53
a1c2e96 to
02b9c4e
Compare
Contributor
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Pratham-Mishra04
force-pushed
the
08-03-chore_add_resolve-pr-comments-stack_skill
branch
from
August 8, 2026 08:43
35682af to
c9302d4
Compare
Pratham-Mishra04
force-pushed
the
08-03-feat_allow_gating_oauthtokenrefreshworker_sweeps
branch
from
August 8, 2026 08:43
02b9c4e to
a824e01
Compare
Pratham-Mishra04
force-pushed
the
08-03-chore_add_resolve-pr-comments-stack_skill
branch
from
August 8, 2026 10:15
c9302d4 to
4a3b2af
Compare
Pratham-Mishra04
force-pushed
the
08-03-feat_allow_gating_oauthtokenrefreshworker_sweeps
branch
from
August 8, 2026 10:16
a824e01 to
9006c78
Compare
Pratham-Mishra04
changed the base branch from
08-03-chore_add_resolve-pr-comments-stack_skill
to
graphite-base/5812
August 8, 2026 10:29
Pratham-Mishra04
force-pushed
the
graphite-base/5812
branch
from
August 8, 2026 10:29
4a3b2af to
da8a69d
Compare
Pratham-Mishra04
force-pushed
the
08-03-feat_allow_gating_oauthtokenrefreshworker_sweeps
branch
from
August 8, 2026 10:29
9006c78 to
fe06822
Compare
This was referenced Aug 8, 2026
Collaborator
Author
Merge activity
|
Pratham-Mishra04
dismissed
coderabbitai[bot]’s stale review
August 8, 2026 10:45
The base branch was changed.
Pratham-Mishra04
force-pushed
the
08-03-feat_allow_gating_oauthtokenrefreshworker_sweeps
branch
from
August 8, 2026 10:47
fe06822 to
c50bea4
Compare
Pratham-Mishra04
deleted the
08-03-feat_allow_gating_oauthtokenrefreshworker_sweeps
branch
August 8, 2026 10:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a configurable gate to
OAuthTokenRefreshWorkerthat controls whether a sweep tick proceeds. This allows deployments running multiple workers against a shared token store to prevent concurrent token refreshes of the same token.Changes
shouldRefreshatomic pointer field toOAuthTokenRefreshWorkerthat holds an optional predicate functionSetShouldRefreshGatemethod to install or clear the gate at any time, including while the worker is runningrefreshExpiredTokenscall, the gate (if set) is evaluated and the sweep is skipped if it returns falseType of change
Affected areas
How to test
go test ./framework/oauth2/...Verify that:
falseis installed,refreshExpiredTokensreturns early without querying or refreshing tokenstrueis installed, sweeps proceed normallySetShouldRefreshGate(nil)restores default behaviorScreenshots/Recordings
N/A
Breaking changes
Related issues
Security considerations
The gate function receives a
context.Context, which may carry request-scoped values. Care should be taken that any gate implementation does not inadvertently expose or leak sensitive context values.Checklist
docs/contributing/README.mdand followed the guidelines