fix(assign_to_agent): allow multiple assignments to same issue when pull_request_repo differs#24822
fix(assign_to_agent): allow multiple assignments to same issue when pull_request_repo differs#24822
Conversation
…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]>
There was a problem hiding this comment.
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 apull_request_repois 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
| // 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) { |
There was a problem hiding this comment.
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.
When
assign_to_agentis called twice for the same issue with differentpull_request_repovalues (e.g. iOS and Android targets), the second call was silently skipped — the already-assigned guard checked onlyagentId, 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 nopull_request_repois specified:assign_to_agent.test.cjs: Adds a test asserting that when an agent is already assigned but a differentpull_request_repois supplied, the assignment proceeds and the mutation is called with the correcttargetRepoId.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/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)/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/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: