Repository navigation
fix(mcp): list agents from the configured Windows Agent runtime on the phone's MCP screen - #50330
Conversation
…the phone and paired desktop The phone's MCP screen and a desktop paired to a Windows host asked preflight.detectAgents with no workspace, which the host answers for the native host, while desktop's own MCP pane follows the configured Agent runtime (#18837). An opt-in configuredWindowsRuntime flag resolves that runtime on the host; without it, no identity still means native, and older hosts strip the flag. The phone also retries a failed agents read on focus.
…desktop native Read the agents query state inside the stable focus callback so an error transition cannot re-run it, and drop the paired-desktop scoped inventory: its bucket split native dedupe on hosts where both mean native.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
The phone's MCP servers screen shows which of the computer's agents a server can be turned on for. On a Windows computer set to run agents in WSL (Settings > Agents > Agent runtime), that list showed only the agents installed in Windows itself, so WSL-only agents were missing. Desktop already lists the WSL ones. Now the phone asks for the same runtime desktop uses.
What Changed
preflight.detectAgents,refreshAgentsandinstalledAgentstake an optionalconfiguredWindowsRuntime: true. With it and no workspace, the host probes the configured Windows Agent runtime (localWindowsRuntimeDefault), which is what desktop's own MCP pane probes when nothing is focused ([Bug]: Usage refresh in an SSH workspace overwrites AI Agent visibility with Windows-side detection results #18837).resolveLocalProjectRuntimeForProject(inherit-global). It applies only on Windows with that setting explicitly set; otherwise the answer is native, as today. Combining the field with a workspace, repo or project is refused.Why
MCP servers are delivered per terminal launch, in Windows or in WSL, so the agents a server applies to are the ones in the runtime agents launch in. The host already knew that runtime, but a request with no workspace was answered for the native host. That default has callers that need it, so this is an opt-in field rather than a changed default.
Linked Issue
N/A. This follows #46073: the same assumption (a request with no workspace is answered for the native host) that hid GitLab on the phone.
Visual Proof
N/A. The visible change is the agent list on a Windows host set to WSL, which I can't run from this Mac. The proof is the host-boundary regression test, which runs the real params schema and the real runtime resolver.
Testing
src/main/runtime/rpc/methods/preflight/preflight-workspace-target.test.tscovers three cases. With the field, on Windows with the Agent runtime set to WSL Ubuntu, the host resolves the WSL runtime. Without the setting, and without the field, it stays native. The test fails with the host change reverted.Older hosts: I parsed
{ configuredWindowsRuntime: true }with release v1.4.278's compileddetectAgentsandrefreshAgentsschemas. Both accept the request and drop the key, so older hosts answer native as before.Gates:
pnpm tc:nodeandpnpm check:changedpass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because the same single detection runs per read. Only the host's choice of runtime changes, and only on Windows hosts with the setting.
Risk
Level: Low
AI Disclosure
Review
review-loopran two rounds with Codex and a Claude reviewer, each with a perf pass.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)