Repository navigation
feat: sign in to GitHub through the T3 Code for GitHub app [internal testing only] - #26245
Merged
Merged
Conversation
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.
GitHub requests from T3 Code share the user's personal 5,000/hr API limit with everything else they run, so busy days stall PR status and reviews. A GitHub App owned by an Enterprise Cloud org gets a higher per-user limit, so this adds an optional way to sign in through the T3 Code for GitHub app.
How it works
GH_TOKENand theghlogin. The order is: saved token, then the app sign-in, thenGH_TOKEN, thengh. Nothing changes for anyone who doesn't sign in.sourceControl.signInStart/signInWait/signInCancel), so it works over remote, relay and tunnel, and on a phone that leaves the app to approve.signIns) next to the saved tokens, so it uses the same secret store and redaction. Tokens refresh 5 minutes before they expire, and concurrent requests share one refresh. If GitHub rejects the refresh token, the server signs out and falls back toGH_TOKEN/gh. Sign out clears the setting.GitHubRequestPolicy: a saved token, then the app, thenGH_TOKEN/gh. When the app token gets not found or "not accessible by integration" (REST 404/403, GraphQLNOT_FOUND/FORBIDDEN), the request is asked once more with the user's own credential, so repositories the app isn't installed on keep working. Work pinned to one credential (routing, stack pushes) picks one that reaches its repository up front.GitHubAppAccessreads the app's installations and signed-in login throughGitHubRestwith the app credential pinned, so they share the quota, pause and concurrency of every other GitHub request.sourceControl.appAccess).gh. Agents get no sign-in tool, because approving needs a person in a browser.Screenshots
Settings → Source Control → GitHub, signed out, entering the code, signed in, and a failed attempt (dark):
The PR view and a fresh clone, for a repo the app isn't installed on:
Verification
ghfallback.GitHubAppSignIn.test.tscover: the device flow (pending, slow down, success, denied, expired, unsupported host); refresh (shared, after a rejected token, refresh token rejected, network failure); credential order; credential choice by installation coverage; and repo detection fromrepositoryand from a checkout's remote. Also added: tests for the remote parsing behind the clone toast.vp run check:changedpasses (format, lint, knip, typecheck of 32 packages, tests).Notes for review
scopeMethodsToRepository(GitHubRequestPolicy.ts) wraps the GitHub providers' methods so each call runs in its repository's scope. It is generic, so one Effect diagnostic is suppressed on the line that forwards each method's effect. The typed alternative is wrapping about 35 methods by hand.Built with Claude Opus 5.5 in Claude Code, driven from T3 Code.
🤖 Generated with Claude Code