Fix DevFlow Android dispatch and diagnose JSON#225
Merged
jfversluis merged 5 commits intoMay 6, 2026
Conversation
Dispatch DevFlow UI work through MAUI/MainThread when needed so Android actions invoked from the agent HTTP server do not touch UI objects from a background thread. Use explicit JSON nodes for devflow diagnose output so --json produces serializable structured output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates DevFlow in two areas: it adjusts agent-side UI dispatching in Agent.Core to better marshal HTTP-triggered UI work onto the UI thread, and it changes maui devflow diagnose --json to build explicit JSON nodes instead of relying on object serialization inside a heterogeneous dictionary.
Changes:
- Added
MainThreadfallback logic and dispatcher helpers inDevFlowAgentServiceso UI actions can still be marshaled safely when the MAUI dispatcher does not require dispatch. - Reworked
diagnose --jsonto emit aJsonObjectwith explicitagentsandprojectsarrays. - Kept the existing human-readable diagnose output while changing the machine-readable path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/DevFlow/Microsoft.Maui.DevFlow.Agent.Core/DevFlowAgentService.cs |
Refactors DispatchAsync to prefer the MAUI dispatcher and fall back to MainThread for UI-bound agent work. |
src/Cli/Microsoft.Maui.Cli/DevFlow/DevFlowCommands.cs |
Replaces dictionary-based diagnose JSON output with explicit JsonObject/JsonArray construction. |
Document Android direct agent status checks, AutomationId-first UI validation, and CalledFromWrongThreadException triage for DevFlow debugging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jfversluis
approved these changes
May 6, 2026
Copilot AI
pushed a commit
that referenced
this pull request
May 6, 2026
* Fix DevFlow Android dispatch and diagnose JSON Dispatch DevFlow UI work through MAUI/MainThread when needed so Android actions invoked from the agent HTTP server do not touch UI objects from a background thread. Use explicit JSON nodes for devflow diagnose output so --json produces serializable structured output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add DevFlow skill troubleshooting guidance Document Android direct agent status checks, AutomationId-first UI validation, and CalledFromWrongThreadException triage for DevFlow debugging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address DevFlow PR review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
Copilot AI
pushed a commit
that referenced
this pull request
May 6, 2026
* Fix DevFlow Android dispatch and diagnose JSON Dispatch DevFlow UI work through MAUI/MainThread when needed so Android actions invoked from the agent HTTP server do not touch UI objects from a background thread. Use explicit JSON nodes for devflow diagnose output so --json produces serializable structured output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add DevFlow skill troubleshooting guidance Document Android direct agent status checks, AutomationId-first UI validation, and CalledFromWrongThreadException triage for DevFlow debugging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address DevFlow PR review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
Copilot AI
pushed a commit
that referenced
this pull request
May 12, 2026
* Fix DevFlow Android dispatch and diagnose JSON Dispatch DevFlow UI work through MAUI/MainThread when needed so Android actions invoked from the agent HTTP server do not touch UI objects from a background thread. Use explicit JSON nodes for devflow diagnose output so --json produces serializable structured output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add DevFlow skill troubleshooting guidance Document Android direct agent status checks, AutomationId-first UI validation, and CalledFromWrongThreadException triage for DevFlow debugging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address DevFlow PR review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
This was referenced Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
maui devflow diagnose --jsonemit explicit JSON nodes for agents/projects instead of relying on unsupported object serializationValidation
dotnet test src/Cli/Microsoft.Maui.Cli.UnitTests/Microsoft.Maui.Cli.UnitTests.csproj --no-restore --filter DevFlow --verbosity minimaldotnet test src/DevFlow/Microsoft.Maui.DevFlow.Tests/Microsoft.Maui.DevFlow.Tests.csproj --no-restore --verbosity minimal0.1.0-devDevFlow packagesmaui devflow ui query --automationId journal-add-entry-buttonfound the button andmaui devflow ui tapreturned success