You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Github api token caching: race condition in installation token refresh #528
Github api token caching: race condition in installation token refresh
Evidence:src/lib/github.ts lines 47-128 — the GitHub App installation token cache uses module-level mutable state (installationTokenCache). The refreshIfNeeded() and getGitHubToken() functions are not mutex-protected. If two concurrent requests enter refreshIfNeeded() when the cache is near expiry, both could attempt to fetch a new token simultaneously, causing redundant API calls. In the worst case, a race condition during initial ensureInit() could leave useGitHubApp=false after a transient failure, silently falling back to PAT auth.
Matched top finding
Evidence:src/lib/github.ts lines 47-128 — the GitHub App installation token cache uses module-level mutable state (installationTokenCache). The refreshIfNeeded() and getGitHubToken() functions are not mutex-protected. If two concurrent requests enter refreshIfNeeded() when the cache is near expiry, both could attempt to fetch a new token simultaneously, causing redundant API calls. In the worst case, a race condition during initial ensureInit() could leave useGitHubApp=false after a transient failure, silently falling back to PAT auth.
Activity
itsmiso-ai commentedon Jul 3, 2026
This issue has detailed technical context, P1 priority, and clear code evidence. Ready to move from backlog to a claimable lane for implementation.
fix(github): serialize installation token refresh to avoid race
fix(github): serialize installation token refresh to avoid race