Skip to content

[ci] Copilot CI: Add Windows platform support to maui-copilot pipeline#34575

Merged
PureWeen merged 2 commits intomainfrom
copilot-ci-ios
Mar 23, 2026
Merged

[ci] Copilot CI: Add Windows platform support to maui-copilot pipeline#34575
PureWeen merged 2 commits intomainfrom
copilot-ci-ios

Conversation

@kubaflo
Copy link
Copy Markdown
Contributor

@kubaflo kubaflo commented Mar 19, 2026

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

Adds Windows platform support to the maui-copilot CI pipeline (AzDO definition 27723), enabling Copilot PR reviews on Windows-targeted PRs.

Changes

eng/pipelines/ci-copilot.yml

  • Add catalyst and windows to Platform parameter values
  • Add per-platform pool selection (androidPool, iosPool, macPool, windowsPool)
  • Skip Xcode, Android SDK, simulator setup for Windows/Catalyst
  • Add Windows-specific "Set screen resolution" step (1920x1080)
  • Add MacCatalyst-specific "Disable Notification Center" step
  • Fix sed command for Directory.Build.Override.props on Windows (Git Bash uses GNU sed)
  • Handle Copilot CLI PATH detection on Windows vs Unix
  • Change script: steps to bash: for cross-platform consistency

.github/scripts/Review-PR.ps1

  • Add catalyst to ValidateSet for Platform parameter

.github/scripts/BuildAndRunHostApp.ps1

  • Add Windows test assembly directory for artifact collection

.github/scripts/post-ai-summary-comment.ps1 / post-pr-finalize-comment.ps1

  • Various improvements for cross-platform comment posting

Validation

Successfully ran the pipeline with Platform=windows on multiple Windows-specific PRs:

Copilot AI review requested due to automatic review settings March 19, 2026 17:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 19, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34575

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34575"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the maui-copilot Azure DevOps pipeline and supporting scripts to run Copilot PR reviews against Windows- and MacCatalyst-targeted PRs, in addition to the existing Android/iOS support.

Changes:

  • Extended eng/pipelines/ci-copilot.yml to support windows and catalyst platforms, including per-platform agent pool selection and Windows-specific setup.
  • Improved cross-script coordination for GitHub comment posting by passing through the created/updated comment ID to avoid eventual-consistency races.
  • Updated review/test helper scripts to recognize the new platform value(s) and collect Windows artifacts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
eng/pipelines/ci-copilot.yml Adds windows/catalyst, selects pools per platform, and adjusts environment/tooling setup for cross-platform execution.
.github/scripts/Review-PR.ps1 Expands accepted platform values and wires comment ID from AI summary → finalize posting.
.github/scripts/post-ai-summary-comment.ps1 Emits the created/updated comment ID and falls back to creating a new comment if PATCH isn’t permitted.
.github/scripts/post-pr-finalize-comment.ps1 Accepts an existing comment ID for direct fetch (reduces comment-search race) and falls back gracefully on PATCH failures.
.github/scripts/BuildAndRunHostApp.ps1 Adds Windows test assembly directory to artifact collection and clarifies log display for Windows.
Comments suppressed due to low confidence (1)

eng/pipelines/ci-copilot.yml:366

  • The Copilot CLI install step derives COPILOT_BIN_DIR from which copilot. If copilot is not on PATH yet (common right after npm install -g, especially on Windows/Git Bash), which returns empty and dirname "" becomes .—leading to ##vso[task.prependpath]. and the CLI still not being discoverable. Prefer using npm bin -g (or npm config get prefix + path join) to compute the global bin directory and prepend that, then verify copilot --version.
          - bash: |
              echo "Installing GitHub Copilot CLI..."
              npm install -g @github/copilot
              # Ensure npm global bin is on PATH for subsequent steps (Linux UseNode installs to toolcache)
              COPILOT_BIN_DIR=$(dirname "$(which copilot)")
              echo "Copilot binary at: $COPILOT_BIN_DIR/copilot"
              echo "##vso[task.prependpath]$COPILOT_BIN_DIR"
              copilot --version || true

