Skip to content

fix(assign_to_agent): allow multiple assignments to same issue when pull_request_repo differs#24822

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-multiple-assignments-issue-again
Closed

fix(assign_to_agent): allow multiple assignments to same issue when pull_request_repo differs#24822
Copilot wants to merge 3 commits intomainfrom
copilot/fix-multiple-assignments-issue-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

When assign_to_agent is called twice for the same issue with different pull_request_repo values (e.g. iOS and Android targets), the second call was silently skipped — the already-assigned guard checked only agentId, ignoring the target repo.

Changes

  • assign_to_agent.cjs: Treat (agent, pull_request_repo) as the uniqueness key. The guard now short-circuits only when no pull_request_repo is specified:
// Before — skips any re-assignment regardless of target repo
if (currentAssignees.some(a => a.id === agentId)) { ... continue; }

// After — only skips when no explicit pull_request_repo is provided
if (currentAssignees.some(a => a.id === agentId) && !effectivePullRequestRepoId) { ... continue; }
  • assign_to_agent.test.cjs: Adds a test asserting that when an agent is already assigned but a different pull_request_repo is supplied, the assignment proceeds and the mutation is called with the correct targetRepoId.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js --revs /opt/hostedtoolc--is-ancestor git comm�� -m Extra commit e_modules/.bin/git user.name Test User k/gh-aw/gh-aw/no-e git (http block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js branch..HEAD _modules/.bin/gi/tmp/go-handler-test-6MjMqp/test-cwd.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet merg�� --is-ancestor 1c3f8d9c9f5086b1d342671bc4d8aa0bec694ee3 ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -m Initial commit tions/setup/nodenpm run typecheck && vitest run --no-file-parallelism --reporter=verbose --run ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
  • invalid.example.invalid
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin https://invalid.example.invalid/nonexistent-repo.git git conf�� user.name lure tions/setup/js/node_modules/.bin/git -M main /usr/sbin/git git init�� --bare --initial-branch=main k/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/git '/tmp/bare-incregit '/tmp/bare-increadd cal/bin/git git (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…repo differs

When assign_to_agent is called twice for the same issue with different
pull_request_repo values, the second assignment was silently skipped
because the already-assigned guard only checked whether the agent was
already in the assignees list.

Fix: treat the pair of (agent, pull_request_repo) as the uniqueness key.
When no pull_request_repo is specified, the existing dedup behaviour is
preserved. When a pull_request_repo is explicitly provided, the
assignment proceeds even if the agent is already assigned, so that
Copilot can be triggered for a second target repository (e.g. Android
after iOS).

Adds a test to validate both the new behaviour and that the original
dedup behaviour is unchanged.

Fixes #6588

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e8d9b238-ae61-49b3-b0b3-df1d3a3bfa94

Co-authored-by: pelikhan <[email protected]>
Copilot AI changed the title [WIP] Fix multiple assignments to same issue when pull_request_repo differs fix(assign_to_agent): allow multiple assignments to same issue when pull_request_repo differs Apr 6, 2026
Copilot AI requested a review from pelikhan April 6, 2026 04:22
@pelikhan pelikhan marked this pull request as ready for review April 6, 2026 04:23
Copilot AI review requested due to automatic review settings April 6, 2026 04:23
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

Fixes assign_to_agent so a second assignment for the same issue is not skipped when it specifies a different pull_request_repo (e.g., separate Android/iOS target repos).

Changes:

  • Updates the “already assigned” guard to only short-circuit when no effective PR target repo is configured.
  • Adds a unit test ensuring assignment proceeds (and includes targetRepoId) when the agent is already assigned but a pull_request_repo is provided.
Show a summary per file
File Description
actions/setup/js/assign_to_agent.cjs Adjusts the already-assigned guard to allow reassignment when a PR target repo is configured.
actions/setup/js/assign_to_agent.test.cjs Adds coverage for assigning with pull_request_repo when the agent is already an assignee.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines +451 to +455
// Check if agent is already assigned.
// When a pull_request_repo is explicitly provided, the pair of (agent, pull_request_repo)
// is the uniqueness key, so we allow the assignment to proceed even if the agent is
// already assigned (it may target a different repository).
if (currentAssignees.some(a => a.id === agentId) && !effectivePullRequestRepoId) {
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The updated guard disables the “already assigned” short-circuit whenever effectivePullRequestRepoId is set, but it doesn’t actually enforce uniqueness on (agent, pull_request_repo). As a result, if the same issue appears multiple times with the same pull_request_repo in a single run, this will re-run the mutation each time and can trigger duplicate agent runs/PR attempts. Consider tracking attempted assignments in-memory using a key like (assignableId, agentId, effectivePullRequestRepoId || "") and skipping when the same key is seen again, while still allowing a different pull_request_repo to proceed.

Copilot uses AI. Check for mistakes.
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.

assign_to_agent: allow multiple assignments to same issue when pull_request_repo differs

3 participants