Skip to content

Add @app/copilot-swe-agent as a copilot bot alias#34136

Merged
pelikhan merged 3 commits into
mainfrom
copilot/add-alias-for-copilot-bot
May 22, 2026
Merged

Add @app/copilot-swe-agent as a copilot bot alias#34136
pelikhan merged 3 commits into
mainfrom
copilot/add-alias-for-copilot-bot

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

@app/copilot-swe-agent is a valid GitHub App slug for the Copilot Coding Agent but wasn't recognized as a copilot alias — users specifying it in a bot list got no expansion.

Changes

  • pkg/workflow/bot_aliases.go: Replaced the hardcoded b == "copilot" string check with a copilotAliases map that includes both "copilot" and "@app/copilot-swe-agent". Both aliases now expand to the same copilotBotNames set.

  • pkg/workflow/bot_aliases_test.go: Added cases for @app/copilot-swe-agent standalone, mixed with other bots, and combined with copilot (deduplication).

bots:
  - "@app/copilot-swe-agent"  # now expands to copilot-swe-agent, Copilot, copilot

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add @app/copilot-swe-agent as alias for the copilot bot Add @app/copilot-swe-agent as a copilot bot alias May 22, 2026
Copilot AI requested a review from pelikhan May 22, 2026 23:06
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot centralize all the bot aliases in constants.go (there's definitely another place with copilot bot aliases)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 22, 2026

@copilot centralize all the bot aliases in constants.go (there's definitely another place with copilot bot aliases)

Done in the latest commit. CopilotBotNames and CopilotBotAliases are now exported from a new pkg/constants/bot_constants.go file, and pkg/workflow/bot_aliases.go references them from there. Any other package that needs these identifiers can now import them directly from pkg/constants without depending on pkg/workflow.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot unify CopilotBotAliases and CopilotBotNames into a single list

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 22, 2026

@copilot unify CopilotBotAliases and CopilotBotNames into a single list

Done. CopilotBotAliases is removed — CopilotBotNames in pkg/constants/bot_constants.go is now the single list containing all Copilot identifiers (runtime logins + input aliases). expandBotNames builds a set from that list at init and expands any matching entry to the full list.

@pelikhan pelikhan marked this pull request as ready for review May 22, 2026 23:39
Copilot AI review requested due to automatic review settings May 22, 2026 23:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to recognize @app/copilot-swe-agent as a valid Copilot bot alias so that workflows specifying it in on.bots/on.skip-bots get expanded to the full Copilot bot allowlist used by the compiled workflow’s permission checks.

Changes:

  • Introduces pkg/constants.CopilotBotNames to centralize the Copilot-related identifiers.
  • Updates bot expansion logic to expand Copilot-related entries when compiling workflow bot allowlists.
  • Extends tests to cover @app/copilot-swe-agent scenarios and compiled workflow output.
Show a summary per file
File Description
pkg/workflow/bots_test.go Updates compiled-workflow assertion for Copilot bot allowlist expansion.
pkg/workflow/bot_aliases.go Reworks Copilot bot expansion logic to use a constant-backed lookup set.
pkg/workflow/bot_aliases_test.go Adds/updates unit tests for new Copilot alias expansion behavior.
pkg/constants/bot_constants.go Adds a canonical Copilot identifier list used by expansion logic.

Copilot's findings

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 5

Comment on lines +18 to +20
// expandBotNames expands any entry found in constants.CopilotBotNames to the
// full set of Copilot identifiers. Other entries are passed through unchanged.
// Duplicates are removed from the result.
Comment on lines +8 to +16
// copilotBotSet is a fast-lookup set built from constants.CopilotBotNames.
// Any entry in this set triggers expansion to the full CopilotBotNames list.
var copilotBotSet = func() map[string]bool {
set := make(map[string]bool, len(constants.CopilotBotNames))
for _, name := range constants.CopilotBotNames {
set[name] = true
}
return set
}()
Comment on lines +3 to +15
// CopilotBotNames is the canonical list of all GitHub identifiers associated
// with the Copilot family — both runtime bot logins and recognized input aliases.
// When any entry from this list appears in a workflow's bots field, it is
// expanded to the entire set:
//
// - "copilot-swe-agent" — Copilot Coding Agent runtime login (actor: copilot-swe-agent[bot])
// - "Copilot" — @Copilot interactive bot (actor: Copilot)
// - "copilot" — base copilot bot form + canonical shorthand alias (actor: copilot[bot])
// - "@app/copilot-swe-agent" — GitHub App slug alias for the Copilot Coding Agent
var CopilotBotNames = []string{
"copilot-swe-agent",
"Copilot",
"copilot",
Comment on lines +40 to 44
{
name: "copilot-swe-agent expands to all copilot bot names",
input: []string{"copilot-swe-agent"},
expected: []string{"copilot-swe-agent", "Copilot", "copilot", "@app/copilot-swe-agent"},
},
Comment thread pkg/workflow/bots_test.go
Comment on lines +325 to 327
// The "copilot" alias must be expanded to all Copilot bot identities
assert.Contains(t, lockStr, `GH_AW_ALLOWED_BOTS: "copilot-swe-agent,Copilot,copilot,@app/copilot-swe-agent"`,
`Expected compiled workflow to expand "copilot" alias to all Copilot bot identifiers`)
@pelikhan pelikhan merged commit bc15a18 into main May 22, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/add-alias-for-copilot-bot branch May 22, 2026 23:54
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.

3 participants