#11529: fix(wizard): strip shell-style backslash escapes from workspace paths
size: XS
trusted-contributor
experienced-contributor
Cluster:
Workspace Path Fixes
## Summary
- Strip shell-style backslash-space escapes from paths in `resolveUserPath()`
- Fixes issue where terminal autocomplete on macOS produces paths like `~/Library/Mobile\ Documents/...` that get stored literally in `openclaw.json`
## Problem
When users enter workspace paths via `openclaw configure`, terminal autocomplete often shell-escapes spaces (e.g., `Mobile\ Documents`). This backslash-space sequence was stored literally in JSON, producing an invalid path that silently fails at startup.
## Solution
`resolveUserPath()` now strips `\ ` → ` ` before resolving, so shell-escaped paths work correctly.
## Test plan
- [x] Added 3 new tests for shell-escaped path handling
- [x] All 3 tests fail before fix, pass after
- [x] Full CI gate passes (`pnpm build && pnpm check && pnpm test`)
Fixes #10939
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `resolveUserPath()` to normalize shell-escaped spaces (`\ `) commonly produced by terminal autocomplete (notably on macOS) before `~` expansion and `path.resolve()`. It also adds unit tests covering `~` + escaped-space paths, absolute paths with escaped spaces, and ensuring Windows-style backslashes are preserved.
The change is localized to the shared path resolution utility used by config/workspace path handling, preventing incorrectly persisted `openclaw.json` workspace paths like `Mobile\ Documents` from failing at startup.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Changes are narrowly scoped to `resolveUserPath()` and are covered by new tests that demonstrate the previously failing behavior and the intended normalization. The unescaping is limited to the exact `\ ` sequence, reducing risk of corrupting legitimate backslash usage, and existing `~` handling remains intact.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#13497: fix(docker): normalize workspace paths for container compatibility
by janckerchen · 2026-02-10
81.8%
#10708: fix: handle Windows PATH case-sensitivity in exec environment
by Yida-Dev · 2026-02-06
79.0%
#5496: Fix: Windows path separators stripped in Gateway scheduled task
by giuliozelante · 2026-01-31
78.8%
#23085: fix(workspace): respect OPENCLAW_STATE_DIR for workspace paths, fix...
by charojo · 2026-02-22
78.3%
#17757: fix(agents): resolve relative workspace paths against state dir, no...
by Phineas1500 · 2026-02-16
77.9%
#20390: fix(daemon): fall back to /tmp for launchd logs on removable volumes
by lemoz · 2026-02-18
77.6%
#22910: fix(browser): resolve symlinks in upload path validation
by erdinccurebal · 2026-02-21
77.5%
#23480: fix(test): use path.join for cross-platform XDG path assertions in ...
by hydro13 · 2026-02-22
77.3%
#20330: Fix SSH tunnel startup on Windows by resolving ssh from PATH
by graysurf · 2026-02-18
77.1%
#21553: fix: resolve workspace template dir in bundled dist/ layout
by echoVic · 2026-02-20
77.1%