anomalyco / anomalyco/opencode

Feature: configurable environment bootstrap for Desktop WSL servers

Open
#40,179 0 comments 6 reactions 1 assignee View on GitHub

@Brendonovich is already working on this.

Since Aug 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

This appears to affect more than provider environment variables: it also prevents the Desktop-launched WSL server from finding normal developer tools such as node, npm, npx, and pnpm.

The Desktop WSL sidecar currently starts the server with wsl … bash -se, does not source ~/.bashrc, and sanitizes PATH by removing /mnt/* entries. See sidecar.ts.

That is understandable as a safe default, but it differs from an interactive WSL terminal. For example, this works in a normal Bash session:

command -v node npm npx pnpm

But commands run through the Desktop WSL server cannot find them when Node/pnpm setup is initialized in Bash configuration, for example:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"

Related bug report: #38241.

Request

Please add a per-WSL-server Environment bootstrap setting in the Desktop app.

Suggested behavior:

  • Sanitized environment — default; preserves today's behavior.
  • Source an explicit bootstrap file — opt-in, for example ~/.config/opencode/desktop-wsl-env.sh.
  • Optionally, an advanced choice to source ~/.bashrc.

The selected bootstrap should run once while starting opencode serve, after Desktop applies its safe defaults and before it executes the server. Shell-tool commands would then inherit the resulting environment.

This avoids running every agent command as an interactive shell, preserves a predictable default, and lets users enable only the Node/pnpm initialization they need.

Acceptance criteria

  • The option is configurable per WSL distro/server in Desktop.
  • Default behavior remains unchanged.
  • A configured bootstrap makes node, npm, npx, and pnpm available to commands run by OpenCode.
  • Bootstrap failures are shown clearly in the Desktop server-startup logs/UI.
  • Documentation explains that sourcing .bashrc is opt-in, since interactive shell configuration can have side effects.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.