Simplify assign-to-agent flow to issue assignee REST APIs with canonical bot login resolution#41524
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request refactors the assign_to_agent workflow to stop using agent task APIs and instead assign Copilot by mutating issue assignees via issue-scoped REST endpoints, while also standardizing Copilot alias resolution to prefer canonical [bot] logins.
Changes:
- Prefer canonical Copilot
[bot]aliases (e.g.,copilot-swe-agent[bot]) and switch caching/matching to login-based behavior. - Replace agent task creation with issue-scoped assignee checks and direct assignee mutation (
GET .../assignees/{assignee}+POST .../assignees). - Update JS tests to validate the new REST routes, alias preference, and revised error behavior.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/assign_to_agent.cjs | Switches from agent-ID/task APIs to login-based assignment and alias-aware “already assigned” checks. |
| actions/setup/js/assign_to_agent.test.cjs | Updates expectations for direct issue-assignee REST calls and revised 502 handling. |
| actions/setup/js/assign_agent_helpers.cjs | Implements issue-scoped assignee validation and direct assignee mutation; updates alias ordering. |
| actions/setup/js/assign_agent_helpers.test.cjs | Adjusts helper tests for login-based resolution and issue-scoped REST behavior. |
| .github/mcp.json | Minor formatting/compaction of MCP server config. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
actions/setup/js/assign_agent_helpers.cjs:92
- The doc comment says this helper "falls back to repository-scoped checks", but
validateAssigneeAliasnow only uses the issue-scoped assignee endpoint and will fail without a valid issue/PR number. Updating the comment avoids misleading future callers.
/**
* Return list of coding agent bot login names that are currently available as assignable actors
* in this repository, preferring issue-scoped checks when issue/PR context is available
* and falling back to repository-scoped checks.
- Files reviewed: 5/5 changed files
- Comments generated: 2
| /** | ||
| * Start an agent task for issue or pull request context using REST | ||
| * @param {string} assignableId - Synthetic target ID in format owner/repo#issue:N or owner/repo#pull:N | ||
| * @param {string} agentId - Agent login name | ||
| * @param {string} agentLogin - Agent login name | ||
| * @param {Array<{id: string, login: string}>} currentAssignees - List of current assignees with id and login |
| * @param {string} agentName - Agent name (copilot) | ||
| * @param {number|string|null} [issueNumber] - Optional issue/PR number for issue-scoped assignability check | ||
| * @param {Object} [githubClient] - Authenticated GitHub client (defaults to global github) |
|
@copilot link to the official documentation from the docs and the core.info logs and the generated acction failure issue: In particular, help about minting the token: |
|
@copilot update the agent login list to start with |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. Updated in commits
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. |
|
@copilot review all comments and address unresolved review feedback. Please also summarize the remaining blockers in a brief progress update.
|
…nees REST routes Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in the latest commit. |
This updates
assign_to_agentto resolve Copilot through canonical aliases inAGENT_LOGIN_NAMES(favoring[bot]logins) and to stop using agent task APIs. Assignment now uses issue-scoped REST checks and direct issue assignee mutation as requested.Alias resolution and canonical bot login
[bot]aliases (notablycopilot-swe-agent[bot]) inAGENT_LOGIN_NAMES.Issue-scoped assignability check
GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee}Direct issue assignment (no task API)
POST /repos/{owner}/{repo}/issues/{issue_number}/assigneesassignees[].Error guidance and behavior alignment
Test updates
[bot]alias preference,