Retry current user request after failure - #8898
Merged
Merged
Conversation
Clear failed current-user and EMU promise caches so later GitHub operations can retry instead of replaying an activation-time network error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a reliability issue in the authentication hub where a failed currentUser request could be cached as a rejected promise and then immediately replayed for the rest of the session. The change clears the cached currentUser/isEmu promises when their shared request fails, so the next consumer triggers a fresh (deduplicated) request instead of reusing the stale failure.
Changes:
- Clear cached
currentUserandisEmupromises when the underlying shared request rejects, enabling on-demand retry. - Route current-user lookups through
GitHubRepository.getAuthenticatedUser()so callers benefit from the retry behavior. - Add a regression test covering “failure then successful retry” while preserving request deduplication.
Show a summary per file
| File | Description |
|---|---|
| src/github/credentials.ts | Implements retry-on-demand by clearing cached rejected promises and re-initializing shared currentUser/isEmu requests. |
| src/github/githubRepository.ts | Uses getAuthenticatedUser() when composing repo metadata to avoid reading a potentially stale cached promise directly. |
| src/gitProviders/GitHubContactServiceProvider.ts | Uses origin.getAuthenticatedUser() so contact-provider login lookup triggers retry behavior when needed. |
| src/test/github/credentials.test.ts | Adds a regression test ensuring the current-user request is retried after a transient failure and remains deduplicated. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
Alex Ross (alexr00)
marked this pull request as ready for review
August 27, 2026 09:54
Alex Ross (alexr00)
enabled auto-merge (squash)
August 27, 2026 09:54
Alex Ross (alexr00)
approved these changes
Aug 27, 2026
Martin Aeschlimann (aeschli)
approved these changes
Aug 27, 2026
This was referenced Aug 27, 2026
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
Retry the authenticated GitHub user request after a transient failure instead of retaining and replaying its rejected promise for the lifetime of the authentication hub.
Session Context
Key decisions from the development session:
github.currentUser. Because that promise stayed cached, later PR refreshes failed immediately with the original timeout even after other GitHub requests recovered.currentUserandisEmupromises are cleared together. The next consumer creates one new shared request, preserving request deduplication without adding an automatic retry loop.Changes
getCurrentUser,getIsEmu, orisCurrentUsercall.Evidence
The log showed only one current-user request during activation:
Hours later, PR initialization replayed that same failure within milliseconds while other GitHub requests succeeded:
Validation
npm test- 478 passingnpm run lintnpm run hygienegit diff --check