Repository navigation
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38687Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38687" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Skill Validation Results
❌ Skill Validation Results —
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved critical credential-exposure and moderate configuration-validation issues remain.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds an opt-in, repository-pinned MAUI DevFlow workflow for local Sandbox development and updates Copilot guidance while preserving existing test runners.
Changes:
- Adds conditional DevFlow Agent integration and package pinning.
- Adds launcher, readiness checks, credential isolation, and Pester tests.
- Updates Sandbox, testing, and Copilot documentation and agent routing.
| File | Summary |
|---|---|
src/Controls/samples/Controls.Sample.Sandbox/MauiProgram.cs |
Adds conditional Agent bootstrap. |
src/Controls/samples/Controls.Sample.Sandbox/Maui.Controls.Sample.Sandbox.csproj |
Adds opt-in configuration, references, validation, and cleanup tracking. Moderate (1 vote): UseWorkload is not explicitly validated. |
eng/Versions.props |
Pins DevFlow package versions. |
eng/NuGetVersions.targets |
Applies package version wiring. |
.github/skills/write-ui-tests/SKILL.md |
Updates UI test guidance and DevFlow boundaries. |
.github/skills/verify-tests-fail-without-fix/SKILL.md |
Preserves fail-without-fix verification guidance. |
.github/skills/try-fix/SKILL.md |
Updates fix workflow boundaries. |
.github/skills/run-integration-tests/SKILL.md |
Clarifies integration-test routing. |
.github/skills/run-device-tests/SKILL.md |
Clarifies device-test boundaries. |
.github/skills/maui-devflow/SKILL.md |
Defines the DevFlow workflow. |
.github/skills/maui-devflow/scripts/Start-DevFlowSandbox.Tests.ps1 |
Adds launcher and cleanup tests. |
.github/skills/maui-devflow/scripts/Start-DevFlowSandbox.ps1 |
Implements Sandbox orchestration. Critical (1 vote): trusted credentials remain available while dot-sourcing repository-controlled helper code. |
.github/skills/maui-devflow/references/sandbox.md |
Documents setup and evidence boundaries. Nit (1 vote): the PrivateAssets=all bundle-behavior statement is inaccurate. |
.github/README-AI.md |
Documents DevFlow-first AI workflows. |
.github/instructions/uitests.instructions.md |
Updates UI testing guidance. |
.github/instructions/sandbox.instructions.md |
Replaces legacy Sandbox guidance with DevFlow-first instructions. |
.github/instructions/integration-tests.instructions.md |
Updates integration-test guidance. |
.github/instructions/helix-device-tests.instructions.md |
Preserves Helix device-test boundaries. |
.github/copilot-instructions.md |
Registers the new workflow. Nit (2 votes): references an incorrect Sandbox project path. |
.github/agents/write-tests-agent.agent.md |
Updates test-agent routing. |
.github/agents/sandbox-agent.agent.md |
Routes Sandbox work through DevFlow first. |
| $manifest = Get-Content -LiteralPath $manifestPath -Raw | ConvertFrom-Json -AsHashtable | ||
| $version = $manifest.tools['microsoft.maui.cli'].version | ||
| if (-not $version) { throw 'The repository tool manifest does not pin Microsoft.Maui.Cli.' } | ||
| . (Join-Path $RepoRoot '.github/scripts/shared/shared-utils.ps1') |
|
|
||
| - `src/Controls/samples/Maui.Controls.Sample` - Full gallery sample with all controls and features | ||
| - `src/Controls/samples/Maui.Controls.Sample.Sandbox` - Empty project for testing/reproduction | ||
| - `src/Controls/samples/Maui.Controls.Sample.Sandbox` - Sandbox sample for testing/reproduction; preferred local app for DevFlow-guided manual inspection once the branch includes the Sandbox DevFlow Agent integration |
| if ($Platform -eq 'Android') { | ||
| $connectionSetup += @('--device', $DeviceId) | ||
| # Establish only this serial's forwarding before the app first registers. | ||
| $null = Invoke-DevFlowJson -Arguments (@('devflow', 'list') + $connectionSetup) -RepoRoot $RepoRoot ` |
There was a problem hiding this comment.
❌ Race Condition — devflow list --device repairs Android forwarding for every Agent registered with the shared broker, not only the selected session. If session A is using an Agent port on emulator A, starting this launcher for emulator B can rebind that same host port to B before the new build succeeds, breaking session A. Use read-only broker discovery and forward only the verified fresh-session Agent port; add a two-emulator test that proves existing mappings remain unchanged.
Flagged by: 2/3 reviewers
|
|
||
| Assert-DevFlowBroker -RepoRoot $RepoRoot -LogPrefix (Join-Path $ArtifactDirectory 'broker-before-wait') | ||
| $clock = [Diagnostics.Stopwatch]::StartNew() | ||
| $waitArguments = @('devflow', 'wait', '--project', $project, '--wait-platform', $Platform, '--timeout', "$TimeoutSeconds") + $connectionSetup |
There was a problem hiding this comment.
❌ Resource Leak — The preceding broker health check cannot enforce the documented “foreground broker only” guarantee: the pinned devflow wait and devflow list commands call EnsureBrokerRunningAsync(), which starts a detached replacement if the foreground broker exits in the gap. The launcher can therefore leave an unowned broker running and continue against it. Use a no-auto-start broker/list/wait path or query the already-verified broker directly.
Flagged by: 3/3 reviewers after dispute
| if (-not $agent) { throw [TimeoutException]::new("No Agent matched this build's session '$sessionId'. See $ArtifactDirectory.") } | ||
|
|
||
| $connection = @('--agent-port', [string]$agent.port) + $connectionSetup | ||
| $health = Invoke-DevFlowJson -Arguments (@('devflow', 'agent', 'status') + $connection) -RepoRoot $RepoRoot ` |
There was a problem hiding this comment.
❌ Logic — This loop stops at broker registration, then probes Agent health only once. The pinned Agent registers before its HTTP service is ready, and the client has no transient retry by default, so a connection refusal or running=false during normal startup aborts immediately even when TimeoutSeconds remains. Keep connection failures and not-yet-running status inside the bounded readiness loop, while still rejecting identity mismatches; cover refusal-then-success and running=false-then-success.
Flagged by: 3/3 reviewers after dispute
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review verdict
Found 3 must-fix correctness issues:
- ❌ Android Agent discovery can rebind forwarding owned by another emulator/session. 2/3 reviewers.
- ❌ A broker that exits after the health check can be silently replaced by an unowned detached broker. 3/3 after dispute.
- ❌ Broker registration is accepted before Agent HTTP readiness, and the one-shot health probe can fail during normal startup. 3/3 after dispute.
Test coverage: The focused Pester tests cover argument boundaries, process failures/timeouts, Agent selection, and permanently unhealthy status, but they do not cover two-emulator forwarding isolation, broker disappearance between commands, or transient Agent-health startup states.
Prior review status: One earlier COMMENT review has two open findings (credential exposure while dot-sourcing the helper and an outdated Sandbox path). Those were not duplicated here.
PR metadata: The title and detailed description accurately describe the implementation and its opt-in/fallback boundaries.
Methodology: 3 independent reviewers with adversarial consensus and repository-native MAUI review rules. CI/build status was intentionally out of scope.
|
I compared the workflows to answer whether this change makes local development better, faster, or cheaper for an AI agent. My conclusion is that the measured benefits do not justify adopting and maintaining this integration as the repository's default interactive workflow, and I recommend closing this PR. What I measuredThe comparison used the same instrumented in-tree Sandbox app on an isolated iOS 18.5 simulator, with targeted DevFlow queries versus targeted Appium/native operations. Each path had one excluded warmup and five measured repetitions. The tasks asserted observable state, not just successful requests. These are warm interaction timings, excluding build, deployment, and connection setup.
DevFlow reduced elapsed task time by about 18% for this sequence, but was slower for reset and a single increment. Both paths completed 5/5 final measured repetitions. DevFlow's first attempt encountered a preview CLI For the matched sequence, raw response text was 969 -> 206 Why I would close this
DevFlow has useful capabilities, and the inspection examples in this PR show that. I just do not see enough demonstrated incremental value over the existing workflow to justify this repository-wide adoption. I would keep the current workflow and reconsider a narrower integration if real debugging tasks show repeatable end-to-end time savings, fewer failed attempts, or lower actual agent usage. |
| if (-not (Test-Path -LiteralPath $bundle -PathType Container)) { throw "Built app bundle not found: $bundle" } | ||
| $null = Invoke-DevFlowProcess -Program 'xcrun' -Arguments @('simctl', 'install', $DeviceId, $bundle) ` | ||
| -WorkingDirectory $RepoRoot -LogPrefix (Join-Path $ArtifactDirectory 'install') -TimeoutSeconds 120 | ||
| $null = Invoke-DevFlowProcess -Program 'xcrun' ` |
There was a problem hiding this comment.
❌ Race Condition — A second iOS launch of this project/TFM on another simulator leaves the first app running, but the pinned broker keys Agents only by project + TFM, not by MauiDevFlowSessionId. The registrations therefore replace each other; reconnect and disconnect cleanup can make devflow list flap or lose the live registration, so this launcher's session filter/readiness becomes nondeterministic. Reject an existing live project/TFM instance before launching another device, or make broker registration/removal session-aware, and cover two simulators running the same build.
Flagged by: 3/3 reviewers after dispute
PureWeen
left a comment
There was a problem hiding this comment.
Second adversarial pass found one additional issue:
- ❌ Race Condition — Concurrent iOS Sandbox instances for the same project/TFM collide in the shared broker because session ID is not part of registration identity. 3/3 reviewers after dispute.
The PR head is unchanged, so the previously posted findings remain applicable; they are not duplicated here. The launcher tests do not cover registration ownership across two iOS simulators.
Methodology: 3 independent reviewers with adversarial consensus. Per request, no MAUI build, test run, or CI assessment was performed.


[!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 of Change
Make the repository-pinned MAUI DevFlow CLI the default for local, interactive emulator/simulator work by Copilot, with a working in-tree Sandbox integration rather than documentation alone.
maui-devflowskill and on-demand Sandbox reference. Update the relevant Copilot instructions, agents, and skills to reuse explicit device/app connections, prefer targeted queries and bounded logs, and request screenshots only when useful. Consolidate the Sandbox instructions from 819 to 221 lines; this is a guidance-size reduction, not a measured token-savings claim.EnableMauiDevFlow, disabled by default, for Android/iOS Debug Sandbox builds. Align the Agent with the existing CLI pin, disable optional network capture/profiling, and preserve the in-tree MAUI implementation references. Reject unsupported configurations and stale restore state. Track optional iOS bundle outputs so switching the opt-in off removes the Agent DLLs during normal incremental cleanup.Start-DevFlowSandbox.ps1for one explicitly selected, already-running virtual device and an existing foreground broker. Preserve native failures, strip GitHub/Copilot credentials from child processes, bound execution/readiness, and verify a fresh build session plus app identity before writingready.json. Readiness explicitly does not mean tests passed.Appium/NUnit, XHarness, integration tests, CI, and fail-without-fix verification remain authoritative and unchanged. Document the distinction between DevFlow's semantic activation and native-input regression evidence. Do not instrument HostApp or all test apps, upgrade workloads, install global tools, or perform broad device recovery.
Issues Fixed
N/A — local development tooling and AI workflow improvement; no framework bug or public API change.
Validation
Count: 0toCount: 1transition; also collected bounded logs and screenshots. The temporary UI was removed.Real-issue DevFlow validation: #38649
Scope: On 2026-09-19, the DevFlow workflow in this PR was exercised against the CollectionView header/footer regression in #38649. This is evidence for the tooling adoption, not a claim that this PR contains or closes that framework fix. The framework experiments and 24 new device-test cases remain local, uncommitted, and unpushed. The published PR head is
e7d6b44d0522560d4bec72bf1a7f919bbc765820; its diff does not include the CollectionView fix/tests.Environment and method
Copilot_API_35, serialemulator-5554, Pixel 6 Google Play emulatorcom.microsoft.maui.sandbox, Debug,net10.0-android11.0.100-preview.6.26359.1180.1.0-preview.10.26274.30.1.0-preview.10.26274.3+40fa9a00211aa034ebf299232df3df190c38089d9223; first candidate10223; last Sandbox candidate10225, always with the explicit Android serialThe temporary Sandbox fixture used 120 unchanged items and counted item-template construction. Header/footer replacements used reference-unequal class instances with the same displayed text, so property-change notifications actually ran; equal-valued records can suppress the change. Queries also recorded ItemsSource identity/count, adapter identity, attached holder identities, displayed text, and whether the footer was attached.
Each Sandbox build/launch completed through
Start-DevFlowSandbox.ps1and produced its ownready.jsonbefore inspection. After that readiness boundary, the recorded interactions were DevFlow semantic taps, targetedui querycalls, and a finite log fetch. DevFlow was not substituted for XHarness, and device-test apps were not instrumented with the Agent.Observed before/after behavior
Header text changed 5; 0 additional item viewsThe first candidate was not accepted as complete: DevFlow reproduced the remaining
+2Header constructions in the actual attached Sandbox app, matching the long-list device-test failures. Merely adding a non-null RecyclerView change payload also left those two device-test failures. Directly rebinding the attached templated header/footer, with targeted invalidation for offscreen content, removed the extra constructions in the observed scenarios. These are construction-count measurements, not FPS, latency, or memory benchmarks.Baseline evidence, including an offscreen Footer
Header replacement, with unchanged ItemsSource:
For the explicit offscreen Footer check,
ui query --automationId "Issue38649FooterTextLabel"returned[]both before and after the replacement, while the Header was queryable:The first candidate preserved the adapter but still produced this Header result:
Recorded DevFlow commands and actual responses from the direct-rebind Sandbox run
The original tool-call transcript records the following command at 2026-09-19 17:52:31.048 UTC (19:52:31 CEST). Line wrapping below is only for readability.
dotnet tool run maui -- devflow ui tap \ --automationId "Issue38649ReplaceHeaderButton" \ --agent-port 10225 --platform android --device emulator-5554Actual response, exit code 0:
{"success":true,"action":"Tapped","elementId":"Issue38649ReplaceHeaderButton"}At 17:52:36.650 UTC, the following recorded query ran:
Actual response, exit code 0:
[ { "id": "Issue38649CounterLabel", "type": "Label", "automationId": "Issue38649CounterLabel", "text": "Constructed=9; Baseline=9; Delta=0; VisibleAttached=10; LaidOut=True" } ]The companion adapter query at the same timestamp was:
Its returned
textfield was:Repeated Header replacements continued to report
Delta=0and the same adapter. In some subsequent queries the edge holder at position 9 attached/detached as the viewport settled; positions 0-8 kept their identities. Therefore the evidence is no new item-template constructions, not a claim that the attached-holder list never changes with viewport settling.The offscreen Footer query remained
[]before/after replacement. Its counter stayedConstructed=9; Baseline=9; Delta=0, with the same adapter and exact attached-holder signature.Changing Header data updated the queried text to
Header text changed 5without additional item-template construction. Changing the templates displayedIssue38649TallHeaderRootas a Border andIssue38649HeaderNestedLayoutas a Grid; the adapter changed from101059649to159586203, withConstructed=17; Baseline=9; Delta=8for that intentional structural change.Agent readiness, health, and bounded-log evidence
Relevant fields from
ready.json(host paths omitted):{ "status": "ready", "testsRun": false, "platform": "Android", "deviceId": "emulator-5554", "applicationId": "com.microsoft.maui.sandbox", "agent": { "id": "34eddb19a7f4", "tfm": "net10.0-android", "platform": "Android", "appName": "Sandbox", "port": 10225, "version": "0.1.0-preview.10.26274.3+40fa9a00211aa034ebf299232df3df190c38089d", "connectedAt": "2026-09-19T17:52:05.602752Z" }, "connectionArguments": ["--agent-port", "10225", "--platform", "android", "--device", "emulator-5554"] }Relevant fields from the actual health response:
{ "agent": { "name": "Microsoft.Maui.DevFlow.Agent", "version": "0.1.0-preview.10.26274.3+40fa9a00211aa034ebf299232df3df190c38089d", "framework": ".NET MAUI", "frameworkVersion": "10.0.9" }, "device": { "platform": "Android", "deviceType": "Virtual" }, "app": { "name": "Sandbox", "packageId": "com.microsoft.maui.sandbox" }, "timestamp": "2026-09-19T17:52:06.9075218+00:00", "running": true }The finite DevFlow log fetch included:
Readiness and an Agent health response only establish the connection. The subsequent state queries and separate test results establish the observed behavior.
Independent on-device regression evidence
The Controls CollectionView category was built in Release and executed on
emulator-5554through XHarness. These numbers come from the actual xUnit XML, not the DevFlow ready marker or inferred test attributes.The existing skip is
CellSizeAccountsForMargin. Final xUnit XML reportstotal="81" passed="80" failed="0" skipped="1" errors="0", and XHarness exited 0. The final build succeeded with zero errors and an existing unrelatedxUnit2031warning in SwipeView tests.The 24 new local cases cover Header/Footer updates with 0, 1, 8, and 40 items, grouped/ungrouped sources, stable item-construction and logical-child counts, updated binding contexts/text, offscreen Footer data becoming visible after scrolling, null data with an existing template, grow/shrink measurement, DataTemplateSelector replacement/cleanup, template changes, direct views, removal/restoration, and EmptyView behavior.
Additional issue found by inspection: the last Sandbox pass exposed duplicate logical Header nodes after repeated same-template rebinds and stale compact nodes after a template change. This was not dismissed as successful cleanup: a parent guard was then added to the local holder binding path, and the final on-device suite verified stable logical-child counts and selected-template cleanup. That final guard was verified by XHarness; the full Sandbox sequence was not rerun after it.
Test invocation and runner limitations
Build through the existing repository runner:
Actual execution used a session-local XHarness executable with the following arguments:
The repository verification wrapper ended with
ERROR PARSING TEST RESULTS, so its result is Blocked, notVERIFICATION PASSED. The pinned XHarness required an unavailable .NET 11 RC runtime; a compatible session-localMicrosoft.DotNet.XHarness.CLIversion10.0.0-prerelease.26464.2was used instead, without changing repository manifests or system workloads. The emulator's default instrumentation lookup also failed withInvalid userId -2; explicitly naming the existing instrumentation class resolved that execution problem.The before/after evidence above therefore comes from completed direct XHarness runs and their xUnit XML, not from claiming the blocked wrapper succeeded. No PR CI/Helix result is implied by these local runs.
Evidence provenance, limits, and cleanup
Relevant output is inlined above so readers do not need access to a developer's absolute filesystem paths. Full original artifacts remain local, outside the repository; they have not been uploaded as publicly downloadable artifacts:
issue38649-baseline-20260919-1920issue38649-fixed-sandbox-20260919-1936+2Header construction result, Footer and template-change observationsissue38649-final-sandbox-20260919-1952issue38649-device-tests-{baseline,fixed,final,rebind,verified,verified2}finalis an intermediate failing run, not the final successissue38649-device-verified2-build.log,issue38649-xharness-verified2.logFor the recorded tap/counter/adapter sequence, the original transcript event IDs are
08eb6be7-8cd0-4c64-a7a4-838d6188fbff,8527602d-20ac-44e6-9a8c-712c327da650, andfab78257-ebc0-42cd-90e6-331b2ed72f5frespectively. Unrelated historical app log entries and absolute host paths are intentionally not published.This validates DevFlow semantic interaction and inspection on an Android API 35 emulator, not physical taps, native hit-testing, accessibility, or behavior on the reporter's physical Android 9 device. The temporary Sandbox fixture was restored; the session-owned broker was stopped, while the emulator was left running without disrupting other sessions. Only local framework/test changes for #38649 remain; none were committed or pushed into this PR.