[Bug] Desktop app does not inherit user env vars into Bash subprocess (BASH_DEFAULT_TIMEOUT_MS etc.)
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Problem
ZCode desktop (Windows 11 Pro, v3.3.6) does not pass user environment variables into Bash subprocesses spawned by the Bash tool. Only ZCODE_* variables explicitly injected by ZCode are visible. This breaks documented Claude Code env vars like BASH_DEFAULT_TIMEOUT_MS, CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR, API_TIMEOUT_MS, etc.
This appears to be the same root cause as anthropics/claude-code#42203 ("Desktop app ignores env.PATH from settings.json — sandbox overrides").
Reproduction
- Set a user env var on Windows:
setx BASH_DEFAULT_TIMEOUT_MS "300000" setx ZCODE_TEST_ENV_VAR "hello-from-setx" - Restart ZCode desktop.
- Open a chat, ask the agent: "print all env vars containing ZCODE_TEST or BASH_DEFAULT".
- The agent runs
env | grep ...via Bash tool.
Expected
Both ZCODE_TEST_ENV_VAR=hello-from-setx and BASH_DEFAULT_TIMEOUT_MS=300000 should be visible in the subprocess.
Actual
ZCODE_APP_VERSION=3.3.6
ZCODE_RUNTIME_ENV=production
ZCODE_WINDOWS_APP_INSTALL_DIR=...
ZCODE_RG_BINARY=...
ZCODE_PROCESS_LABEL=local-1
ZCODE_BASE_URL=https://zcode.z.ai
ZCODE_ENV=production
No BASH_DEFAULT_TIMEOUT_MS, no ZCODE_TEST_ENV_VAR, no user-set vars. Only ZCode-injected ones appear.
Also tried: setting an env block in ~/.zcode/cli/config.json:
{ "env": { "BASH_DEFAULT_TIMEOUT_MS": "300000" } }
Same result — the var is not visible in subprocess.
Note: env field inside MCP servers DOES work
For comparison, the env field inside an MCP server config is honored correctly:
{
"mcp": { "servers": { "excel": {
"env": { "EXCEL_MCP_PAGING_CELLS_LIMIT": "4000" }
} } }
}
This works — the var reaches the MCP server process. The issue is specifically with the Bash/Read/Edit/Write built-in tools.
Impact
- Documented Claude Code env vars (
BASH_DEFAULT_TIMEOUT_MS,API_TIMEOUT_MS,CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR, etc.) are non-functional in ZCode desktop. - Users relying on these for long-running test suites / deploy scripts get silent breakage with default 2-min timeout.
Environment
- ZCode 3.3.6, Windows 11 Pro (10.0.26200).
- GLM-5.2 via Z.ai Coding Plan (Max).
- PowerShell
setxconfirmed the vars were stored in User registry.
Related
- anthropics/claude-code#42203 — same issue in upstream Claude Code.
- The
envfield for MCP servers works (so the parser exists), it's the Bash tool subprocess that is isolated.
Proposal
Either:
- Honor the
envblock in~/.zcode/cli/config.jsonfor built-in tool subprocesses (matching Claude Code docs). - Or inherit user-level environment variables on desktop launch.
- Or document clearly that these env vars are CLI-only and provide a ZCode-specific way to set them.
Thanks — happy to provide more diagnostics if useful.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior on Windows with a user variable and the env block in ~/.zcode/cli/config.json, then compare the built-in Bash/Read/Edit/Write tools with the working MCP server env handling. Done means user-level variables or the documented config env values reach built-in tool subprocesses, with the intended behavior clarified among the listed proposals.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- desktop, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100