Skip to content

Detect NVM-installed agents in WSL - #563

Open
Yuandi (DDKinger) wants to merge 1 commit into
mainfrom
dev/yuazha/fix-wsl-nvm-agent-detection
Open

Detect NVM-installed agents in WSL#563
Yuandi (DDKinger) wants to merge 1 commit into
mainfrom
dev/yuazha/fix-wsl-nvm-agent-detection

Conversation

@DDKinger

Copy link
Copy Markdown
Contributor

Summary

  • Probe WSL agents through an interactive login shell so NVM and other .bashrc-initialized version managers contribute to PATH.
  • Use type -P and require an absolute non-/mnt path, excluding aliases, functions, relative commands, and Windows interop executables.
  • Launch WSL ACP agents, delegates, historical-session scans, and resumed sessions through the same interactive login environment while suppressing shell startup output before ACP begins.

Root cause

PR #481 used bash -lc, which loads login profiles but is non-interactive. A standard NVM install initializes from .bashrc, so /home/<user>/.nvm/versions/node/<version>/bin was absent during both discovery and launch even though command -v copilot worked in an interactive WSL terminal.

Validation

  • cargo test --manifest-path tools/wta/Cargo.toml — 1422 passed.
  • Reproduced with Copilot at /home/yuazha/.nvm/versions/node/v24.19.0/bin/copilot in Ubuntu-22.04.
  • Verified the updated probe resolves the NVM path and the wrapped WSL launch runs copilot --version successfully.

Use interactive login shells for WSL agent discovery and launch so version managers initialized from .bashrc are available. Keep ACP stdout clean and reject aliases, relative commands, and Windows interop paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 07:52

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 improves WSL ACP agent discovery and launch reliability by running WSL-side probes and ACP launches through an interactive login shell (bash -lic) so .bashrc-initialized version managers (notably NVM) contribute to PATH, while also preventing shell startup output from corrupting ACP stdio.

Changes:

  • Switch WSL agent probing from command -v to type -P and require an absolute, non-/mnt resolved path to avoid aliases/functions/relative paths and Windows interop executables.
  • Launch WSL ACP processes (session history scan + agent spawn) via an outer clean shell (bash --noprofile --norc -c …) that suppresses startup stdout until the inner shell execs the agent.
  • Update delegation/resume-related commandlines and tests to consistently use bash -lic.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/wta/src/wsl_acp.rs Runs WSL historical ACP session discovery via bash -lic with startup-stdout suppression to protect ACP framing.
tools/wta/src/protocol/acp/spawn.rs Launches WSL ACP agent processes via bash -lic (and keeps the stdout-preservation wrapper).
tools/wta/src/coordinator.rs Updates documentation/comments to reflect bash -lic semantics in WSL delegation escaping.
tools/wta/src/cli/delegate.rs Uses bash -lic for explicit WSL delegation launch commandlines.
tools/wta/src/cli_tests.rs Updates probe-script expectations to type -P and clarifies intent in test naming/comments.
tools/wta/src/app.rs Uses bash -lic when resuming WSL sessions to pick up NVM/login PATH.
tools/wta/src/app_tests.rs Updates resume commandline assertions to expect bash -lic.
tools/wta/src/agent_check.rs Probes with bash -lic + type -P and tightens native-path validation to absolute non-/mnt.

