Harden GitHub auth context and cancel abandoned requests#71
Merged
Conversation
- Catch uncaught token refresh errors in getGitHubAppUserInstallations and getGitHubUserContextForOwner so a failed refresh falls back to the OAuth client instead of crashing the Worker - Eagerly verify installation auth in getGitHubContextForOwner since @octokit/auth-app authenticates lazily and the existing try/catch could never catch auth failures - Skip suspended GitHub App installations - Cache resolved GitHub contexts per-request (WeakMap<Request>) so parallel server functions reuse one session/installation lookup - Propagate the incoming HTTP request abort signal to GitHub API calls via AbortSignal.any so navigating away cancels in-flight work - Add debug() logging to the auth and context resolution flow
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
diffkit | 7fb0a0e | Commit Preview URL Branch Preview URL |
Apr 11 2026, 09:50 PM |
stylessh
added a commit
that referenced
this pull request
Apr 18, 2026
- Catch uncaught token refresh errors in getGitHubAppUserInstallations and getGitHubUserContextForOwner so a failed refresh falls back to the OAuth client instead of crashing the Worker - Eagerly verify installation auth in getGitHubContextForOwner since @octokit/auth-app authenticates lazily and the existing try/catch could never catch auth failures - Skip suspended GitHub App installations - Cache resolved GitHub contexts per-request (WeakMap<Request>) so parallel server functions reuse one session/installation lookup - Propagate the incoming HTTP request abort signal to GitHub API calls via AbortSignal.any so navigating away cancels in-flight work - Add debug() logging to the auth and context resolution flow
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
getGitHubAppUserInstallationsandgetGitHubUserContextForOwnerso a failed refresh gracefully falls back to the OAuth client instead of crashing the WorkergetGitHubContextForOwner—@octokit/auth-appauthenticates lazily so the existing try/catch could never catch auth failures on private reposfindGitHubAppInstallationForOwnerWeakMap<Request>so parallel server functions within a single request reuse one session/installation lookup instead of creating a new client per queryAbortSignal.anyso navigating away cancels in-flight work instead of letting abandoned requests hang the Workerdebug()logging throughout the auth and context resolution flow for visibilityTest plan