fix(coding-agent): run OAuth refresh outside the auth.json file lock - #1887
Closed
veerareddyvishal144 wants to merge 1 commit into
Closed
Conversation
|
Hi @veerareddyvishal144, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/PrimeIntellect-ai/prime-agent/blob/main/CONTRIBUTING.md for more details. |
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.
Fixes #999.
What was broken
refreshOAuthTokenWithLockawaited the provider's token refresh (an HTTP round-trip) inside thewithLockAsynccallback, holding the auth.json file lock across the network call. This blocked other processes/threads from reading or refreshing credentials, causing hangs and stale auth state.Fix
Replaces #1001 (closed in Aug 15 backlog sweep, not merged).
Fixes #999
Note
Move OAuth token refresh outside the
auth.jsonfile lock inAuthStorageAuthStorage.refreshOAuthTokenWithLockto a two-phase lock protocol: read expired credentials under lock, release it, runprovider.refreshTokenoutside the lock, then reacquire the lock to persist.cred.refreshandcred.expiresagainst the snapshot; if another process wrote fresher credentials mid-refresh, the stale result is discarded and the freshest credentials are returned.getOAuthApiKeyimport and replaces the oldoauthCreds-map delegation with directprovider.refreshTokencalls and explicit merge/persist logic.Macroscope summarized e40b5fd.