When Copilot Code Review works across all repositories except one—and intermittently works only after repeatedly clicking—the problem is typically tied to that specific repository's characteristics, Azure DevOps Code Search indexing, or service account permissions rather than the global toggle.
Inspect and resolve the issue through the following troubleshooting steps:
1.Check Repository Size and PR Limits:Preview limits.Copilot Code Review in Azure Repos enforces strict size and file limits:
Total repository size must not exceed 10 GB.
Pull requests must change 100 files or fewer and have no active merge conflicts.
Repositories with large binary assets, deep submodule nesting, or large files (e.g., node_modules or unignored build artifacts committed to the tree) often cause background git-traversal timeouts.
Verification: Test with a minimal PR in this repository (modifying a single Markdown or text file). If that PR reviews immediately, the failure is linked to diff/tree size constraints.
2.Verify Searchable Branches and Code Search Indexing:Azure Repos Code Search.Azure DevOps Copilot Code Review relies on Azure DevOps Code Search to build context. If the target branch of the PR is not indexed, Copilot falls back to a deep filesystem/git walk that frequently hangs or gets canceled by the internal agent:
Go to Project Settings > Repositories > select the affected repository.
Check the Searchable branches tab.
Ensure the PR target branch (e.g., main, develop, or release branch) is listed as an indexed searchable branch.
Verification: Perform a manual search query across this repo using the top search bar. If search results return immediately for the target branch, indexing is healthy.
3.Inspect Backend Agent Pool Logs:Failure diagnostics.Copilot code reviews execute as background jobs on your hosted pipeline agent pool:
Go to Organization Settings > Agent Pools.
Open the pool designated for Copilot compute (by default, Azure Pipelines).
Locate the failing code review job and inspect the raw JSON logs to see the exact terminating exception (e.g., checkout lock, token budget exceeded, or directory traversal timeout).
Verification: The log entries will display whether the job hit an agent cancellation (exit code 128 / timeout) or an API authorization error.
4.Validate Project-Level Build Service Permissions:Permissions check.The backend review agent requires read permissions to the Git repository to checkout and post annotations:
Go to Project Settings > Repositories > select the affected repository.
Under the Security tab, locate Project Collection Build Service ([OrgName]) and [ProjectName] Build Service.
Confirm both accounts have Read and Contribute to pull requests set to Allow (not inherited Deny).
Verification: Ensure neither service account is set to explicit Deny anywhere in the inheritance tree.