Repository navigation
factory: connect the first run's GitHub in the browser (device flow) - #2494
Merged
Merged
Conversation
…e flow
factory.setup_github_{start,poll,cancel} run GitHub's OAuth device flow for
the factory on this machine. The granted token takes the pasted token's own
connect and is handed back once as github_token for the app's Keychain.
The OAuth client ID is stamped at build time (CODEAF_GITHUB_CLIENT_ID) or set
at run time; a build without one leaves the verb off the wire.
Opt-in (CODEAF_LIVE_GITHUB_SIGNIN=1, a mode-600 token file): the real wire and device client against a loopback stand-in for github.com/login, then the real GitHub for the connect. Asserts the account, zero writes, the token said once on the wire and written to no file.
santoshkumarradha
marked this pull request as ready for review
November 7, 2026 11:46
santoshkumarradha
added a commit
that referenced
this pull request
Nov 7, 2026
…2501) * config: list the GitHub sign-in's two variables as operator plumbing TestRegistryCoversEveryUserFacingEnvironmentPin failed on factory/general-intake since the browser sign-in landed (#2494): CODEAF_GITHUB_CLIENT_ID and CODEAF_GITHUB_LOGIN_URL are read in internal/factory/github but were neither a settings row nor on the operator allowlist. Both are build or test plumbing, not preferences, so they join OperatorEnvPins. * changes: entry for #2501
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.
The app's first run can now connect GitHub in the browser with GitHub's OAuth device flow. The person sees a one-time code, approves on github.com/login/device, and setup moves on by itself. Owner's rule (2026-11-07): WorkAF users never think about code. Desk half: Agent-Field/codeaf-desk#281.
Wire
factory.setup_github_start {caller}→FactorySignIn, the shapefactory.sign_in_startanswers. GitHub's device code stays in the engine.factory.setup_github_poll {flow, caller}→{state: pending|signed_in|expired|denied, interval?, message?, github_token?, view?}.slow_downraises the interval.FactorySetupActconnect, source token), so there is no second credential store.signed_inanswer then carriesgithub_tokenonce, for the app's Keychain, which is where a pasted token is kept. It is the only setup answer that carries a secret.factory.setup_github_cancel {flow, caller}.factory.setup_github, announced only when the build names an OAuth app. Absent, not broken: without one the methods areunknown_method.Client ID and scope
make build|app-sidecar CODEAF_GITHUB_CLIENT_ID=Ov23…;release.ymlreads the repository variablevars.CODEAF_GITHUB_CLIENT_ID), or set at run time fromCODEAF_GITHUB_CLIENT_ID. Verified with-ldflags -X.repoonly. It is the one classic scope that reads issues, comments, pushes a branch and opens a PR on a private repository; classic OAuth has nothing narrower for private repos.GET /userneeds no scope.workflow. A job whose change edits.github/workflows/*will be refused on push.CODEAF_GITHUB_LOGIN_URLpoints the device calls at a stand-in, and must be https or loopback http.Also in this PR
docs/changes/unreleased/2494-factory-github-browser-sign-in.md.Proof
TestSetupGitHub*(3), the real wire on a fake GitHub:not_found;TestDevice*: the loopback/https rule, the client ID run-time-over-build-time order, and every GitHub answer.make test-touched BASE=origin/factory/general-intake: exit 0.cmd/codeaf, 8 shards:TestFactoryRetryActionsDoNotReportStopped/try_againfailed once and passed on rerun, so it is reported flaky. This change does not touch it.appwire,factory/githubandmanual: ok.make test-quick: ok.test-tooling(pulled in by the Makefile edit):scripts/one-suite_test.shhangs on this laptop becausebwrapcannot map user namespaces here. My Makefile change only adds the-Xstamp.-tags e2e,TestLiveBrowserSignInConnectsTheRealAccount, opt-in):🤖 Generated with Claude Code