Skip to content

Cloud coding agent opens empty PR when invoked from a fork-backed PR review comment #4559

Description

@mojaza

Describe the bug

Product

GitHub Copilot cloud coding agent (app/copilot-swe-agent), triggered from review feedback on a fork-backed pull request. This may need routing to the hosted coding-agent workflow owners.

Summary

When Copilot was started from a review comment on a fork-backed pull request, it created a draft PR from upstream main instead of the reviewed PR’s fork head. The requested file existed only in the reviewed PR, so the agent could not change it. It nevertheless opened an empty draft PR with an empty Initial plan commit.

Reproduction

  1. Open a PR from a personal fork to an upstream repository.
  2. Add review feedback about a file introduced by that PR and absent from upstream main.
  3. Start Copilot coding agent from that review comment.
  4. Copilot creates its branch from upstream main rather than the reviewed PR head.

Actual behavior

The reviewed file, libraries/rush-daemon/src/test/WorkspaceEngineComponentFactory.test.ts, existed only on PR #5949’s fork head and not on upstream main.

Expected behavior

For review-comment tasks on fork-backed PRs, Copilot should either:

  1. Base its work on the reviewed PR’s exact head; or
  2. Stop before creating a PR and report that fork-head access is unsupported.

Copilot should never publish a zero-diff PR when its head and base trees are identical.

Suggested safeguards

  • Preserve the reviewed PR head SHA when launching from inline review feedback.
  • Verify that the referenced file and line exist in the selected base.
  • Compare head and base trees before publishing; suppress an identical-tree PR.
  • Report an explicit unsupported-fork error instead of silently falling back to upstream main.

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions