Repository navigation
Description
Describe the bug
When running OpenClaw 2026.5.19 on native Windows (not WSL2), the following warning appears during startup:
[openclaw] shell env fallback failed: spawnSync /bin/sh ENOENT
To Reproduce
Steps to reproduce the behavior:
- Install OpenClaw 2026.5.19 on native Windows
- Run
openclaworopenclaw status - See the warning about /bin/sh ENOENT
Expected behavior
OpenClaw should detect Windows platform and skip the shell env fallback that relies on /bin/sh, which doesn't exist on Windows.
Environment:
- OS: Windows 10/11 (native, not WSL2)
- OpenClaw version: 2026.5.19
Root Cause
In src/infra/shell-env.ts, the probeLoginShellEnv function attempts to execute /bin/sh to probe the login shell environment. On Windows, this shell doesn't exist, causing the ENOENT error.
While getShellPathFromLoginShell already has a Windows platform check, probeLoginShellEnv (called by loadShellEnvFallback) does not have this check.
Proposed Fix
Add a Windows platform check at the beginning of probeLoginShellEnv function:
function probeLoginShellEnv(params: {
env: NodeJS.ProcessEnv;
timeoutMs?: number;
exec?: typeof execFileSync;
platform?: NodeJS.Platform;
}): LoginShellEnvProbeResult {
const platform = params.platform ?? process.platform;
if (platform === "win32") {
return { ok: true, shellEnv: new Map() };
}
// ... rest of the function
}Additional context
Related to the Windows native support improvements mentioned in the 5.19 release notes.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 21, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Workflow note: Future ClawSweeper reviews update this same comment in place.
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Summary
This is a valid, narrow Windows startup bug on current main: the shell-env fallback still reaches the
/bin/shprobe path, and only the separate PATH helper has a Windows skip.Reproducibility: yes. source inspection gives a high-confidence reproduction path: enable shell-env import on native Windows with a missing expected key, and current main reaches the
/bin/shexec path. I did not run native Windows here, so this is source-reproducible rather than live reproduced.Next step
This is a narrow source-proven repair in the shell-env fallback with obvious unit coverage and a bounded Windows smoke path.
Review details
Best possible solution:
Add a testable win32 no-op for shell-env import in the fallback/probe path, preserve existing POSIX behavior, and add focused regression coverage plus a changelog entry if this ships as a user-visible fix.
Do we have a high-confidence way to reproduce the issue?
Yes, source inspection gives a high-confidence reproduction path: enable shell-env import on native Windows with a missing expected key, and current main reaches the
/bin/shexec path. I did not run native Windows here, so this is source-reproducible rather than live reproduced.Is this the best way to solve the issue?
Yes, the proposed direction is the narrow maintainable fix if implemented as a platform-aware skip in the fallback/probe path with regression coverage. It should not grow into an implicit PowerShell environment importer without a separate product decision.
Label changes:
P2: The report is a valid startup/config bug with limited blast radius and a clear narrow fix path.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: The report is a valid startup/config bug with limited blast radius and a clear narrow fix path.Acceptance criteria:
OPENCLAW_LOAD_SHELL_ENV=1 openclaw statuswith a missing expected key and verify no/bin/shwarning is emitted.What I checked:
[openclaw] shell env fallback failed: spawnSync /bin/sh ENOENTduringopenclaworopenclaw status, and proposes skipping the fallback on win32.loadShellEnvFallbackcallsprobeLoginShellEnvwhenever expected keys are missing, andprobeLoginShellEnvresolves a shell and invokes the login-shell exec path without any platform check. (src/infra/shell-env.ts:171, a30ac3f8d7cb)getShellPathFromLoginShellalready returns null onplatform === "win32", but that platform option is not threaded throughloadShellEnvFallbackorprobeLoginShellEnv. (src/infra/shell-env.ts:282, a30ac3f8d7cb)getShellPathFromLoginShell; the fallback tests still assert/bin/shfallback behavior and do not coverloadShellEnvFallbackon win32. (src/infra/shell-env.test.ts:405, a30ac3f8d7cb)env.shellEnvandOPENCLAW_LOAD_SHELL_ENV=1as optional login-shell import for missing expected keys, so skipping POSIX shell probing on native Windows preserves the documented import boundary better than warning on/bin/sh. Public docs:docs/gateway/configuration.md. (docs/gateway/configuration.md:653, a30ac3f8d7cb)git show v2026.5.19:src/infra/shell-env.tsshows the same no-platform-guard probe/fallback path as current main. (src/infra/shell-env.ts:171, a185ca283a74)Likely related people:
git logshow Peter Steinberger introduced the current shell-env probe/fallback implementation in d147036. (role: introduced behavior; confidence: high; commits: d1470360c420; files:src/infra/shell-env.ts,src/infra/shell-env.test.ts,src/config/io.ts)src/config/io.ts, which callsloadShellEnvFallback, while not appearing to own the shell-env probe itself. (role: recent adjacent contributor; confidence: low; commits: d91ef6bb171d; files:src/config/io.ts)Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a30ac3f8d7cb.
JIRBOY commentedon May 24, 2026
Additional reproduction confirmation on OpenClaw 2026.5.22 (a374c3a) / Windows 10 19045 / Node 24.14.1.
This bug continues to affect multiple commands beyond startup:
Affected commands confirmed:
The probeLoginShellEnv function is likely called via loadShellEnvFallback during CLI initialization, affecting any command path that needs shell environment variables. On Windows, getShellPathFromLoginShell already skips the probe (has win32 check), but probeLoginShellEnv does not, causing the ENOENT.
This is a P2 that blocks shell completion generation on Windows native installs.
JIRBOY commentedon May 24, 2026
Additional reproduction confirmation on OpenClaw 2026.5.22 (a374c3a) / Windows 10 19045 / Node 24.14.1.
This bug continues to affect multiple commands beyond startup:
Affected commands confirmed:
██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░██
██░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░██
██░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
OPENCLAW
┌ OpenClaw doctor
│
◇ Security ─────────────────────────────────────────────────────────────╮
│ │
│ - WARNING: openclaw.json contains plaintext secret-bearing config │
│ fields. │
│ Paths: gateway.auth.token, models.providers.kimi-coding.apiKey, │
│ plugins.entries.moonshot.config.webSearch.apiKey, │
│ channels.feishu.appSecret │
│ Agents or workspace tools that can read config files may see these │
│ API keys/tokens. │
│ Migrate them to SecretRefs with openclaw secrets configure or │
│ openclaw secrets apply, then verify with openclaw secrets audit │
│ --check. │
│ - Run: openclaw security audit --deep │
│ │
├────────────────────────────────────────────────────────────────────────╯
│
◇ Skills status ───────────╮
│ │
│ Eligible: 223 │
│ Missing requirements: 0 │
│ Blocked by allowlist: 0 │
│ │
├───────────────────────────╯
│
◇ Plugins ──────╮
│ │
│ Loaded: 8 │
│ Imported: 0 │
│ Disabled: 86 │
│ Errors: 0 │
│ │
├────────────────╯
Run "openclaw doctor --fix" to apply changes.
│
└ Doctor complete. — shows before and after doctor output
Overview
┌────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Item │ Value │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Version │ 2026.5.22 │
│ OS │ windows 10.0.19045 (x64) │
│ Node │ 24.14.1 │
│ Config │ $OPENCLAW_HOME.openclaw\openclaw.json │
│ Dashboard │ http://127.0.0.1:18789/ │
│ Tailscale exposure │ off │
│ Channel │ stable (default) │
│ Update │ pnpm · up to date · npm latest 2026.5.22 │
│ Gateway │ local · ws://127.0.0.1:18789 (local loopback) · reachable 189ms · auth token · HostJi (10.197. │
│ │ 73.12) app 2026.5.22 windows 10.0.19045 │
│ Security │ Run: openclaw security audit --deep │
│ Gateway self │ unknown │
│ Gateway service │ Scheduled Task not installed │
│ Node service │ Scheduled Task not installed │
│ Agents │ 1 total · 0 bootstrapping · 1 active · 5 sessions │
│ Secrets │ none │
└────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────┘
Channels
┌──────────┬─────────┬────────┬────────────────────────────────────────────────────────────────────────────────────────┐
│ Channel │ Enabled │ State │ Detail │
├──────────┼─────────┼────────┼────────────────────────────────────────────────────────────────────────────────────────┤
│ Feishu │ ON │ OK │ configured │
└──────────┴─────────┴────────┴────────────────────────────────────────────────────────────────────────────────────────┘
Feishu accounts
┌──────────┬──────────┬────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Account │ Status │ Notes │
├──────────┼──────────┼────────────────────────────────────────────────────────────────────────────────────────────────┤
│ default │ OK │ credential available in gateway runtime │
└──────────┴──────────┴────────────────────────────────────────────────────────────────────────────────────────────────┘
Agents
┌────────────┬────────────────┬──────────┬──────────┬──────────────────────────────────────────────────────────────────┐
│ Agent │ Bootstrap file │ Sessions │ Active │ Store │
├────────────┼────────────────┼──────────┼──────────┼──────────────────────────────────────────────────────────────────┤
│ main │ ABSENT │ 5 │ just now │ $OPENCLAW_HOME.openclaw\agents\main\sessions\sessions.json │
└────────────┴────────────────┴──────────┴──────────┴──────────────────────────────────────────────────────────────────┘
Diagnosis (read-only)
Gateway connection details:
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: D:\Personal\Settings.openclaw\openclaw.json
Bind: loopback
✓ Config: D:\Personal\Settings.openclaw\openclaw.json
✓ Secret diagnostics (0)
✓ Restart sentinel: none
✓ Port 18789
Detected OpenClaw Gateway listener on the configured port.
! Tailscale exposure: off · daemon unknown
✓ Skills: 223 eligible · 0 missing · D:\Personal\OpenClaw
✓ Plugin compatibility (none)
✓ Agent activity: 1 active in 30m · 5 sessions
✓ Inbound delivery telemetry: received 3 · dispatch 3/3 · turns 4 · processed 3
latest delivery event: 7m ago
Gateway restart attempts (tail): C:\Users\Super Manager.openclaw\logs\gateway-restart.log
[���� 2026/05/16 16:35:06.12] openclaw restart log initialized
[���� 2026/05/16 16:35:06.12] openclaw restart attempt source=update target=OpenClaw Gateway
✓ Channel issues (none)
Pasteable debug report. Auth tokens redacted.
Troubleshooting: https://docs.openclaw.ai/troubleshooting — shows the error
Additional context:
The function () is likely called via during CLI initialization, affecting any command path that needs shell environment variables. On Windows, already skips the probe (has check), but does not, causing the ENOENT.
This is a P2 that blocks shell completion generation on Windows native installs.