.arg("--")
.arg("bash")
.arg("-lc")
.arg("-lic")
Comment thread tools/wta/src/app.rs Outdated
assert!(
argv.contains(
"wsl -d Ubuntu --cd \"/home/u/proj\" -- bash -lc \"copilot --resume abc-123\""
"wsl -d Ubuntu --cd \"/home/u/proj\" -- bash -lic \"copilot --resume abc-123\""
///
/// Explicit WSL delegation launches the agent inside the selected distro
/// (`wsl -d <distro> -- bash -lc "<agent> …"`). Re-probe immediately before
/// (`wsl -d <distro> -- bash -lic "<agent> …"`). Re-probe immediately before
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

check-spelling-bot Report

⚠️ Dictionary not found

Problems were encountered retrieving check dictionaries (cspell:cpp/src/lang-jargon.txt cspell:django/dict/django.txt cspell:python/src/common/extra.txt cspell:public-licenses/src/generated/public-licenses.txt cspell:redis/dict/redis.txt cspell:ruby/dict/ruby.txt cspell:lua/dict/lua.txt cspell:cpp/src/stdlib-cpp.txt cspell:html/dict/html.txt cspell:haskell/dict/haskell.txt cspell:swift/src/swift.txt cspell:scala/dict/scala.txt cspell:css/dict/css.txt cspell:cpp/src/compiler-msvc.txt cspell:docker/src/docker-words.txt cspell:dart/src/dart.txt cspell:sql/src/tsql.txt cspell:php/dict/php.txt cspell:python/src/python/python-lib.txt cspell:software-terms/dict/webServices.txt cspell:shell/dict/shell-all-words.txt cspell:powershell/dict/powershell.txt cspell:python/src/python/python.txt cspell:ada/dict/ada.txt cspell:typescript/dict/typescript.txt cspell:python/src/additional_words.txt cspell:public-licenses/src/additional-licenses.txt cspell:elixir/dict/elixir.txt cspell:golang/dict/go.txt cspell:cpp/src/stdlib-c.txt cspell:dotnet/dict/dotnet.txt cspell:k8s/dict/k8s.txt cspell:node/dict/node.txt cspell:sql/src/sql.txt cspell:cpp/src/lang-keywords.txt cspell:cpp/src/stdlib-cmath.txt cspell:cpp/src/compiler-gcc.txt cspell:clojure/src/clojure.txt cspell:java/src/java-terms.txt cspell:npm/dict/npm.txt cspell:svelte/dict/svelte.txt cspell:java/src/java.txt cspell:rust/dict/rust.txt cspell:software-terms/dict/softwareTerms.txt cspell:latex/dict/latex.txt cspell:cpp/src/stdlib-cerrno.txt cspell:gaming-terms/dict/gaming-terms.txt cspell:cpp/src/people.txt cspell:cpp/src/template-strings.txt cspell:fullstack/dict/fullstack.txt cspell:r/src/r.txt cspell:monkeyc/src/monkeyc_keywords.txt cspell:cpp/src/ecosystem.txt cspell:cpp/src/compiler-clang-attributes.txt).

⚠️ For more information, see check-dictionary-not-found.

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (1)

lic

These words are not needed and should be removed AHP aiu Backgrounder CANTCALLOUT Ccc cplusplus ctl Debian depl dotnet drv endptr EOFs evt frob frobnicate Fullwidth gitlab hdr idl IME inbox ININPUTSYNCCALL INJ intelligentterminal Ioctl KVM lbl lld lsb NODEFAULT NONINFRINGEMENT notif oss outdir Podcast pri prioritization rcv segfault SND sourced SWP Tbl testname transitioning unk unparseable unregisters Virt VMs webpage websites WINVER WSLENV xsi

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:microsoft/intelligent-terminal.git repository
on the dev/yuazha/fix-wsl-nvm-agent-detection branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/intelligent-terminal/actions/runs/31159350092/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (2100) from .github/actions/spelling/expect/alphabet.txt .github/actions/spelling/expect/expect.txt .github/actions/spelling/expect/web.txt and unrecognized words (1)

Dictionary Entries Covers Uniquely
cspell:csharp/csharp.txt 32 2 2
cspell:aws/aws.txt 232 2 2
cspell:fonts/fonts.txt 536 1 1

Consider adding to the extra_dictionaries array (in the .github/actions/spelling/config.json file):

    "cspell:csharp/csharp.txt",
    "cspell:aws/aws.txt",
    "cspell:fonts/fonts.txt",

To stop checking additional dictionaries, put (in the .github/actions/spelling/config.json file):

"check_extra_dictionaries": []

Pattern suggestions ✂️ (1)

You could add these patterns to .github/actions/spelling/patterns/978b56e5c346f1c5a783764312ed62b75d1bb4bb.txt:

# Automatically suggested patterns

# hit-count: 1 file-count: 1
# container images
image: [-\w./:@]+

Alternatively, if a pattern suggestion doesn't make sense for this project, add a # to the beginning of the line in the candidates file with the pattern to stop suggesting it.

Warnings and Notices ⚠️ (2)

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

⚠️ Warnings and Notices Count
ℹ️ candidate-pattern 1
⚠️ check-dictionary-not-found 54

See ⚠️ Event descriptions for more information.

✏️ Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/allow/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/allow/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

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