Support profile-scoped WSL ACP agent backends - #481
Merged
Conversation
Preserve the Windows-hosted global agent as the default and fallback while allowing profiles to select agents installed in their own WSL distro. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
Render AgentEntry labels with x:Bind and generate one logical option per host or WSL backend while preserving global inheritance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
Contributor
There was a problem hiding this comment.
Pull request overview
Adds per-profile selection of an ACP agent pane “backend” (Windows host vs a specific profile’s WSL distro) while preserving the existing Windows-hosted global agent as the default and as a fallback when an in-distro backend can’t start. This extends the helper/master architecture to spawn ACP agents and related terminal tooling inside WSL, and surfaces the resolved backend in UI/metadata.
Changes:
- Introduces
agentPaneBackendas an inheritable profile setting + schema support, plus Settings UI to pick between host agents and the profile’s WSL distro agents. - Adds WSL-aware backend plumbing in WTA (agent source model, WSL executable probing, WSL spawning, cwd normalization, and fallback signaling).
- Updates agent pane UI/status to display backend and adds localized non-blocking fallback notice text.
Reviewed changes
Copilot reviewed 136 out of 136 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/wta/src/ui/setup.rs | Shows “Select agent” title for the new setup option entry. |
| tools/wta/src/ui/layout.rs | Renders an agent popup overlay when present. |
| tools/wta/src/ui/agent_popup.rs | Marks “current agent” using both agent id and source. |
| tools/wta/src/slash_command_tests.rs | Extends switch-agent event tests to include source + distro fields. |
| tools/wta/src/shell/shell_manager.rs | Adds AgentSource to wrap tool launches via wsl.exe for WSL-backed tabs; improves Windows cmdline quoting. |
| tools/wta/src/session_registry.rs | Carries agent source + fallback metadata through ACP _meta.wta. |
| tools/wta/src/protocol/acp/spawn.rs | Adds WSL agent process spawning and robust shell-quoting launch script. |
| tools/wta/src/protocol/acp/client.rs | Plumbs agent source/cwd into helper↔master init and uses resolved backend metadata to configure tool launching + UI events. |
| tools/wta/src/master/mod.rs | Pools agent CLIs by (source, command), resolves requested backend with trusted host fallback, and reports session location. |
| tools/wta/src/main.rs | Adds hidden CLI flags for per-tab backend selection and a probe-agent-sources command for Settings UI. |
| tools/wta/src/cli_tests.rs | Adds CLI parsing tests for per-tab source flags and updates WSL probe-script tests. |
| tools/wta/src/agent_source.rs | New: agent execution source model + WSL cwd normalization and home resolution. |
| tools/wta/src/agent_check.rs | Adds WSL-native executable probing and source-aware agent checks. |
| tools/wta/locales/af-ZA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/am-ET.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ar-SA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/as-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/az-Latn-AZ.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/bg-BG.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/bn-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/bs-Latn-BA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ca-ES.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ca-Es-VALENCIA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/cs-CZ.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/cy-GB.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/da-DK.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/de-DE.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/el-GR.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/en-US.yml | Adds system.agent_source_fallback string + comment. |
| tools/wta/locales/en-GB.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/es-ES.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/es-MX.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/et-EE.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/eu-ES.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/fa-IR.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/fi-FI.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/fil-PH.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/fr-FR.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/fr-CA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ga-IE.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/gd-gb.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/gl-ES.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/gu-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/he-IL.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/hi-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/hr-HR.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/hu-HU.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/hy-AM.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/id-ID.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/is-IS.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/it-IT.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ja-JP.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ka-GE.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/kk-KZ.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/km-KH.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/kn-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ko-KR.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/kok-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/lb-LU.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/lo-LA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/lt-LT.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/lv-LV.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/mi-NZ.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/mk-MK.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ml-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/mr-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ms-MY.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/mt-MT.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/nb-NO.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ne-NP.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/nl-NL.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/nn-NO.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/or-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/pa-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/pl-PL.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/pt-BR.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/pt-PT.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/qps-ploc.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/qps-ploca.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/qps-plocm.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/quz-PE.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ro-RO.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ru-RU.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/sk-SK.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/sl-SI.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/sq-AL.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/sr-Cyrl-BA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/sr-Cyrl-RS.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/sr-Latn-RS.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/sv-SE.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ta-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/te-IN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/th-TH.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/tr-TR.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/tt-RU.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ug-CN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/uk-UA.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/ur-PK.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/uz-Latn-UZ.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/vi-VN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/zh-CN.yml | Adds system.agent_source_fallback localization. |
| tools/wta/locales/zh-TW.yml | Adds system.agent_source_fallback localization. |
| src/cascadia/UnitTests_SettingsModel/ProfileTests.cpp | Adds a unit test for backend defaulting/inheritance and parsing. |
| src/cascadia/TerminalSettingsModel/Profile.idl | Adds inheritable AgentPaneBackend to the profile model. |
| src/cascadia/TerminalSettingsModel/MTSMSettings.h | Adds agentPaneBackend to the settings macro list. |
| src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw | Adds UI strings for profile “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/de-DE/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/es-ES/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/fr-FR/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/it-IT/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/ja-JP/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/ko-KR/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/pt-BR/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/qps-ploc/Resources.resw | Adds pseudo-locale UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/qps-ploca/Resources.resw | Adds pseudo-locale UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/qps-plocm/Resources.resw | Adds pseudo-locale UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/ru-RU/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/sr-Cyrl-RS/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/uk-UA/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/zh-CN/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/Resources/zh-TW/Resources.resw | Adds localized UI strings for “Agent pane backend”. |
| src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl | Exposes backend list + selected backend to Settings UI. |
| src/cascadia/TerminalSettingsEditor/ProfileViewModel.h | Adds members/methods for backend list and async WSL probing. |
| src/cascadia/TerminalSettingsEditor/ProfileViewModel.cpp | Builds host/WSL backend option list and probes WSL-installed agents via WTA. |
| src/cascadia/TerminalSettingsEditor/Profiles_Base.xaml | Adds the backend ComboBox to the profile “General” page. |
| src/cascadia/TerminalApp/TerminalPage.h | Expands agent settings snapshot to include per-profile backends. |
| src/cascadia/TerminalApp/TerminalPage.cpp | Applies profile backend selection, enforces active-pane WSL compatibility, passes source args to helper, and forwards backend status to UI. |
| src/cascadia/TerminalApp/Tab.h | Stores per-tab override source + WSL distro for /agent switches. |
| src/cascadia/TerminalApp/AgentPaneContent.idl | Extends status update API to include backend string. |
| src/cascadia/TerminalApp/AgentPaneContent.h | Stores backend and includes it in status updates. |
| src/cascadia/TerminalApp/AgentPaneContent.cpp | Renders backend in the agent pane header. |
| src/cascadia/inc/WslShellIntegration.h | Adds ResolveDistroName helper for WSL profile command lines. |
| src/cascadia/inc/AgentPaneBackend.h | New: parser/format helpers for host:<id> and wsl:<distro>:<id>. |
| README.md | Documents per-tab /agent behavior and per-profile backend setting with fallback. |
| doc/cascadia/profiles.schema.json | Adds agentPaneBackend to the profile schema with validation pattern. |
This comment has been minimized.
This comment has been minimized.
Keep the global Windows agent only as the unconfigured default. Explicit profile selections now fail in place instead of falling back, and the setting is labeled Agent pane agent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
This comment has been minimized.
This comment has been minimized.
Launch source-discovery wsl.exe probes without a console so they cannot corrupt crossterm arrow-key input in the agent pane. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
This comment has been minimized.
This comment has been minimized.
Retry the bounded command lookup with a fresh wsl.exe process so the first attempt can wake a stopped distro without being misreported as an uninstalled agent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
This comment has been minimized.
This comment has been minimized.
Generate the Agent pane agent header and profile precedence description with the repository pseudo-localization mapping for all qps locales. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
This comment has been minimized.
This comment has been minimized.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 47 out of 47 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tools/wta/src/app.rs:2881
/agent <arg>still tries to match bydisplay_name, but host entries now append a " — Windows" suffix. This makes previously-valid inputs like/agent GitHub Copilotstop matching (you’d have to include the suffix). Consider also matching against the pre-suffix portion so direct switching remains ergonomic.
Handle global-host aliases, WSL UNC roots, ConPTY-safe home probes, base agent display names, and the Bash norc spelling expectation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
Track the stable source profile across helper recreation and tab moves, include profile defaults in backend snapshots, and avoid reopening unaffected active tabs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
Spawn wsl.exe with CREATE_NO_WINDOW so ACP agents cannot attach to a console, corrupt input modes, or flash a window in diagnostic master launches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4ea5b4d6-de06-4331-93dc-3b45561a1a53
Comment on lines
+361
to
+366
| std::wstring escapedDistro{ distro }; | ||
| for (size_t pos = 0; (pos = escapedDistro.find(L'"', pos)) != std::wstring::npos; pos += 2) | ||
| { | ||
| escapedDistro.replace(pos, 1, L"\"\""); | ||
| } | ||
| const auto args = L"probe-agent-sources --wsl-distro \"" + escapedDistro + L"\""; |
Kai Tao (vanzue)
approved these changes
Jul 24, 2026
Yuandi (DDKinger)
added a commit
that referenced
this pull request
Aug 3, 2026
Add Feature.DelegateSource.Tests.ps1 (mirrors #481's Feature.WslAgentBackend): a profile's Command palette agent selects an exact delegate execution source, so `wta delegate` always receives an explicit --delegate-source and never re-routes itself. - An explicit --delegate-source wsl selection never falls back to the Windows host when the agent is missing in that distro (regression positive for the removed wsl_agent_available==false fallback). - The default/host source is never diverted to WSL even when a runnable distro is present (guards the removed active-pane WSL inference). TerminalPage.cpp's profile resolution is only reachable via non-injectable UI (Alt+Shift+B / Alt+Shift+/ / ?<prompt>), so — exactly like Feature.Delegate — these cases drive the delegate engine directly with the flags it now passes. Validated live against a freshly built #488 wta.exe; case 1 reproduces the pre-fix failure when run against a wta.exe built from main. Track C244 (picker UI, stays manual like C237) and C245 (routing strictness, mapped to this suite in release-coverage-map.psd1). IDs via Set-ChecklistIds.ps1. Based on the unmerged #488 head 528251a. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 02129b5b-f6fb-46e0-ab80-c2b9d6798f89
Yuandi (DDKinger)
added a commit
that referenced
this pull request
Aug 4, 2026
Add Feature.DelegateSource.Tests.ps1 (mirrors #481's Feature.WslAgentBackend): a profile's Command palette agent selects an exact delegate execution source, so `wta delegate` always receives an explicit --delegate-source and never re-routes itself. - An explicit --delegate-source wsl selection never falls back to the Windows host when the agent is missing in that distro (regression positive for the removed wsl_agent_available==false fallback). - The default/host source is never diverted to WSL even when a runnable distro is present (guards the removed active-pane WSL inference). TerminalPage.cpp's profile resolution is only reachable via non-injectable UI (Alt+Shift+B / Alt+Shift+/ / ?<prompt>), so — exactly like Feature.Delegate — these cases drive the delegate engine directly with the flags it now passes. Validated live against a freshly built #488 wta.exe; case 1 reproduces the pre-fix failure when run against a wta.exe built from main. Track C244 (picker UI, stays manual like C237) and C245 (routing strictness, mapped to this suite in release-coverage-map.psd1). IDs via Set-ChecklistIds.ps1. Based on the unmerged #488 head 528251a. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 02129b5b-f6fb-46e0-ab80-c2b9d6798f89
Yuandi (DDKinger)
added a commit
that referenced
this pull request
Aug 4, 2026
…#537) Add Feature.DelegateSource.Tests.ps1 (mirrors #481's Feature.WslAgentBackend): a profile's Command palette agent selects an exact delegate execution source, so `wta delegate` always receives an explicit --delegate-source and never re-routes itself. - An explicit --delegate-source wsl selection never falls back to the Windows host when the agent is missing in that distro (regression positive for the removed wsl_agent_available==false fallback). - The default/host source is never diverted to WSL even when a runnable distro is present (guards the removed active-pane WSL inference). TerminalPage.cpp's profile resolution is only reachable via non-injectable UI (Alt+Shift+B / Alt+Shift+/ / ?<prompt>), so — exactly like Feature.Delegate — these cases drive the delegate engine directly with the flags it now passes. Validated live against a freshly built #488 wta.exe; case 1 reproduces the pre-fix failure when run against a wta.exe built from main. Track C244 (picker UI, stays manual like C237) and C245 (routing strictness, mapped to this suite in release-coverage-map.psd1). IDs via Set-ChecklistIds.ps1. Based on the unmerged #488 head 528251a. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 02129b5b-f6fb-46e0-ab80-c2b9d6798f89
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
wsl.execannot corrupt arrow-key input in the/agentpicker./agentsource-aware and scoped to the active Windows host/current WSL distro, including GPO enforcement and session-location propagation.Settings behavior
agentPaneBackendkeeps current behavior and uses the global Windows agent.host:<agent-id>orwsl:<distro>:<agent-id>.Validation
x86_64-pc-windows-msvc).TerminalSettingsEditor,TerminalApp,TerminalControl, andCascadiaPackageDebug builds succeeded.ProfileTests::AgentPaneBackendDefaultsAndInheritsTAEF test passed.Closes #349, #302