Skip to content

Add preconfigured Copilot PAT onboarding in gh aw add-wizard#45987

Merged
mnkiefer merged 10 commits into
mainfrom
copilot/add-preconfigured-copilot-authentication
Jul 16, 2026
Merged

Add preconfigured Copilot PAT onboarding in gh aw add-wizard#45987
mnkiefer merged 10 commits into
mainfrom
copilot/add-preconfigured-copilot-authentication

Conversation

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

add-wizard now supports a lower-friction Copilot auth setup when org billing is unavailable: it guides users to a prefilled fine-grained PAT page, accepts token input securely, and preserves strict token-format validation before storing COPILOT_GITHUB_TOKEN. It also keeps the org-billing path unchanged when copilot-requests auth is available.

  • Copilot PAT flow hardening

    • Added a dedicated preconfigured PAT creation URL generator for Copilot with:
      • token name prefilled to COPILOT_GITHUB_TOKEN
      • only Copilot Requests read permission requested
    • Keeps masked token entry (EchoModePassword) and existing github_pat_ validation semantics.
  • Advance-consent UX

    • Added an explicit “open browser now?” consent gate before attempting to launch the preconfigured PAT page.
    • If accepted, setup continues directly to token paste input without another confirmation gate.
    • If browser launch is unavailable, the wizard falls back to a manual URL path with clear guidance.
  • Docs and contract coverage

    • Updated CLI setup docs to reflect the new preconfigured PAT onboarding path.
    • Added focused unit coverage for the Copilot PAT URL contract (expected path/params, no unrelated permission params).
func buildCopilotPATCreationURL() string {
	const baseURL = "https://github.com/settings/personal-access-tokens/new"
	values := url.Values{}
	values.Set("name", constants.CopilotGitHubToken)
	values.Set("user_copilot_requests", "read")
	return baseURL + "?" + values.Encode()
}

Generated by 👨‍🍳 PR Sous Chef · 26.2 AIC · ⌖ 8.22 AIC · ⊞ 7.5K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 16, 2026 12:44
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category feature
Risk 🟢 Low
Score 18 (impact 10 + urgency 3 + quality 5)
Action defer

Rationale: DRAFT WIP — only 1 file changed (+7/-2) with a checklist; implementation not yet started. Defer until author completes the work and removes draft status.

Generated by 🔧 PR Triage Agent · 32.8 AIC · ⌖ 4.9 AIC · ⊞ 5.6K ·

@mnkiefer

Copy link
Copy Markdown
Collaborator

@copilot Revert changes to .github/workflows/cli-consistency-checker.lock.yml as they are unrelated to this PR.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add preconfigured Copilot authentication to gh aw add-wizard Add preconfigured Copilot PAT onboarding in gh aw add-wizard Jul 16, 2026
Copilot AI requested a review from mnkiefer July 16, 2026 13:02
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Revert changes to .github/workflows/cli-consistency-checker.lock.yml as they are unrelated to this PR.

Addressed in b1f3036.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @copilot-swe-agent 👋 — great work on the lower-friction Copilot auth setup in add-wizard! The preconfigured PAT URL generator with the consent gate is a clean UX improvement, and the changes are well-scoped across engine_secrets.go, its test file, and the docs update.

This PR looks ready for review — it's focused, includes tests, has a clear description, and adds no new dependencies. Nothing blocking here. ✅

Generated by ✅ Contribution Check · 100.5 AIC · ⌖ 8.71 AIC · ⊞ 6.2K ·

@mnkiefer
mnkiefer requested a review from Copilot July 16, 2026 14:41
@mnkiefer
mnkiefer marked this pull request as ready for review July 16, 2026 14:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds preconfigured Copilot PAT onboarding to add-wizard, alongside several unrelated Git/PR and tooling changes.

Changes:

  • Adds PAT URL generation, browser launch, validation, and secret replacement.
  • Updates Copilot billing behavior, tests, and documentation.
  • Changes PR branch handling and refreshes Serena configuration.
Show a summary per file
File Description
pkg/cli/pr_helpers.go Simplifies push error propagation.
pkg/cli/git.go Reuses existing local branches.
pkg/cli/git_test.go Tests branch reuse.
pkg/cli/engine_secrets.go Implements Copilot PAT onboarding and replacement.
pkg/cli/engine_secrets_test.go Tests PAT URL construction.
pkg/cli/copilot_billing_check.go Treats unknown billing states as inconclusive.
pkg/cli/copilot_billing_check_test.go Updates billing-state expectations.
pkg/cli/bootstrap_profile_runner.go Removes browser-disable override.
pkg/cli/bootstrap_profile_runner_test.go Expects browser opening to remain enabled.
pkg/cli/add_workflow_pr.go Filters existing workflows before PR creation.
pkg/cli/add_workflow_pr_test.go Tests workflow filtering and tracking.
pkg/cli/add_interactive_git.go Handles no-PR results.
pkg/cli/add_interactive_engine.go Explicitly selects PAT by default.
docs/src/content/docs/setup/cli.md Documents PAT onboarding.
docs/src/content/docs/reference/glossary.md Updates token glossary entry.
.serena/project.yml Refreshes Serena configuration.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 16/16 changed files
  • Comments generated: 6
  • Review effort level: Medium

Comment thread pkg/cli/engine_secrets.go Outdated
Comment thread pkg/cli/git.go Outdated
Comment thread pkg/cli/bootstrap_profile_runner_test.go Outdated
Comment thread pkg/cli/engine_secrets.go Outdated
Comment thread pkg/cli/engine_secrets.go
Comment thread pkg/cli/add_workflow_pr.go Outdated
@mnkiefer

Copy link
Copy Markdown
Collaborator

@copilot Address all open review comments and run the pr-finisher skill.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the unresolved review feedback below, fix the failing checks, and rerun CI once the branch is up to date.

Unresolved review threads:

Failed checks:

Generated by 👨🍳 PR Sous Chef
Comment /souschef to run again

Generated by 👨‍🍳 PR Sous Chef · 26.2 AIC · ⌖ 8.22 AIC · ⊞ 7.5K ·
Comment /souschef to run again

- Add explicit consent gate before browser open in promptForCopilotPATUnified
- Revert unsafe branch reuse: restore createAndSwitchBranch to fail on existing branch
- Restore GH_AW_BOOTSTRAP_NO_OPEN_BROWSER env override and parseBootstrapBool
- Use constants.CopilotGitHubToken as PAT name in buildCopilotPATCreationURL
- Add injectable engineSecretsPromptFn/engineSecretsUploadFn for testability
- Add TestEnsureSecretAvailable_CopilotRepromptsWithOverwrite coverage
- Revert unrelated filterExistingWorkflowsForPR behavior change in add_workflow_pr

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
@mnkiefer
mnkiefer merged commit 117acb7 into main Jul 16, 2026
@mnkiefer
mnkiefer deleted the copilot/add-preconfigured-copilot-authentication branch July 16, 2026 15:26
Copilot stopped work on behalf of mnkiefer due to an error July 16, 2026 15:26
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add preconfigured Copilot authentication to gh aw add-wizard

4 participants