fix(azure-devops): report build results to PR watches #18759
main fromrefs/pull/18759/head·opened View on GitHubProblem#
Azure DevOps PR watches receive no build results because the provider always returns checks: []. This prevents failure and completion notifications.
Fixes #18728.
Change#
Read current build-validation policy evaluations through az repos pr policy list and map them into the existing check contract:
- Approved evaluations pass; rejected or broken evaluations fail.
- Queued, running, and unknown states remain pending.
- Policy configuration determines required checks and stable identity across reruns.
- Disabled, deleted, inapplicable, and non-build policies are excluded.
- Pagination and read failures are handled explicitly, preventing incomplete results from appearing successful.
This adds one policy-list CLI invocation per page to Azure detail reads. Shared contracts, watch lifetime, and polling cadence are unchanged.
Scope and approval#
Maintainer triage on #18728 identifies the missing Azure checks and this mapping as the fix. The decoder, pagination, provider wiring, and tests address that omission. Head SHA handling remains separate in #18651; standalone PR status integrations are outside this build-validation fix.
Verification#
- Reproduced the missing notification with a regression test against the original empty-check behavior, then confirmed it passes with the fix.
- 88 focused tests passed across the Azure decoder, CLI, provider, and PR watch suites, covering failures, completion, reruns, duplicate suppression, pending states, required checks, pagination, and read errors.
- Azure package and server typechecks, targeted lint, formatting, and
git diff --checkpassed. - On Linux, a disposable real Azure PR verified pending validation, failure, a same-commit failed retry, eventual success, and duplicate suppression through the fixed provider and actual watch evaluator. The test pipeline was restored and the PR abandoned afterward.
- A rebuilt Linux desktop running against isolated state verified the full server wake pipeline. Normal watch sweeps persisted failure and completion notifications, started agent turns, and completed both runs. Both notifications and responses appeared in the connected Browser client. The watch also recovered after restart and was stopped after verification.
The desktop exercise used synthetic Azure responses and a deterministic Codex app-server stand-in. Real Azure acquisition and reruns were tested separately. The native Electron renderer was launched, but UI assertions were made through the connected Browser client. Read failures were covered with fixtures rather than induced against Azure. Fixtures and this description omit private repository and build identities.
Model: GPT-6 Astra (High reasoning). Harness: Codex in T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
69ad63ed-7e62-4f10-bb26-6174b16732b2
📥 Commits
-
Reviewing files that changed from the base of the PR and between 9e552285bae9c9b0707e7ebeb77bf126f0c0a16b and da81b1d76d071cd52150c590d55ef4ae945b2054.
📒 Files selected for processing (7)
-
apps/server/src/orchestration-v2/azureDevOpsPullRequestWatch.test.tspackages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.test.tspackages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.tspackages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.test.tspackages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.tspackages/source-control-azure-devops/src/server/azureDevOpsPullRequestChecks.test.tspackages/source-control-azure-devops/src/server/azureDevOpsPullRequestChecks.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
Walkthrough#
The Azure DevOps provider now reads build-policy evaluations, converts applicable policies into pull request checks, and includes those checks in pull request details. Tests cover pagination, read failures, policy status mapping, and watch outcomes.
Changes#
Azure DevOps build check reporting
Layer / File(s) Summary Decode build policy evaluations
packages/source-control-azure-devops/src/server/azureDevOpsPullRequestChecks.ts,packages/source-control-azure-devops/src/server/azureDevOpsPullRequestChecks.test.tsThe decoder maps policy statuses, filters disabled and inapplicable policies, and creates checks with names and requiredness. Tests cover valid and malformed responses. Read policy evaluations across pages
packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.ts,packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.test.tslistBuildChecksreads policy evaluations in pages of 100, with a limit of 1,000. Tests cover pagination and read-error handling.Include checks in pull request details
packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.ts,packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.test.ts,apps/server/src/orchestration-v2/azureDevOpsPullRequestWatch.test.tsThe provider includes fetched checks in pull request details. Tests cover provider wiring and watch outcomes as checks change status. Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)#
sequenceDiagram participant PullRequestWatch participant AzureDevOpsPullRequestProvider participant AzureDevOpsPullRequestCli participant decodeBuildPolicyChecksJson AzureDevOpsPullRequestProvider->>AzureDevOpsPullRequestCli: listBuildChecks for pull request AzureDevOpsPullRequestCli->>decodeBuildPolicyChecksJson: decode policy evaluation pages decodeBuildPolicyChecksJson-->>AzureDevOpsPullRequestCli: decoded checks and raw count AzureDevOpsPullRequestCli-->>AzureDevOpsPullRequestProvider: collected checks AzureDevOpsPullRequestProvider-->>PullRequestWatch: pull request details with checks PullRequestWatch->>PullRequestWatch: evaluate check status changesSuggested reviewers:
juliusmarminge
Merge Risk | ⚪ Minimal · up to
da81b-
Merge Risk: ⚪ Minimal · up to
da81bAzure build-check reporting is ready to merge after normal checks.
-
Security Architecture Review
-
Security architecture risk: 🔵 Low · up to
da81bThe change uses read-only Azure operations and rejects incomplete results rather than reporting success. No new permissions or confirmed security vulnerability were identified. Remaining risks concern externally supplied policy names reaching agent messages and persistent policy-read failures stopping monitoring.
Retained concerns
- Low · reliability · observed: Policy reads are now mandatory for detail success. Eight consecutive non-rate-limited failed reads can therefore stop every watch for the same project and pull request even when PR metadata remains readable, ending build and activity monitoring until explicitly restarted. The existing failed notification and restart instructions make this visible rather than silently reporting success.
-
Security review details
-
Security Blast Radius
- observed — The new read operates through the existing checkout and PR-number scope. Watch results and failures are shared across threads watching that PR within one project; grouping explicitly separates projects so one project's read failure does not end another project's watches.
Trust Boundaries and Controls
- observed — Azure policy display names receive trimming and a configuration-ID suffix, then appear directly in agent-facing failure messages. The existing message identifies the event as a monitored PR update but does not separately delimit policy names as external data. This is a new Azure input source into an existing wake path, not a new agent capability grant.
Resilience and Maintainability Implications
- observed — Failed or interrupted detail reads do not advance persisted check state. Rate limits do not count toward watch termination, and successful reads reset the failure counter. Nonempty pending-to-failed and failed-to-rerun transitions update name-based history and suppress duplicate notifications; valid empty check results deliberately retain previous history.
Hardening Proposals
- proposed — Treat policy labels explicitly as external metadata in agent messages, using bounded, delimited formatting that prevents embedded line breaks from resembling monitor instructions. This is defense in depth, not a verified vulnerability; an untrusted actor's ability to edit Azure policy names has not been established.
-
-
-
Pre-merge checks |
4-
✅ Passed checks (4 passed)
-
Check name Status Explanation Title check The title clearly and concisely describes the main change: reporting Azure DevOps build results to pull request watches. Description check The description includes the problem, change, scope and approval, and detailed verification results. It explains the mapping, error handling, test coverage, and known scope boundaries. Linked Issues check Direct issue [ #18728] requires Azure DevOps PR watches to receive build results and wake on failed validation.AzureDevOpsPullRequestProvider.getChangeRequestnow callslistBuildChecksand returns…Out of Scope Changes check The changes stay within [ #18728]. Production changes add Azure build-policy decoding, paginated policy reads, provider wiring, and explicit read-failure handling. The added tests directly verify the d…
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.-
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge assignedjuliusmarminge
Taking over this one. I’ll reduce the tests to the useful coverage, update the implementation against current main, and verify it before publishing the changes.
juliusmarminge added labelstakeover
juliusmarminge added labelspr:in-progress
AugusDogus(GitHub profile, opens in a new tab) closed this
Thanks @AugusDogus for identifying the missing Azure build-validation checks and implementing the policy-evaluation mapping. Continued this in #24568 on origin, retaining your implementation commit. Compared the original diff with the replacement: policy decoding moved into the existing JSON module, duplicate tests were reduced to integrated regressions, and lightweight previews avoid policy reads. No intended build-check behavior was dropped. The replacement includes before/after runtime proof and independent review/audit; closing this original in its favor.
juliusmarminge removed labelspr:in-progress
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This PR adds production Azure policy reads and converts them into build-watch failures, completions, and rerun notifications, changing behavior across the provider and orchestration path. The pagination, error handling, and new user-facing watch capability make this broader than a small isolated fix.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).