(Join-Path $RepoRoot "artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0"),
(Join-Path $RepoRoot "artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0")
(Join-Path $RepoRoot "artifacts/bin/Controls.TestCases.Mac.Tests/Debug/net10.0"),
(Join-Path $RepoRoot "artifacts/bin/Controls.TestCases.WinUI.Tests/Debug/net10.0-windows10.0.19041.0")
Comment on lines 45 to 47
[Parameter(Mandatory = $false)]
[ValidateSet('android', 'ios', 'windows', 'maccatalyst')]
[ValidateSet('android', 'ios', 'windows', 'maccatalyst', 'catalyst')]
[string]$Platform,
@PureWeen
Copy link
Copy Markdown
Member

PR #34575 Review — 5-Model Consensus

CI Status:Build .NET MAUI Build Windows (Release) is failing — appears PR-specific (this PR introduces Windows support). All other checks are passing or in-progress.


Consensus Findings (flagged by 2+ of 5 models)

🔴 CRITICAL — ci-copilot.yml ~line 102 — catalyst incorrectly skips Xcode provisioning (2/5 models)

skipXcode: ${{ or(eq(parameters.Platform, 'android'), eq(parameters.Platform, 'windows'), eq(parameters.Platform, 'catalyst')) }}

MacCatalyst builds require Xcode. skipXcode: true skips not just installation but also the xcode-select version validation scripts in provision.yml. Catalyst will run against whatever default Xcode the agent has — inconsistent with iOS (same macOS pool, Xcode correctly not skipped). skipSimulatorSetup: true for catalyst is correct. Remove catalyst from the skipXcode expression.


🟡 MODERATE — post-pr-finalize-comment.ps1 ~line 218 + post-ai-summary-comment.ps1 ~line 844 — PATCH fallback creates orphaned marker comments (5/5 models)

Both scripts search for the oldest comment containing $MAIN_MARKER (<!-- AI Summary -->), then attempt PATCH. If PATCH fails, the catch block POSTs a new comment whose body also contains $MAIN_MARKER. On every subsequent pipeline run, the search finds the same un-patchable original, PATCH fails again, another marker comment is created — accumulating one orphan per failure.

Fix: capture the fallback POST's new comment ID and use it as the target on subsequent runs (rather than re-searching), or track it in a pipeline variable.


🟡 MODERATE — ci-copilot.yml ~line 530-534 — No fail-fast when copilot is not on PATH (4/5 models)

COPILOT_PATH=$(which copilot 2>/dev/null || true)
echo "copilot location: ${COPILOT_PATH:-not found}"
# no exit 1 if not found

If copilot is absent on the Windows agent, the step succeeds and the job fails minutes later inside Review-PR.ps1 with an opaque error. Add exit 1 immediately after detection when $COPILOT_PATH is empty.


🟢 MINOR — post-ai-summary-comment.ps1 ~line 845 — Temp file leaked if fallback POST fails (5/5 models)

catch {
    $newTempFile = [System.IO.Path]::GetTempFileName()
    $newCommentJson = gh api --method POST ... --input $newTempFile
    Remove-Item $newTempFile   # never reached if POST throws
}

Wrap the POST in try/finally to guarantee cleanup.


🟢 MINOR — ci-copilot.yml ~line 73 — ${{ else }} pool silently catches unknown Platform values (4/5 models)

The else branch assigns windowsPool for any unmatched platform. AzDO parameter validation prevents this today, but a future platform added without a matching elseif would silently run on a Windows agent. Make the windows match explicit and add an else that fails loudly.


Recommended Action: ⚠️ Request Changes

  1. Must fix: Remove catalyst from skipXcode — MacCatalyst requires Xcode
  2. Must fix: PATCH fallback marker accumulation in both comment scripts
  3. Must fix: Build .NET MAUI Build Windows (Release) CI failure needs resolution

…t check, temp file cleanup

- Remove 'catalyst' from skipXcode  MacCatalyst requires Xcodeexpression
- Add fail-fast exit when copilot CLI is not found on PATH (Windows + Linux/macOS)
- Make 'windows' pool match explicit with fallback else branch
- Wrap fallback POST temp files in try/finally for guaranteed cleanup
- Use -ErrorAction SilentlyContinue on Remove-Item in finally blocks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kubaflo
Copy link
Copy Markdown
Contributor Author

kubaflo commented Mar 20, 2026

Addressed review feedback from the 5-model consensus in c97affb:

Applied fixes:

  1. skipXcode for Removed catalyst from skipXcode expression. MacCatalyst requires Xcode for compilation; only skipSimulatorSetup should be true for catalyst.catalyst

  2. copilot fail- Added exit 1 with ##vso[task.logissue type=error] when copilot CLI is not found, for both Windows and Linux/macOS paths. This gives an immediate, clear error instead of a cryptic failure minutes later in Review-PR.ps1.fast

  3. Temp file Wrapped fallback POST temp files in try/finally blocks in both post-ai-summary-comment.ps1 and post-pr-finalize-comment.ps1 to guarantee cleanup even if the POST throws.cleanup

  4. Explicit windows Made the windows pool match explicit with a fallback else that still assigns windowsPool but documents it should not be reached.pool

Not addressed (by design):

  • PATCH fallback orphan marker The review flagged that repeated PATCH failures could accumulate orphan marker comments. While technically valid, this only occurs when the bot lacks edit permission on its own comment (unlikely in practice). A proper fix would require tracking comment IDs across pipeline runs. Flagging for follow-up if needed.accumulation

@PureWeen
Copy link
Copy Markdown
Member

Multi-Model Re-Review (5 LLMs × consensus filter)

Re-review triggered by new commits since our original review. Includes kubaflo's responses.


Previous Findings Status

# Finding Status
1 🔴 skipXcode included catalyst Fixed — now or(android, windows) only
2 🟡 PATCH→POST fallback creates duplicate <!-- AI Summary --> markers ⚠️ Author-declined — see below
3 🟡 No fail-fast when copilot not on PATH Fixedexit 1 + AzDO error annotation added for both Windows and Linux/macOS
4 🟢 Temp file leaked if fallback POST fails Fixedtry/finally with Remove-Item -ErrorAction SilentlyContinue in both scripts
5 🟢 ${{ else }} pool silently catches unknown Platform values Fixed — all four platforms have explicit ${{ if/elseif }} clauses; else retained with comment

kubaflo's Feedback

We agree with kubaflo's explanations and fixes. The COMMENT_ID plumbing added in this update (post-ai-summary-comment.ps1Review-PR.ps1post-pr-finalize-comment.ps1) substantially mitigates the orphan accumulation concern within a single pipeline run. The remaining cross-run orphan scenario (PATCH fails due to token permission issue, creating a second marker-bearing comment) is a real but low-frequency edge case. We accept the author's "flag for follow-up" assessment.


CI Status: ⚠️ Mixed

  • ✅ macOS builds (Debug/Release), Pack macOS, Helix Unit Tests Windows Debug all passing
  • maui-pr (Run Helix Unit Tests Windows Helix Unit Tests (Release)) failing
  • 🔄 Windows builds (Debug/Release) in progress

The Helix Windows Release failure is most likely pre-existing/flaky — this PR only touches CI scripts and PowerShell, not test code, and the Helix Debug run passes. Not attributed to this PR.


New/Updated Consensus Findings

No new CRITICAL or MODERATE consensus findings. (Issues flagged by 2+ models)

🟢 OBSERVATION — Review-PR.ps1:46maccatalyst retained alongside catalyst in ValidateSet (2/5 models flagged)

The ValidateSet now accepts both 'maccatalyst' (original) and 'catalyst' (new pipeline value). The AzDO pipeline only passes catalyst. Three of five models assessed this as non-problematic (either BuildAndRunHostApp.ps1 normalizes maccatalyst→catalyst, or $Platform is only forwarded as prompt text in Review-PR.ps1). Two models flagged it as a latent routing risk for local invocations. Below the consensus threshold for a required fix, but worth a comment: if maccatalyst is no longer a valid value for callers, it could be removed to keep the interface clean.


Recommended Action: ✅ Approve

All four actionable findings from the original review are fixed. The one outstanding item (orphan accumulation) is a known limitation acknowledged by the author with a reasonable deferral rationale. The CI failure is not PR-specific. This PR is ready to merge.


Re-review by 5-model consensus (claude-opus-4.6 ×2, claude-sonnet-4.6, gemini-3-pro-preview, gpt-5.3-codex). Only issues flagged by 2+ models included.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Mar 23, 2026
@dotnet dotnet deleted a comment from MauiBot Mar 23, 2026
@kubaflo kubaflo removed s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR labels Mar 23, 2026
@PureWeen PureWeen merged commit a38921c into main Mar 23, 2026
28 of 31 checks passed
@PureWeen PureWeen deleted the copilot-ci-ios branch March 23, 2026 15:08
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.

4 participants