From 448261f62db3d8f8dabbd6fc6212d3d1a7565e8c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Dec 2025 16:17:04 +0000 Subject: [PATCH 1/2] Initial plan From 43652a7b8a2fc769bf65d536bc8e3ecf8e26f2fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Dec 2025 16:34:25 +0000 Subject: [PATCH 2/2] fix: Use correct GraphQL API field names for agent assignment (agentAssignment, baseRef) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/ai-triage-campaign.lock.yml | 30 +++++++------- .../breaking-change-checker.lock.yml | 28 ++++++------- .github/workflows/dev.lock.yml | 30 +++++++------- .../duplicate-code-detector.lock.yml | 28 ++++++------- .github/workflows/issue-monster.lock.yml | 30 +++++++------- pkg/workflow/js/assign_agent_helpers.cjs | 40 +++++++++---------- pkg/workflow/js/assign_agent_helpers.test.cjs | 8 ++-- pkg/workflow/js/assign_to_agent.cjs | 2 +- 8 files changed, 98 insertions(+), 98 deletions(-) diff --git a/.github/workflows/ai-triage-campaign.lock.yml b/.github/workflows/ai-triage-campaign.lock.yml index d5d71a58af..fde5b678c2 100644 --- a/.github/workflows/ai-triage-campaign.lock.yml +++ b/.github/workflows/ai-triage-campaign.lock.yml @@ -5193,30 +5193,30 @@ jobs: actorIds.push(assigneeId); } } - const hasCopilotOptions = options.targetRepositoryId || options.baseBranch || options.customInstructions || options.customAgent; + const hasAgentOptions = options.targetRepositoryId || options.baseRef || options.customInstructions || options.customAgent; try { core.info("Using built-in github object for mutation"); let response; - if (hasCopilotOptions) { - const copilotOptions = {}; + if (hasAgentOptions) { + const agentAssignment = {}; if (options.targetRepositoryId) { - copilotOptions.targetRepositoryId = options.targetRepositoryId; + agentAssignment.targetRepositoryId = options.targetRepositoryId; } - if (options.baseBranch) { - copilotOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + agentAssignment.baseRef = options.baseRef; } if (options.customInstructions) { - copilotOptions.customInstructions = options.customInstructions; + agentAssignment.customInstructions = options.customInstructions; } if (options.customAgent) { - copilotOptions.customAgent = options.customAgent; + agentAssignment.customAgent = options.customAgent; } const extendedMutation = ` - mutation($assignableId: ID!, $actorIds: [ID!]!, $copilotAssignmentOptions: CopilotAssignmentOptionsInput) { + mutation($assignableId: ID!, $actorIds: [ID!]!, $agentAssignment: AgentAssignmentInput) { replaceActorsForAssignable(input: { assignableId: $assignableId, actorIds: $actorIds, - copilotAssignmentOptions: $copilotAssignmentOptions + agentAssignment: $agentAssignment }) { __typename } @@ -5225,9 +5225,9 @@ jobs: const mutationInput = { assignableId: issueId, actorIds: actorIds, - copilotAssignmentOptions: copilotOptions, + agentAssignment: agentAssignment, }; - core.debug(`GraphQL mutation with Copilot options: ${JSON.stringify(mutationInput)}`); + core.debug(`GraphQL mutation with agent assignment: ${JSON.stringify(mutationInput)}`); response = await github.graphql(extendedMutation, mutationInput, { headers: { "GraphQL-Features": "issues_copilot_assignment_api_support", @@ -5403,8 +5403,8 @@ jobs: } } } - if (options.baseBranch) { - assignmentOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + assignmentOptions.baseRef = options.baseRef; } if (options.customInstructions) { assignmentOptions.customInstructions = options.customInstructions; @@ -5551,7 +5551,7 @@ jobs: } } if (item.base_branch) { - assignmentOptions.baseBranch = item.base_branch; + assignmentOptions.baseRef = item.base_branch; core.info(`Base branch: ${item.base_branch}`); } if (item.custom_instructions) { diff --git a/.github/workflows/breaking-change-checker.lock.yml b/.github/workflows/breaking-change-checker.lock.yml index 3fdf9197b2..df616d85a4 100644 --- a/.github/workflows/breaking-change-checker.lock.yml +++ b/.github/workflows/breaking-change-checker.lock.yml @@ -6397,30 +6397,30 @@ jobs: actorIds.push(assigneeId); } } - const hasCopilotOptions = options.targetRepositoryId || options.baseBranch || options.customInstructions || options.customAgent; + const hasAgentOptions = options.targetRepositoryId || options.baseRef || options.customInstructions || options.customAgent; try { core.info("Using built-in github object for mutation"); let response; - if (hasCopilotOptions) { - const copilotOptions = {}; + if (hasAgentOptions) { + const agentAssignment = {}; if (options.targetRepositoryId) { - copilotOptions.targetRepositoryId = options.targetRepositoryId; + agentAssignment.targetRepositoryId = options.targetRepositoryId; } - if (options.baseBranch) { - copilotOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + agentAssignment.baseRef = options.baseRef; } if (options.customInstructions) { - copilotOptions.customInstructions = options.customInstructions; + agentAssignment.customInstructions = options.customInstructions; } if (options.customAgent) { - copilotOptions.customAgent = options.customAgent; + agentAssignment.customAgent = options.customAgent; } const extendedMutation = ` - mutation($assignableId: ID!, $actorIds: [ID!]!, $copilotAssignmentOptions: CopilotAssignmentOptionsInput) { + mutation($assignableId: ID!, $actorIds: [ID!]!, $agentAssignment: AgentAssignmentInput) { replaceActorsForAssignable(input: { assignableId: $assignableId, actorIds: $actorIds, - copilotAssignmentOptions: $copilotAssignmentOptions + agentAssignment: $agentAssignment }) { __typename } @@ -6429,9 +6429,9 @@ jobs: const mutationInput = { assignableId: issueId, actorIds: actorIds, - copilotAssignmentOptions: copilotOptions, + agentAssignment: agentAssignment, }; - core.debug(`GraphQL mutation with Copilot options: ${JSON.stringify(mutationInput)}`); + core.debug(`GraphQL mutation with agent assignment: ${JSON.stringify(mutationInput)}`); response = await github.graphql(extendedMutation, mutationInput, { headers: { "GraphQL-Features": "issues_copilot_assignment_api_support", @@ -6607,8 +6607,8 @@ jobs: } } } - if (options.baseBranch) { - assignmentOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + assignmentOptions.baseRef = options.baseRef; } if (options.customInstructions) { assignmentOptions.customInstructions = options.customInstructions; diff --git a/.github/workflows/dev.lock.yml b/.github/workflows/dev.lock.yml index 1daee11936..eac6d1ca53 100644 --- a/.github/workflows/dev.lock.yml +++ b/.github/workflows/dev.lock.yml @@ -4494,30 +4494,30 @@ jobs: actorIds.push(assigneeId); } } - const hasCopilotOptions = options.targetRepositoryId || options.baseBranch || options.customInstructions || options.customAgent; + const hasAgentOptions = options.targetRepositoryId || options.baseRef || options.customInstructions || options.customAgent; try { core.info("Using built-in github object for mutation"); let response; - if (hasCopilotOptions) { - const copilotOptions = {}; + if (hasAgentOptions) { + const agentAssignment = {}; if (options.targetRepositoryId) { - copilotOptions.targetRepositoryId = options.targetRepositoryId; + agentAssignment.targetRepositoryId = options.targetRepositoryId; } - if (options.baseBranch) { - copilotOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + agentAssignment.baseRef = options.baseRef; } if (options.customInstructions) { - copilotOptions.customInstructions = options.customInstructions; + agentAssignment.customInstructions = options.customInstructions; } if (options.customAgent) { - copilotOptions.customAgent = options.customAgent; + agentAssignment.customAgent = options.customAgent; } const extendedMutation = ` - mutation($assignableId: ID!, $actorIds: [ID!]!, $copilotAssignmentOptions: CopilotAssignmentOptionsInput) { + mutation($assignableId: ID!, $actorIds: [ID!]!, $agentAssignment: AgentAssignmentInput) { replaceActorsForAssignable(input: { assignableId: $assignableId, actorIds: $actorIds, - copilotAssignmentOptions: $copilotAssignmentOptions + agentAssignment: $agentAssignment }) { __typename } @@ -4526,9 +4526,9 @@ jobs: const mutationInput = { assignableId: issueId, actorIds: actorIds, - copilotAssignmentOptions: copilotOptions, + agentAssignment: agentAssignment, }; - core.debug(`GraphQL mutation with Copilot options: ${JSON.stringify(mutationInput)}`); + core.debug(`GraphQL mutation with agent assignment: ${JSON.stringify(mutationInput)}`); response = await github.graphql(extendedMutation, mutationInput, { headers: { "GraphQL-Features": "issues_copilot_assignment_api_support", @@ -4704,8 +4704,8 @@ jobs: } } } - if (options.baseBranch) { - assignmentOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + assignmentOptions.baseRef = options.baseRef; } if (options.customInstructions) { assignmentOptions.customInstructions = options.customInstructions; @@ -4852,7 +4852,7 @@ jobs: } } if (item.base_branch) { - assignmentOptions.baseBranch = item.base_branch; + assignmentOptions.baseRef = item.base_branch; core.info(`Base branch: ${item.base_branch}`); } if (item.custom_instructions) { diff --git a/.github/workflows/duplicate-code-detector.lock.yml b/.github/workflows/duplicate-code-detector.lock.yml index b31dcde78e..f774f76c54 100644 --- a/.github/workflows/duplicate-code-detector.lock.yml +++ b/.github/workflows/duplicate-code-detector.lock.yml @@ -5958,30 +5958,30 @@ jobs: actorIds.push(assigneeId); } } - const hasCopilotOptions = options.targetRepositoryId || options.baseBranch || options.customInstructions || options.customAgent; + const hasAgentOptions = options.targetRepositoryId || options.baseRef || options.customInstructions || options.customAgent; try { core.info("Using built-in github object for mutation"); let response; - if (hasCopilotOptions) { - const copilotOptions = {}; + if (hasAgentOptions) { + const agentAssignment = {}; if (options.targetRepositoryId) { - copilotOptions.targetRepositoryId = options.targetRepositoryId; + agentAssignment.targetRepositoryId = options.targetRepositoryId; } - if (options.baseBranch) { - copilotOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + agentAssignment.baseRef = options.baseRef; } if (options.customInstructions) { - copilotOptions.customInstructions = options.customInstructions; + agentAssignment.customInstructions = options.customInstructions; } if (options.customAgent) { - copilotOptions.customAgent = options.customAgent; + agentAssignment.customAgent = options.customAgent; } const extendedMutation = ` - mutation($assignableId: ID!, $actorIds: [ID!]!, $copilotAssignmentOptions: CopilotAssignmentOptionsInput) { + mutation($assignableId: ID!, $actorIds: [ID!]!, $agentAssignment: AgentAssignmentInput) { replaceActorsForAssignable(input: { assignableId: $assignableId, actorIds: $actorIds, - copilotAssignmentOptions: $copilotAssignmentOptions + agentAssignment: $agentAssignment }) { __typename } @@ -5990,9 +5990,9 @@ jobs: const mutationInput = { assignableId: issueId, actorIds: actorIds, - copilotAssignmentOptions: copilotOptions, + agentAssignment: agentAssignment, }; - core.debug(`GraphQL mutation with Copilot options: ${JSON.stringify(mutationInput)}`); + core.debug(`GraphQL mutation with agent assignment: ${JSON.stringify(mutationInput)}`); response = await github.graphql(extendedMutation, mutationInput, { headers: { "GraphQL-Features": "issues_copilot_assignment_api_support", @@ -6168,8 +6168,8 @@ jobs: } } } - if (options.baseBranch) { - assignmentOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + assignmentOptions.baseRef = options.baseRef; } if (options.customInstructions) { assignmentOptions.customInstructions = options.customInstructions; diff --git a/.github/workflows/issue-monster.lock.yml b/.github/workflows/issue-monster.lock.yml index 9da8440390..ea10c85319 100644 --- a/.github/workflows/issue-monster.lock.yml +++ b/.github/workflows/issue-monster.lock.yml @@ -6083,30 +6083,30 @@ jobs: actorIds.push(assigneeId); } } - const hasCopilotOptions = options.targetRepositoryId || options.baseBranch || options.customInstructions || options.customAgent; + const hasAgentOptions = options.targetRepositoryId || options.baseRef || options.customInstructions || options.customAgent; try { core.info("Using built-in github object for mutation"); let response; - if (hasCopilotOptions) { - const copilotOptions = {}; + if (hasAgentOptions) { + const agentAssignment = {}; if (options.targetRepositoryId) { - copilotOptions.targetRepositoryId = options.targetRepositoryId; + agentAssignment.targetRepositoryId = options.targetRepositoryId; } - if (options.baseBranch) { - copilotOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + agentAssignment.baseRef = options.baseRef; } if (options.customInstructions) { - copilotOptions.customInstructions = options.customInstructions; + agentAssignment.customInstructions = options.customInstructions; } if (options.customAgent) { - copilotOptions.customAgent = options.customAgent; + agentAssignment.customAgent = options.customAgent; } const extendedMutation = ` - mutation($assignableId: ID!, $actorIds: [ID!]!, $copilotAssignmentOptions: CopilotAssignmentOptionsInput) { + mutation($assignableId: ID!, $actorIds: [ID!]!, $agentAssignment: AgentAssignmentInput) { replaceActorsForAssignable(input: { assignableId: $assignableId, actorIds: $actorIds, - copilotAssignmentOptions: $copilotAssignmentOptions + agentAssignment: $agentAssignment }) { __typename } @@ -6115,9 +6115,9 @@ jobs: const mutationInput = { assignableId: issueId, actorIds: actorIds, - copilotAssignmentOptions: copilotOptions, + agentAssignment: agentAssignment, }; - core.debug(`GraphQL mutation with Copilot options: ${JSON.stringify(mutationInput)}`); + core.debug(`GraphQL mutation with agent assignment: ${JSON.stringify(mutationInput)}`); response = await github.graphql(extendedMutation, mutationInput, { headers: { "GraphQL-Features": "issues_copilot_assignment_api_support", @@ -6293,8 +6293,8 @@ jobs: } } } - if (options.baseBranch) { - assignmentOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + assignmentOptions.baseRef = options.baseRef; } if (options.customInstructions) { assignmentOptions.customInstructions = options.customInstructions; @@ -6441,7 +6441,7 @@ jobs: } } if (item.base_branch) { - assignmentOptions.baseBranch = item.base_branch; + assignmentOptions.baseRef = item.base_branch; core.info(`Base branch: ${item.base_branch}`); } if (item.custom_instructions) { diff --git a/pkg/workflow/js/assign_agent_helpers.cjs b/pkg/workflow/js/assign_agent_helpers.cjs index a3bf5e8486..cabfbb0d4a 100644 --- a/pkg/workflow/js/assign_agent_helpers.cjs +++ b/pkg/workflow/js/assign_agent_helpers.cjs @@ -209,7 +209,7 @@ async function getIssueDetails(owner, repo, issueNumber) { * @param {string} agentName - Agent name for error messages * @param {object} options - Additional assignment options * @param {string} [options.targetRepositoryId] - Target repository ID for the PR - * @param {string} [options.baseBranch] - Base branch for the PR + * @param {string} [options.baseRef] - Base branch for the PR * @param {string} [options.customInstructions] - Custom instructions for the agent * @param {string} [options.customAgent] - Custom agent name/path * @returns {Promise} True if successful @@ -223,41 +223,41 @@ async function assignAgentToIssue(issueId, agentId, currentAssignees, agentName, } } - // Check if any Copilot-specific options are provided - const hasCopilotOptions = options.targetRepositoryId || options.baseBranch || options.customInstructions || options.customAgent; + // Check if any agent assignment options are provided + const hasAgentOptions = options.targetRepositoryId || options.baseRef || options.customInstructions || options.customAgent; try { core.info("Using built-in github object for mutation"); let response; - if (hasCopilotOptions) { - // Build Copilot assignment options - const copilotOptions = {}; + if (hasAgentOptions) { + // Build agent assignment options + const agentAssignment = {}; if (options.targetRepositoryId) { - copilotOptions.targetRepositoryId = options.targetRepositoryId; + agentAssignment.targetRepositoryId = options.targetRepositoryId; } - if (options.baseBranch) { - copilotOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + agentAssignment.baseRef = options.baseRef; } if (options.customInstructions) { - copilotOptions.customInstructions = options.customInstructions; + agentAssignment.customInstructions = options.customInstructions; } if (options.customAgent) { - copilotOptions.customAgent = options.customAgent; + agentAssignment.customAgent = options.customAgent; } - // Use extended mutation with Copilot assignment options + // Use extended mutation with agent assignment options const extendedMutation = ` - mutation($assignableId: ID!, $actorIds: [ID!]!, $copilotAssignmentOptions: CopilotAssignmentOptionsInput) { + mutation($assignableId: ID!, $actorIds: [ID!]!, $agentAssignment: AgentAssignmentInput) { replaceActorsForAssignable(input: { assignableId: $assignableId, actorIds: $actorIds, - copilotAssignmentOptions: $copilotAssignmentOptions + agentAssignment: $agentAssignment }) { __typename } @@ -267,17 +267,17 @@ async function assignAgentToIssue(issueId, agentId, currentAssignees, agentName, const mutationInput = { assignableId: issueId, actorIds: actorIds, - copilotAssignmentOptions: copilotOptions, + agentAssignment: agentAssignment, }; - core.debug(`GraphQL mutation with Copilot options: ${JSON.stringify(mutationInput)}`); + core.debug(`GraphQL mutation with agent assignment: ${JSON.stringify(mutationInput)}`); response = await github.graphql(extendedMutation, mutationInput, { headers: { "GraphQL-Features": "issues_copilot_assignment_api_support", }, }); } else { - // Use simple mutation for backward compatibility (no Copilot-specific options) + // Use simple mutation for backward compatibility (no agent assignment options) const simpleMutation = ` mutation($assignableId: ID!, $actorIds: [ID!]!) { replaceActorsForAssignable(input: { @@ -444,7 +444,7 @@ function generatePermissionErrorSummary() { * @param {string} agentName - Agent name (e.g., "copilot") * @param {object} options - Optional assignment options * @param {string} [options.targetRepository] - Target repository in 'owner/repo' format - * @param {string} [options.baseBranch] - Base branch for the PR + * @param {string} [options.baseRef] - Base branch for the PR * @param {string} [options.customInstructions] - Custom instructions for the agent * @param {string} [options.customAgent] - Custom agent name/path * @returns {Promise<{success: boolean, error?: string}>} @@ -499,8 +499,8 @@ async function assignAgentToIssueByName(owner, repo, issueNumber, agentName, opt } } - if (options.baseBranch) { - assignmentOptions.baseBranch = options.baseBranch; + if (options.baseRef) { + assignmentOptions.baseRef = options.baseRef; } if (options.customInstructions) { diff --git a/pkg/workflow/js/assign_agent_helpers.test.cjs b/pkg/workflow/js/assign_agent_helpers.test.cjs index 125d463128..f32f499440 100644 --- a/pkg/workflow/js/assign_agent_helpers.test.cjs +++ b/pkg/workflow/js/assign_agent_helpers.test.cjs @@ -268,7 +268,7 @@ describe("assign_agent_helpers.cjs", () => { expect(mockGithub.graphql.mock.calls[0].length).toBe(2); }); - it("should use extended mutation with headers when Copilot options provided", async () => { + it("should use extended mutation with headers when agent assignment options provided", async () => { mockGithub.graphql.mockResolvedValueOnce({ replaceActorsForAssignable: { __typename: "ReplaceActorsForAssignablePayload", @@ -276,7 +276,7 @@ describe("assign_agent_helpers.cjs", () => { }); const options = { - baseBranch: "main", + baseRef: "main", customInstructions: "Test instructions", }; @@ -288,8 +288,8 @@ describe("assign_agent_helpers.cjs", () => { expect.objectContaining({ assignableId: "ISSUE_123", actorIds: ["AGENT_456", "USER_1"], - copilotAssignmentOptions: expect.objectContaining({ - baseBranch: "main", + agentAssignment: expect.objectContaining({ + baseRef: "main", customInstructions: "Test instructions", }), }), diff --git a/pkg/workflow/js/assign_to_agent.cjs b/pkg/workflow/js/assign_to_agent.cjs index d285ae00da..3c997c85b0 100644 --- a/pkg/workflow/js/assign_to_agent.cjs +++ b/pkg/workflow/js/assign_to_agent.cjs @@ -177,7 +177,7 @@ async function main() { // Handle base branch if (item.base_branch) { - assignmentOptions.baseBranch = item.base_branch; + assignmentOptions.baseRef = item.base_branch; core.info(`Base branch: ${item.base_branch}`); }