Skip to content

feat(copilot): use copilot-cli integration ID when authenticating with user PAT#37986

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/override-copilot-integration-id
Closed

feat(copilot): use copilot-cli integration ID when authenticating with user PAT#37986
Copilot wants to merge 1 commit into
mainfrom
copilot/override-copilot-integration-id

Conversation

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

When AWF uses COPILOT_GITHUB_TOKEN (user PAT), GITHUB_COPILOT_INTEGRATION_ID was always set to agentic-workflows. This is wrong for PAT auth — the Copilot SDK expects copilot-cli in that case.

Changes

  • pkg/constants/engine_constants.go: Add CopilotCLIIntegrationIDUserPATValue = "copilot-cli" constant alongside the existing agentic-workflows value.
  • pkg/workflow/copilot_engine_execution.go: Branch integration ID selection on auth mode after all env merges:
    • User PAT (!isBYOKMode && !useCopilotRequests) → "copilot-cli"
    • GitHub Actions token (copilot-requests: write) or BYOK → "agentic-workflows"
  • pkg/workflow/copilot_engine_test.go: Update existing integration ID assertions for the PAT case; add TestCopilotEngineExecutionStepsWithCopilotRequestsUsesAgenticWorkflowsIntegrationID to cover the copilot-requests: write path.
  • Golden files: Regenerated to reflect the updated env var value in compiled workflow output.
integrationIDValue := constants.CopilotCLIIntegrationIDValue // "agentic-workflows"
if !isBYOKMode && !useCopilotRequests {
    integrationIDValue = constants.CopilotCLIIntegrationIDUserPATValue // "copilot-cli"
}
env[constants.CopilotCLIIntegrationIDEnvVar] = integrationIDValue

When COPILOT_GITHUB_TOKEN (user PAT) is used for authentication — i.e.
not in BYOK mode and not using the GitHub Actions token via
permissions.copilot-requests: write — set GITHUB_COPILOT_INTEGRATION_ID
to "copilot-cli" (the copilot-sdk integration ID) instead of the AWF
default "agentic-workflows".

When using the GitHub Actions token (copilot-requests: write), keep
the existing "agentic-workflows" integration ID.

Adds CopilotCLIIntegrationIDUserPATValue constant and a new test
TestCopilotEngineExecutionStepsWithCopilotRequestsUsesAgenticWorkflowsIntegrationID.
Updates golden files and existing tests accordingly.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title feat: use copilot-cli integration ID when using user PAT feat(copilot): use copilot-cli integration ID when authenticating with user PAT Jun 9, 2026
Copilot AI requested a review from pelikhan June 9, 2026 01:29
@pelikhan

pelikhan commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot update the integration id env variable NAME to match the one used by copilot-cli

@pelikhan pelikhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot set the integration id env var in the BYOK mode as well

@pelikhan pelikhan closed this Jun 9, 2026
Copilot stopped work on behalf of pelikhan due to an error June 9, 2026 01:42
Copilot AI requested a review from pelikhan June 9, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants