Skip to content

fix(copilot): robust diff computation for cloud agent environments#709

Open
anakrish wants to merge 1 commit intomicrosoft:mainfrom
anakrish:main
Open

fix(copilot): robust diff computation for cloud agent environments#709
anakrish wants to merge 1 commit intomicrosoft:mainfrom
anakrish:main

Conversation

@anakrish
Copy link
Copy Markdown
Collaborator

@anakrish anakrish commented May 4, 2026

Fixes skill execution failure in cloud agent environments where upstream/main and origin/main refs aren't available for git merge-base.

Problem

The cloud agent checks out a branch like copilot/review-pr-NNN which may not have the expected remote refs, causing the diff step to fail with "Cannot find upstream/main or origin/main."

Fix

  • Add main (local ref) as third fallback in merge-base resolution
  • Add gh pr diff as final fallback when no merge-base is found
  • Explicitly fetch origin/main in copilot-setup-steps.yml
  • Applied to all 5 diff commands across both skills

@anakrish anakrish force-pushed the main branch 2 times, most recently from f558f0f to b3cc8ab Compare May 4, 2026 23:37
The cloud agent checks out a branch like copilot/review-pr-NNN which
may not have upstream/main or origin/main refs available for merge-base.

Changes:
- Use gh pr diff as primary method (always works in PR context)
- Fall back to git merge-base for local non-PR usage
- Remove path filters (*.rs *.toml examples/) — review full diff
- Remove head -2000 truncation — let agents see everything
- Explicitly fetch origin/main in copilot-setup-steps.yml as backup

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant