Repository navigation
fix(devserver): make the selected solution authoritative - #25702
Conversation
The MCP bridge's monitor rescans the effective workspace directory (the folder of the nearest Uno global.json) three levels deep on every cycle, and only used the resolved solution when that rescan listed it. A solution deeper than the scan was replaced by the first scanned solution in sorted order, and a workspace whose only solution was deeper never launched (SolutionNotFound). A repository with the app solution four levels below global.json and a library-only solution higher up got the host started on the library solution, so no app ever connected. DetermineSolutionToLaunch now returns the resolved solution whenever it exists on disk, taking the scanned path when listed to keep its on-disk casing; the sorted fallback applies only when no existing solution is resolved. The monitor decides the solution before its no-solution gate, reports a resolved solution the scan missed in DiscoveredSolutions, and logs a warning when a fallback overrides a selection or picks among several unselected solutions. Refs #25524
uno_app_select_solution rejected any solution outside a three-level scan of the session's workspace, so the agent could not pick a solution deeper than the scan, outside the directory the bridge started in, or one the scan never listed. Discovery now helps choose instead of restricting: the candidate scan only feeds the suggestions uno_health reports. A selection is rejected only when it cannot work: a relative, invalid, network (UNC) or device path, a file that is not a .sln or .slnx, a missing file, or a solution whose nearest global.json declares no Uno SDK, since the DevServer cannot start for it. That last rejection names the global.json that applies, or says there is none, and asks to select again rather than restart the bridge. Network and device paths are refused before any file-system access, here and for uno_app_initialize's workspaceDirectory: probing one authenticates the user to the remote server, and accepting it would load code from that share. The tool descriptions and the WorkspaceAmbiguous remediation say selection is free, and uno_app_initialize returns a rejected solutionPath, noting that the workspace itself was applied, instead of discarding it. Refs #25524
A file change in the workspace (global.json, a solution file, or the project.assets.json any dotnet restore writes) re-ran auto-discovery on the directory the session observes and ignored the selection: the session restarted on whatever discovery picked, or stopped when it found several solutions. A solution chosen explicitly now stays in place until another one is selected. WorkspaceResolution gains IsExplicitSolutionSelection, set only when a solution path is resolved (uno_app_select_solution), not by a directory override such as --solution-dir. File changes re-resolve that solution: an SDK change in its global.json restarts the same solution, and a solution that no longer resolves (deleted, or its global.json lost the Uno SDK) degrades the session while staying selected, so it starts again once it is back. A selected solution is watched in its own workspace, or, while it does not resolve, from the folder of its nearest global.json or nearest existing folder; candidate suggestions keep coming from the directory the session observed when the solution was selected. Refs #25524
MCP roots drove the session: roots naming another workspace while one ran degraded it, and roots arriving after an explicit selection could replace it. MCP roots are deprecated (SEP-2577, MCP 2026-07-28) and only hint at a workspace. WorkspaceTransitionDecisions returns a new Ignore action for roots that would override an explicitly selected solution (even one that does not resolve right now), or replace or degrade another workspace whose DevServer runs; the session logs it and keeps its workspace. Before any DevServer starts (deferred roots startup, uno_app_initialize), roots still decide where it starts: a resolved roots workspace now starts instead of leaving the unused startup one in place, which waited for a connection that never came. Refs #25524
With MCP roots deprecated, an MCP server configuration needs another way to name the solution to serve: `--mcp-app --solution <path>` (or `mcp serve --solution <path>`) selects it explicitly at startup, as uno_app_select_solution does, and it stays selected across file changes. It wins over --solution-dir, and it does not wait for roots under --force-roots-fallback since roots could not change it. The option was previously forwarded as is to the DevServer host, after the bridge's own --solution. The bridge now consumes every spelling the host's command-line configuration reads as that key (--solution=path, /solution, any casing), refuses it when given more than once, and applies the checks uno_app_select_solution does, now shared in SolutionPathRules: a local path to an existing .sln or .slnx. An unusable path exits with code 2. An explicit selection that does not resolve now keeps its path in the resolution, so it stays selected, watched and reported until its global.json declares the Uno SDK. Refs #25524
A change of the Uno SDK version in the global.json of an explicitly selected solution restarts the DevServer on that same solution with the new SDK; this pins it, as the workspace transition matrix of spec 001 states. Refs #25524
uno_app_select_solution accepts any local .sln/.slnx whose nearest global.json declares the Uno SDK, candidates are suggestions, an explicit selection (the tool or --solution) stays in place across file changes and MCP roots, and MCP roots, now deprecated, only hint where the DevServer starts. The health diagnostics, the dev-server and MCP articles (which now list uno_app_select_solution among the always-available tools), the devserver skill, and the workspace resolution and transition matrices of spec 001 (including the Ignore and Diagnose actions) say so; spec 002 and the CLI reference list --solution. Refs #25524
LocalPathGuard refused roots starting with two separators, which \??\UNC\server\share bypassed: probing it authenticates the user to that server. On Windows it now accepts only a drive-rooted path (X:\), so no UNC, device or NT-namespace prefix gets through. MCP roots are now guarded too, after normalization to a full path; a refused or unresolvable root (including one containing NUL) falls through to the next one. The workspaceDirectory of uno_app_initialize is checked on its full path, so \repo on the current drive is accepted.
When an explicitly selected solution (uno_app_select_solution, --solution, or the solutionPath of uno_app_initialize) no longer exists, the monitor fell back to the first scanned solution, serving one the user did not choose. It now launches nothing and reports the solution missing until it exists again or another is selected; the warning is logged once until then, not every rescan. Auto-discovered selections keep the sorted fallback.
uno_app_initialize applied workspaceDirectory as the MCP roots before selecting its optional solutionPath, so the roots could start another solution first, and a rejected selection claimed the workspaceDirectory was being served even when the roots were ignored. The solution is now selected first, with candidate solutions suggested from workspaceDirectory; the roots applied next are ignored once a selection is explicit. The answer reports the workspace and solution actually served (no workspace while an explicit selection does not resolve), and a rejection points to uno_health instead of guessing.
uno_app_select_solution, the --solution warning and uno_health each explained a selection that does not resolve differently, and health gave none at all: it said to wait for a host that would not come. One issue now names the cause (missing file, the nearest global.json without a usable Uno SDK, or no global.json), keeps the WorkspaceNotResolved code, and says whether fixing it is enough (a kept selection) or the solution must be selected again (a rejected one). uno_health raises it for an explicit selection that does not resolve or whose file the monitor no longer finds, instead of the wait advice; the monitor's flag is reset between runs so it cannot outlive its selection.
The DevServer host reads its configuration from the command line, where a bare solution=path sets the same key as --solution. Forwarded by the MCP bridge after its own --solution, it replaced the bridge's choice without its checks; the bridge now consumes it like the other spellings. A bare "solution" with no value stays a positional argument. The docs state the limits of a selection: --solution must be a usable local solution (exit code 2 otherwise), and MCP roots never replace an explicit selection or a workspace whose DevServer runs or failed, use the first local root, and ignore roots on a network share.
No behavior change. Tests call ProxyLifecycleManager's GetWorkspaceObservationRoot and EnsureDevServerStartedFromSolutionDirectory (now internal) instead of reflecting on them, and one more test reuses the deep-layout and session helpers. ResolveSolutionAsync builds its unresolved result in one place, SelectSolutionAsync's path rejections share RejectPath, and IsSolutionFile reads the extension once.
CSpell rejects "unstarted" in using-the-uno-mcps.md, which failed the docs and CI validations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25702/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241283 found UI Test snapshots differences: Details
|
|
|
|
C:/Program Files/Git/azp run |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25702/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241406 found UI Test snapshots differences: Details
|
|
@Mergifyio backport servicing/6.8 |
Drop null-conditionals on values already known non-null and stop Path.Combine from silently dropping a base path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25702/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241587 found UI Test snapshots differences: Details
|
Clears the remaining code scanning findings on the test helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25702/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241602 found UI Test snapshots differences: Details
|
Clears the last code scanning findings on this change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25702/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241615 found UI Test snapshots differences: Details
|
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25702/docs/index.html |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
The build 241627 found UI Test snapshots differences: Details
|
|
@Mergifyio backport release/stable/6.7 |
✅ Backports have been createdDetails
Cherry-pick of 4bc1ea3 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Keeps the 6.7 text of the --solution-dir option and adds the --solution option line that #25702 adds. The other lines in the conflict came from earlier master-only doc changes and stay out of 6.7. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r-25702 fix(devserver): make the selected solution authoritative (backport #25702)
GitHub Issue: closes #25524
This PR carries @carldebilly's commits from #25613 unchanged, plus one commit that fixes the spell-check failure stopping that draft's CI. The add-in discovery part of #25524 is a separate PR, #25700 (closes #24311). Both are needed for the reported layout to get MCP tools.
PR Type:
🐞 Bugfix
What changed? 🚀
The DevServer MCP bridge (
dnx uno.devserver --mcp-app) could resolve the right solution, then launch the host with another one. In a repo where a library solution sits within the depth-3 scan and the app solution sits deeper, the host got the library solution. No app registered, and the DevServer port was written into the library's.csproj.user.Three things combined to cause this:
uno_app_select_solutionrefused any solution outside that depth-3 scan.dotnet restorewas enough.A chosen solution is now authoritative. Discovery suggests candidates but never restricts the choice. From #25613:
uno_app_select_solutionaccepts the absolute path of any.sln/.slnxon a local drive whose nearestglobal.jsondeclares the Uno SDK, inside or outside the workspace. Network, device and NT-namespace paths are refused before any file-system access.uno_healthsays why.--solution <path>for the MCP bridge selects the solution at startup, the same way the tool does.uno_app_initializeselects itssolutionPathbefore applyingworkspaceDirectory. Its result reports the workspace and solution actually served.On top of that,
docs(devserver): reword "unstarted" for the spell checkchanges one word indoc/articles/features/using-the-uno-mcps.md. CSpell rejected "unstarted" (line 215), which failed bothUno.UI - CI (Setup Validations)andUno.UI - docson #25613. The test stages behind those validations never ran there.Agent-visible changes, from #25613:
uno_app_initialize'sworkspaceDirectoryresult field now reports the served workspace instead of echoing the argument, and asolutionPathfield was added.solution=xargument is now validated and consumed instead of reaching the host.\wsl.localhost\...) are refused as selections and ignored as roots.Validation
Uno.UI.DevServer.Cli.Testsand 137 in the MCP subset ofUno.UI.RemoteControl.DevServer.Tests. It also reports an end-to-end run on the reported layout that servedApp.slnxin 7 of 7 checks, against 2 of 7 onmaster.Uno.UI.DevServer.Cli.Testson .NET 11 RC2: 511 of 514 tests passed. The 2 failures,Given_McpRootsFallbackProcess.*_DeferredDevServerStarts, also fail on unmodifiedmasterin my checkout. They need theSolutionTemplateworkspace, which my sparse checkout leaves out.PR Checklist ✅
dev-server.md,using-the-uno-mcps.md,health-diagnostics.md, the devserver skill, spec appendices)Screenshots Compare Test Runresults. (DevServer only; no UI change)🤖 Generated with Claude Code