Repository navigation
feat(github): connect with a personal access token, not only the App - #292
Merged
Merged
Conversation
GitHub connect was GitHub App only, so anyone who cannot install an app — a local deployment with no GITHUB_APP_*, no org-admin rights, no host github.com can call back — could not connect GitHub or attach a repo at all. GitLab has had in-app PAT connect all along; Azure DevOps has App vs PAT. GitHub now has the same choice, with the App still recommended and still the default. Connect → GitHub opens a dialog with the two modes instead of redirecting straight to the install. The App path is unchanged: signed state, install callback, installation_id. The PAT path posts the token to the project integrations endpoint, verifies it against GET /user, and stores it encrypted, write-only. Github::TokenService now carries both credential shapes behind the same two methods: in PAT mode the stored token IS the credential, so nothing is minted and `repositories:` cannot narrow it — the App installation-token path is never walked with a PAT. Every consumer (clone, refresh, tools, CI status, Coder bootstrap) is unchanged as a result. Github::RepositoryService asks /user/repos instead of /installation/repositories, which a token cannot read. Repository's owner-must-match-the-installation-account check is now App-only: a PAT reaches every repository its owner can see across every org, so checking the owner against the token holder's login would refuse exactly the org repositories the token was pasted for. Existing App connections need no migration — a connection with no `auth_mode` in settings reads as "app", which is what they are. Out of scope, and said so in the UI and the docs: GitHub delivers no webhooks to a token, so CI gates on a PAT connection resolve through the reconciler's polling rather than a push/pull_request/check_run event. No App-only event is faked. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
artempartos
force-pushed
the
feat/github-pat-connect
branch
from
September 18, 2026 00:44
c509431 to
0e11237
Compare
The two connect modes, a rejected token, a deployment with no App, and what a token connection reads as afterwards. Captured against a local deployment; the rejected-token shot is a real 401 from api.github.com. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
The dialog and the docs listed `Contents` + `Metadata` for a fine-grained token, which covers cloning and pushing and nothing else. Three capabilities the app does use were missing, and each fails on its own rather than failing the connection, so the omission surfaced as a working connection that could not do one specific thing: - `Pull requests` write — an agent opens and answers PRs itself, with `gh` or the API, on this token. There are no server-side GitHub PR tools, so this is the only grant behind that. - `Checks` + `Actions` read — Github::CheckStatusService reads `pull_request`, `check_suites_for_ref` and `workflow_run` to resolve CI gates, which is the polling path a token connection depends on precisely because it gets no webhooks. - `workflow` on a classic token — GitHub rejects a push that touches `.github/workflows` without it. Also says outright that Aixle's own board tasks, workflows and sessions are not GitHub objects and need no scope, since that is the next question. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
The three shots that show the token panel carried the old copy, which named two of the five grants. Retaken from the branch as it stands. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
artempartos
added a commit
that referenced
this pull request
Sep 18, 2026
Six PNGs sat in the tree that nothing in it references. `01-admin-projects-single-company.png` has been at the repository root since 48c15ea, unreferenced — a screenshot that escaped into the commit rather than into a pull request. `docs/design/images/github-pat-connect/` (5 files, #292) backed that pull request's description and no document, which is the difference from `docs/design/images/federated-identity/` on the open #288 branch: those are embedded in `docs/design/federated-identity.md` with relative links, so they are the document's own assets and stay. #292's description now points at its merge commit rather than at its branch, so the screenshots keep rendering from history after both this removal and the branch's eventual deletion. Verified: all five answer 200. Signed-off-by: Artem Petrov <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
…ide old trigger links (#292) Signed-off-by: Alex <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
Signed-off-by: Alex <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
…esource (#292) Signed-off-by: Alex <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
Signed-off-by: Alex <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
…292) Signed-off-by: Alex <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
Signed-off-by: Alex <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Dec 1, 2026
…ened through the tools (#292) (#940) * feat(board): a Pull requests section with the pull requests agents opened through the tools (#292) Signed-off-by: Alex <[email protected]> * style: format the pull requests section Signed-off-by: Aixle Flow <[email protected]> Signed-off-by: Alex <[email protected]> * test: read the section key indifferently (#292) Signed-off-by: Alex <[email protected]> * refactor(board): serialize a pull request link with ExternalResourceResource (#292) Signed-off-by: Alex <[email protected]> * fix(board): declare the id, url and key attributes without blocks (#292) Signed-off-by: Alex <[email protected]> * fix(board): read the listed pull requests as the association source (#292) Signed-off-by: Alex <[email protected]> * chore(types): regenerate the TypeScript types with typelizer (#292) Signed-off-by: Alex <[email protected]> --------- Signed-off-by: Alex <[email protected]> Signed-off-by: Aixle Flow <[email protected]> Co-authored-by: Alex <[email protected]>
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.
Closes the "GitHub integration: Personal Access Token setup path for local / developer try-out" task.
Problem
GitHub connect was GitHub App only.
Connect → GitHubwent straight togithub_app_install, which needs a configured App on the deployment (GITHUB_APP_ID, private key, webhook secret, public Setup URL), someone who can install it on the org, and a host github.com can call back. A local or personal-account setup has none of that, so a developer could not connect GitHub, attach a repo, or run a workflow against real GitHub code at all. GitLab has had in-app PAT connect all along; Azure DevOps has App vs PAT.What this adds
Connect → GitHubnow opens a dialog with two modes instead of redirecting:The App stays the default. On a deployment with no App configured the dialog opens on the token path and the App radio is disabled with the reason, rather than offering a button whose only outcome is "GitHub App is not configured" (the page gets a
github: { appConfigured: }prop for this).Backend
Github::TokenServicecarries both credential shapes behind the same two methods. In PAT mode the stored token is the credential: nothing is minted,repositories:cannot narrow it, and the App installation-token path is never walked with a PAT. Every consumer — clone,refresh_github_token, toolGITHUB_TOKEN, CI status probe, Coder bootstrap — is unchanged as a result.verify_tokenverifies againstGET /userand readsX-OAuth-Scopesoff the same response. A classic token with neitherreponorpublic_repois refused at connect time rather than failing later at clone time; a fine-grained token reports no scopes, so it is accepted on the call succeeding.Github::IntegrationService#create_with_patstores the token encrypted withauth_mode: "pat"in settings. A token that does not verify is not persisted — an unverified token repairs by being pasted again, so a saved row would only be litter with a dead secret in it. Re-pasting replaces the token on the project's existing PAT row (keeping its attached repositories) and a rejected re-paste leaves the working connection completely untouched.Github::RepositoryService#list_availableasks/user/reposin PAT mode;/installation/repositoriesrefuses a token with 403.Repository's owner-must-match-the-installation-account check is now App-only. A PAT reaches every repository its owner can see across every org, so checking the owner against the token holder's own login would refuse exactly the org repositories the token was pasted for.Migration
None. A GitHub connection with no
auth_modein settings reads as"app", which is what every existing one is.Deliberately not done
GitHub delivers no webhooks to a token, and a local deployment is usually unreachable from github.com anyway. CI gates on a PAT connection therefore resolve through
GateReconciler's polling rather than apush/pull_request/check_runevent — stated in the dialog and in the docs, with no App-only event faked. Also out: replacing the App in production, company-wide GitHub, per-capability checkboxes, GitHub Enterprise Server.What it looks like
Image URLs are pinned to this PR's merge commit: the screenshots were dropped from the
tree afterwards (they backed this description, not any document), and a commit-pinned blob
keeps rendering regardless.
Choosing how to connect
Opening Connect → GitHub now asks which path, rather than leaving for
github.com immediately. The App is marked Recommended and preselected; the token
option says what it is for in the same breath, so nobody has to guess which one
they are entitled to.
The token panel carries the three things that are easy to get wrong: that the
token acts as its owner and receives no webhooks, which scopes are needed for a
classic versus a fine-grained token, and that expiry is answered by pasting a
new one. The link pre-ticks
repoon GitHub's own token form.A token GitHub rejects
Verification happens before anything is stored, so an invalid, revoked or expired
token never produces an
activeintegration. The reason lands against the fieldand the dialog keeps what was typed — a flash alert would have closed it. The
count in the header is unchanged behind the dialog: nothing was persisted.
A deployment with no GitHub App
The case the whole change exists for. Both modes are still shown — the App is not
hidden, it is disabled and says which variables are missing — and the dialog
opens on the path that can actually complete.
Afterwards
A token connection is marked as one on the row, with whose token it is and the
scopes GitHub reported. Both facts matter when a gate does not close: it acts as
a person, and it gets no webhooks.
Tests
Github::TokenService— PAT contract tests againstGET /user(identity, classic scopes, fine-grained nil scopes, scopeless refusal, 401, works with no App id).Github::IntegrationService— PAT connect, fine-grained token, no-App deployment, rejected token persists nothing, re-paste replaces in place, rejected re-paste leaves the row intact, App row untouched.Github::RepositoryService—/user/reposand branch listing authenticate with the stored token.Integration/Repositorymodels — auth-mode defaulting and the App-only owner check.appConfiguredprop, PAT connect without an App, the field error, and the mode ignoring a posted installation id.GithubConnectModal.test.tsx— both modes, what each submits, that switching mode does not carry the other credential, the disabled App path, scopes copy, and the warning.Checks
be_check_allandfe_check_allare green on CI (rails test, rubocop, brakeman, eslint, tsc, steiger, vitest). Two things CI caught on the first push and are fixed here: a PAT branch-listing stub that did not account forauto_paginate'sper_page=100, and sevenMinitest/RefutePredicateoffenses.The screenshots above were taken against a local deployment built from this
branch; the rejected-token one is a real 401 from api.github.com.
Docs
docs/user-guide/integrations.md(+ the portal copy) now documents both paths, the scopes for classic and fine-grained tokens, expiry, and the webhook gap.docs/quickstart.mdanddocs/reference/configuration.md(+ portal copies) say theGITHUB_APP_*variables are not needed to connect GitHub.🤖 Generated with Claude Code