Skip to content

assign_to_agent: allow multiple assignments to same issue when pull_request_repo differs #23726

Description

@camposbrunocampos

Summary

When assign_to_agent is called twice for the same issue but with different pull_request_repo values (e.g. a multi-platform request targeting
Husband for iOS and Husband-Droid for Android), the second assignment is silently skipped.

Root Cause

In assign_to_agent.cjs, the already-assigned guard short-circuits as soon as Copilot appears in currentAssignees, regardless of whether a different
pull_request_repo was requested:

if (currentAssignees.some(a => a.id === agentId)) {
  core.info(`${agentName} is already assigned to ${type} #${number}`);
  results.push({ ..., success: true });
  continue;  // ← second assignment is never made
}

Observed Behavior

Successfully assigned copilot coding agent to issue #6587
Waiting 10 seconds before processing next agent assignment...
Using per-item pull request repository: perrystreetsoftware/Husband-Droid
copilot is already assigned to issue #6587    second assignment skipped

The second call had a different pull_request_repo and should have triggered a new Copilot session in that repo.

Proposed Fix

Only skip when no explicit pull_request_repo is provided:

if (currentAssignees.some(a => a.id === agentId) && !effectivePullRequestRepoId) {
  core.info(`${agentName} is already assigned to ${type} #${number}`);
  results.push({ ..., success: true });
  continue;
}

This preserves the no-op dedup behavior for plain re-assignments while allowing Copilot to be triggered for a second platform (different 
pull_request_repo) on the same issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions