[Bug] OAuth token refresh holds the auth.json lock across the network call #1768
Replies: 1 comment 1 reply
|
Investigated this report and produced a candidate fix, validated on a fork of this repository. Root cause, fix and validation from the working notes:
Diff: awhite0030/prime-agent@main...fix-oauth-refresh-lock-14037132116416936199 The change passes |
Uh oh!
There was an error while loading. Please reload this page.
Affected area
Coding agent and CLI
What happened?
refreshOAuthTokenWithLockholds theauth.jsonlock for the whole HTTP refresh. A slow or hanging provider blocks every other process from reading or writing credentials for up to 30s. The sync retry path gives up after about 200ms and throws.Steps to reproduce
auth.json.Expected behavior
Hold the lock only to read and later to write. Refresh over the network with no lock held. If another process stored newer credentials in the meantime, keep those and drop our result, because refresh tokens rotate on use.
Prime Agent version
0.7.1 / source as of 2026-08-08
Environment
Reproduced from source.
Additional context
Original report: #999
Tested patch, closed in the August 15 backlog sweep: #1001
All reactions