Skip to content

Copilot agent infrastructure, emulator reliability, and try-fix workflow improvements#33937

Merged
PureWeen merged 7 commits intomainfrom
copilot/create-pr-excluding-yml-ci
Feb 12, 2026
Merged

Copilot agent infrastructure, emulator reliability, and try-fix workflow improvements#33937
PureWeen merged 7 commits intomainfrom
copilot/create-pr-excluding-yml-ci

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 7, 2026

Improvements to Copilot agent infrastructure scripts, emulator reliability, and try-fix workflow.

Agent infrastructure

  • Update model references from claude-opus-4.5claude-opus-4.6 in PLAN-TEMPLATE.md and SHARED-RULES.md
  • Add environment blocker stop rules and mandatory cleanup between try-fix attempts in post-gate.md
  • Prevent git add -f of state files in CustomAgentLogsTmp/ to avoid data loss on tree restore (try-fix/SKILL.md)

Review-PR.ps1 hardening

  • Add -LogFile parameter using Start-Transcript (replaces external tee pipe that caused hangs)
  • Restore working tree to clean state between phases to prevent skill file corruption
  • Run post-ai-summary-comment.ps1 directly instead of via Copilot CLI
  • Write finalize output to separate file to prevent main state file overwrite

Emulator/simulator reliability

  • Rewrite Start-Emulator.ps1 with proper Android SDK discovery, AVD boot detection, and package manager readiness checks
  • Add iOS simulator architecture detection (arm64 vs x64) in Build-AndDeploy.ps1 with fallback
  • Increase Android emulator boot timeout from 2 → 10 minutes in android.cake

Utility

  • Add helper functions in shared-utils.ps1
Original prompt

Create a pr with all the changes from this branch except the yml ci changes
https://github.com/dotnet/maui/tree/copilot-ci


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Create pull request for all changes except YML CI Cherry-pick copilot-ci branch changes excluding YML CI pipeline files Feb 7, 2026
Copilot AI requested a review from PureWeen February 7, 2026 18:48
Copy link
Copy Markdown
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

@copilot remove all the agent-pr-session files from this pr

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot remove all the agent-pr-session files from this pr

Done in e2324ee — restored all 5 agent-pr-session files so they're no longer part of this PR.

@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Feb 9, 2026

@copilot update the title and description to match what's actually in this pr

The branch this was pulled from isn't relevant

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 9, 2026

@copilot update the title and description to match what's actually in this pr

The branch this was pulled from isn't relevant

Updated the PR description to describe the actual changes: agent infrastructure updates, Review-PR.ps1 hardening, emulator/simulator reliability improvements, and utility additions. Removed all references to the source branch.

Copilot AI changed the title Cherry-pick copilot-ci branch changes excluding YML CI pipeline files Copilot agent infrastructure, emulator reliability, and try-fix workflow improvements Feb 9, 2026
@kubaflo kubaflo marked this pull request as ready for review February 9, 2026 11:34
Copilot AI review requested due to automatic review settings February 9, 2026 11:34
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 repo’s Copilot agent workflow docs/scripts and device-test infrastructure to improve try-fix iteration hygiene, PR review automation reliability, and emulator/simulator startup robustness.

Changes:

  • Hardened PR review automation (Review-PR.ps1) with transcript logging, phase-to-phase workspace cleanup, and direct summary-comment posting.
  • Reworked Android emulator + iOS simulator selection/boot logic and iOS simulator RID/app bundle selection.
  • Updated try-fix / agent docs for 6-model sequencing and mandatory cleanup between attempts; increased Android emulator boot timeout.

Reviewed changes

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

Show a summary per file
File Description
eng/devices/android.cake Increases emulator boot timeout to reduce flaky boots.
.github/skills/try-fix/SKILL.md Updates restore instructions to git checkout HEAD -- . and clarifies state file handling.
.github/scripts/shared/shared-utils.ps1 Adds a shared Write-Warning helper for consistent script output.
.github/scripts/shared/Start-Emulator.ps1 Reworks Android SDK/emulator discovery + boot readiness checks; broadens iOS simulator auto-selection logic.
.github/scripts/shared/Build-AndDeploy.ps1 Detects iOS simulator arch/RID and selects the correct built .app bundle with fallback.
.github/scripts/Review-PR.ps1 Adds -LogFile transcript support, restores clean state between phases, runs summary post script directly, and cleans orphaned copilot processes.
.github/agents/pr/post-gate.md Updates try-fix sequencing to 6 models and mandates cleanup between attempts; expands blocker guidance and recovery notes.
.github/agents/pr/SHARED-RULES.md Updates multi-model configuration to 6 models.
.github/agents/pr/PLAN-TEMPLATE.md Updates plan template references for 6-model try-fix workflow.
.github/agents/pr.md Updates Phase 4 multi-model configuration reference to 6 models.

Comment on lines +168 to +172
$emulatorBin = Join-Path $androidSdkRoot "emulator/emulator"

# Check emulator binary exists
if (-not (Test-Path $emulatorBin)) {
Write-Error "Emulator binary not found at: $emulatorBin"
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

On Windows, $emulatorBin = Join-Path $androidSdkRoot "emulator/emulator" will usually not exist because the SDK ships emulator.exe. Since Test-Path checks the literal path (no PATHEXT resolution), this will cause the script to fail even when the emulator is installed. Consider using an OS-specific emulator path (e.g., emulator\emulator.exe on Windows) or resolving the emulator location via Get-Command emulator and/or checking both filenames.

Suggested change
$emulatorBin = Join-Path $androidSdkRoot "emulator/emulator"
# Check emulator binary exists
if (-not (Test-Path $emulatorBin)) {
Write-Error "Emulator binary not found at: $emulatorBin"
$emulatorDir = Join-Path $androidSdkRoot "emulator"
if ($IsWindows) {
# On Windows the SDK ships emulator.exe; prefer that, then fall back to emulator without extension
$emulatorBin = Join-Path $emulatorDir "emulator.exe"
if (-not (Test-Path $emulatorBin)) {
$emulatorBin = Join-Path $emulatorDir "emulator"
}
}
else {
# On macOS/Linux the binary is typically named 'emulator' without extension
$emulatorBin = Join-Path $emulatorDir "emulator"
}
# Check emulator binary exists; if not, try resolving via PATH
if (-not (Test-Path $emulatorBin)) {
$emulatorCmd = Get-Command emulator -ErrorAction SilentlyContinue
if ($emulatorCmd) {
$emulatorBin = $emulatorCmd.Path
}
}
if (-not (Test-Path $emulatorBin)) {
Write-Error "Emulator binary not found. Last attempted path: $emulatorBin"

Copilot uses AI. Check for mistakes.
Comment on lines +199 to +207
$emulatorProcs = bash -c "pgrep -f 'qemu.*$selectedAvd' || pgrep -f 'emulator.*$selectedAvd' || true" 2>&1
if ([string]::IsNullOrWhiteSpace($emulatorProcs)) {
Write-Error "Emulator process did not start. Checking log..."
if (Test-Path $emulatorLog) {
Get-Content $emulatorLog | Select-Object -Last 50 | ForEach-Object { Write-Info " $_" }
}
exit 1
}
Write-Info "Emulator process started (PIDs: $emulatorProcs)"
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The Android path unconditionally runs bash -c "pgrep ..." to verify the emulator process started. This will break on Windows environments that don't have bash/pgrep available (even though this script is used for Android on Windows). Use a Windows-compatible process check (e.g., Get-Process/WMI) or guard the bash calls behind if (-not $IsWindows).

Suggested change
$emulatorProcs = bash -c "pgrep -f 'qemu.*$selectedAvd' || pgrep -f 'emulator.*$selectedAvd' || true" 2>&1
if ([string]::IsNullOrWhiteSpace($emulatorProcs)) {
Write-Error "Emulator process did not start. Checking log..."
if (Test-Path $emulatorLog) {
Get-Content $emulatorLog | Select-Object -Last 50 | ForEach-Object { Write-Info " $_" }
}
exit 1
}
Write-Info "Emulator process started (PIDs: $emulatorProcs)"
if ($IsWindows) {
# On Windows, use native process inspection instead of bash/pgrep
$emulatorProcs = Get-Process | Where-Object {
$_.ProcessName -match 'emulator' -or $_.ProcessName -match 'qemu'
}
if (-not $emulatorProcs) {
Write-Error "Emulator process did not start. Checking log..."
if (Test-Path $emulatorLog) {
Get-Content $emulatorLog | Select-Object -Last 50 | ForEach-Object { Write-Info " $_" }
}
exit 1
}
$emulatorProcIds = $emulatorProcs | Select-Object -ExpandProperty Id -ErrorAction SilentlyContinue
Write-Info "Emulator process started (PIDs: $($emulatorProcIds -join ', '))"
}
else {
$emulatorProcs = bash -c "pgrep -f 'qemu.*$selectedAvd' || pgrep -f 'emulator.*$selectedAvd' || true" 2>&1
if ([string]::IsNullOrWhiteSpace($emulatorProcs)) {
Write-Error "Emulator process did not start. Checking log..."
if (Test-Path $emulatorLog) {
Get-Content $emulatorLog | Select-Object -Last 50 | ForEach-Object { Write-Info " $_" }
}
exit 1
}
Write-Info "Emulator process started (PIDs: $emulatorProcs)"
}

Copilot uses AI. Check for mistakes.
# Preferred devices in order of priority
$preferredDevices = @("iPhone 16 Pro", "iPhone 15 Pro", "iPhone 14 Pro", "iPhone Xs")
# Preferred iOS versions in order (newest first)
$preferredVersions = @("iOS-18", "iOS-17", "iOS-26")
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

$preferredVersions includes "iOS-26" and the list order contradicts the comment "newest first" (since 26 would be newest but is last). If iOS-26 is a typo, replace it with the intended version; otherwise reorder the list (newest→oldest) so selection matches the comment and expected simulator availability.

Suggested change
$preferredVersions = @("iOS-18", "iOS-17", "iOS-26")
$preferredVersions = @("iOS-18", "iOS-17", "iOS-16")

Copilot uses AI. Check for mistakes.
**Fix:**
1. Run cleanup: `pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore && git checkout HEAD -- .`
2. Retry the attempt
3. If it fails again with the same unrelated error, skip this attempt and continue with the next model
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

This section recommends skipping a try-fix attempt after repeating an "unrelated" build error, but earlier in this doc you require STOP on environment blockers. Repeated unrelated build failures are usually an environment/worktree blocker, so the guidance should be aligned (e.g., treat repeatable unrelated errors as a blocker and STOP/ask user, rather than skipping and continuing).

Suggested change
3. If it fails again with the same unrelated error, skip this attempt and continue with the next model
3. If it fails again with the same unrelated error, treat this as an environment/worktree blocker: STOP the try-fix workflow for this PR, do **not** continue with the next model, and ask the user to investigate and fix the environment before proceeding (see "Stop on Environment Blockers").

Copilot uses AI. Check for mistakes.
@kubaflo kubaflo added the area-ai-agents Copilot CLI agents, agent skills, AI-assisted development label Feb 9, 2026
@PureWeen
Copy link
Copy Markdown
Member

/rebase

Copilot AI and others added 5 commits February 11, 2026 18:18
Changes include:
- Remove stale agent PR session files
- Update claude-opus-4.5 → claude-opus-4.6 references
- Add environment blocker/cleanup rules in post-gate.md
- Enhance Review-PR.ps1 (LogFile, clean state, finalize/summary)
- Add iOS simulator arch detection in Build-AndDeploy.ps1
- Rewrite Start-Emulator.ps1 for better emulator handling
- Fix try-fix SKILL.md (HEAD checkout, no state commits)
- Increase Android emulator boot timeout to 10 min
- Add pr-review-prompt.md template

Excluded: ci-copilot.yml, provision.yml, variables.yml

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Add a sixth model (claude-opus-4.6-fast) to the Phase 4 multi-model try-fix and update documentation and checks to expect 6 models. Updated counts, cross-pollination steps, and model order across: .github/agents/pr.md, .github/agents/pr/PLAN-TEMPLATE.md, .github/agents/pr/SHARED-RULES.md, .github/agents/pr/post-gate.md, and .github/skills/try-fix/SKILL.md. Changes keep behavior the same except for including the new model and adjusting exit/validation checks to 6 models.
…ity fixes

- Fix Windows emulator path (.exe extension) and Get-Command fallback
- Fix bash/pgrep usage on Windows with Get-Process alternative
- Fix /tmp/ hardcoded path with [System.IO.Path]::GetTempPath()
- Fix iOS version comment to 'stable preferred, beta fallback'
- Fix Write-Warning shadowing PowerShell built-in (rename to Write-Warn)
- Fix skip vs STOP contradiction in post-gate.md recovery guidance
- Add git clean -fd to all cleanup/recovery recipes for untracked files
- Remove duplicate architecture detection in Build-AndDeploy.ps1
- Reduce device-appear timeout from 600s to 120s
- Fix selectedVersion displaying wrong runtime in simulator selection
- Add -no-snapshot behavioral change comment
- Add CI/ADO assumption comment for process cleanup
- Revert to 5 models (remove claude-opus-4.6-fast)
@github-actions github-actions bot force-pushed the copilot/create-pr-excluding-yml-ci branch from 9269d44 to 5945d7c Compare February 11, 2026 18:18
@PureWeen PureWeen merged commit a612934 into main Feb 12, 2026
27 checks passed
@PureWeen PureWeen deleted the copilot/create-pr-excluding-yml-ci branch February 12, 2026 02:25
TamilarasanSF4853 pushed a commit to TamilarasanSF4853/maui that referenced this pull request Mar 2, 2026
…low improvements (dotnet#33937)

Improvements to Copilot agent infrastructure scripts, emulator
reliability, and try-fix workflow.

### Agent infrastructure
- Update model references from `claude-opus-4.5` → `claude-opus-4.6` in
`PLAN-TEMPLATE.md` and `SHARED-RULES.md`
- Add environment blocker stop rules and mandatory cleanup between
try-fix attempts in `post-gate.md`
- Prevent `git add -f` of state files in `CustomAgentLogsTmp/` to avoid
data loss on tree restore (`try-fix/SKILL.md`)

### Review-PR.ps1 hardening
- Add `-LogFile` parameter using `Start-Transcript` (replaces external
`tee` pipe that caused hangs)
- Restore working tree to clean state between phases to prevent skill
file corruption
- Run `post-ai-summary-comment.ps1` directly instead of via Copilot CLI
- Write finalize output to separate file to prevent main state file
overwrite

### Emulator/simulator reliability
- Rewrite `Start-Emulator.ps1` with proper Android SDK discovery, AVD
boot detection, and package manager readiness checks
- Add iOS simulator architecture detection (arm64 vs x64) in
`Build-AndDeploy.ps1` with fallback
- Increase Android emulator boot timeout from 2 → 10 minutes in
`android.cake`

### Utility
- Add helper functions in `shared-utils.ps1`

<!-- START COPILOT CODING AGENT SUFFIX -->



<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> Create a pr with all the changes from this branch except the yml ci
changes
> https://github.com/dotnet/maui/tree/copilot-ci


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
evgenygunko pushed a commit to evgenygunko/CopyWordsDA that referenced this pull request Mar 11, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [Microsoft.Extensions.Logging.Debug](https://dot.net/) ([source](https://github.com/dotnet/dotnet)) | nuget | patch | `10.0.3` -> `10.0.4` |
| [Microsoft.Maui.Controls](https://github.com/dotnet/maui) | nuget | patch | `10.0.41` -> `10.0.50` |

---

### Release Notes

<details>
<summary>dotnet/maui (Microsoft.Maui.Controls)</summary>

### [`v10.0.50`](https://github.com/dotnet/maui/releases/tag/10.0.50)

[Compare Source](dotnet/maui@10.0.41...10.0.50)

#### What's Changed

.NET MAUI 10.0.50 introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 78 commits with various improvements, bug fixes, and enhancements.

#### AI

-   Enable packing and independent preview versioning for Essentials.AI by [@&#8203;mattleibow](https://github.com/mattleibow) in dotnet/maui#33976

-   Move Essentials.AI preview iteration to eng/Versions.props by [@&#8203;mattleibow](https://github.com/mattleibow) in dotnet/maui#34025

-   \[Feature] Add Microsoft.Maui.Essentials.AI - Apple Intelligence by [@&#8203;mattleibow](https://github.com/mattleibow) in dotnet/maui#33519

#### Ai Agents

-   Copilot agent infrastructure, emulator reliability, and try-fix workflow improvements by [@&#8203;PureWeen](https://github.com/PureWeen) via [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#33937

-   Update PR agent models to claude-sonnet-4.6 and gpt-5.3-codex by [@&#8203;kubaflo](https://github.com/kubaflo) in dotnet/maui#34109

-   ci-copilot: set pipeline run title early using build.updatebuildnumber by [@&#8203;jfversluis](https://github.com/jfversluis) via [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#34156

-   Revamp find-reviewable-pr skill: priorities, defaults, and doc fixes by [@&#8203;PureWeen](https://github.com/PureWeen) in dotnet/maui#34160

-   Add correct CI pipeline names to Copilot instructions by [@&#8203;jfversluis](https://github.com/jfversluis) in dotnet/maui#34255

-   Add resilience to UI tests for frozen/unresponsive apps by [@&#8203;PureWeen](https://github.com/PureWeen) in dotnet/maui#34023

-   Copilot CI: Structured phase outputs, autonomous execution, iOS support, and CI pipeline by [@&#8203;kubaflo](https://github.com/kubaflo) in dotnet/maui#34040

-   Agent Workflow Metrics via GitHub Labels by [@&#8203;kubaflo](https://github.com/kubaflo) in dotnet/maui#33986

#### Animation

-   \[Android] Fixed TransformProperties issue when a wrapper view is present by [@&#8203;Ahamed-Ali](https://github.com/Ahamed-Ali) in dotnet/maui#29228

    <...
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ai-agents Copilot CLI agents, agent skills, AI-assisted development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants