Skip to content

Fix DevFlow Android dispatch and diagnose JSON#225

Merged
jfversluis merged 5 commits into
dotnet:mainfrom
Redth:redth/devflow-android-dispatch-diagnose-json
May 6, 2026
Merged

Fix DevFlow Android dispatch and diagnose JSON#225
jfversluis merged 5 commits into
dotnet:mainfrom
Redth:redth/devflow-android-dispatch-diagnose-json

Conversation

@Redth

@Redth Redth commented May 5, 2026

Copy link
Copy Markdown
Member

Summary

  • dispatch DevFlow UI work through MAUI/MainThread when needed so Android HTTP agent actions can safely touch UI objects
  • make maui devflow diagnose --json emit explicit JSON nodes for agents/projects instead of relying on unsupported object serialization

Validation

  • dotnet test src/Cli/Microsoft.Maui.Cli.UnitTests/Microsoft.Maui.Cli.UnitTests.csproj --no-restore --filter DevFlow --verbosity minimal
  • dotnet test src/DevFlow/Microsoft.Maui.DevFlow.Tests/Microsoft.Maui.DevFlow.Tests.csproj --no-restore --verbosity minimal
  • CoffeeJournal Android app restored/built and validated with local 0.1.0-dev DevFlow packages
  • runtime v1 check: maui devflow ui query --automationId journal-add-entry-button found the button and maui devflow ui tap returned success

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>
Copilot AI review requested due to automatic review settings May 5, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 MainThread fallback logic and dispatcher helpers in DevFlowAgentService so UI actions can still be marshaled safely when the MAUI dispatcher does not require dispatch.
  • Reworked diagnose --json to emit a JsonObject with explicit agents and projects arrays.
  • 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.

Comment thread src/DevFlow/Microsoft.Maui.DevFlow.Agent.Core/DevFlowAgentService.cs Outdated
Comment thread src/DevFlow/Microsoft.Maui.DevFlow.Agent.Core/DevFlowAgentService.cs Outdated
Comment thread src/Cli/Microsoft.Maui.Cli/DevFlow/DevFlowCommands.cs
Comment thread src/Cli/Microsoft.Maui.Cli/DevFlow/DevFlowCommands.cs Outdated
Redth and others added 4 commits May 5, 2026 15:52
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 jfversluis merged commit ca4aa26 into dotnet:main May 6, 2026
8 checks passed
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>
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.

3 participants