diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 456e88609..4a9648c91 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- WSL host-home resolution now builds `/mnt//...` fallback paths with POSIX semantics regardless of the host platform, instead of the platform-dependent `path` module ([#3779](https://github.com/can1357/oh-my-pi/issues/3779)). + ## [17.2.9] - 2026-08-05 ### Breaking Changes diff --git a/packages/coding-agent/src/discovery/agents.ts b/packages/coding-agent/src/discovery/agents.ts index 27d5f3880..1d5a6fae5 100644 --- a/packages/coding-agent/src/discovery/agents.ts +++ b/packages/coding-agent/src/discovery/agents.ts @@ -44,12 +44,14 @@ function isWsl(platform: NodeJS.Platform, env: NodeJS.ProcessEnv): boolean { function convertWindowsPathToDefaultWslMount(windowsPath: string): string | undefined { const trimmed = windowsPath.trim(); if (trimmed.length === 0) return undefined; - if (path.isAbsolute(trimmed)) return path.normalize(trimmed); + // The result is always a WSL (POSIX) path, so build it with posix + // semantics regardless of the host platform. + if (path.posix.isAbsolute(trimmed)) return path.posix.normalize(trimmed); const match = WINDOWS_DRIVE_PROFILE_PATTERN.exec(trimmed); if (!match) return undefined; const [, drive, rest] = match; const segments = rest.replace(/\\/g, "/").split("/").filter(Boolean); - return path.join("/mnt", drive.toLowerCase(), ...segments); + return path.posix.join("/mnt", drive.toLowerCase(), ...segments); } function resolveWithWslPath(windowsPath: string): string | undefined { diff --git a/packages/coding-agent/test/skills.test.ts b/packages/coding-agent/test/skills.test.ts index 148615b79..6675f583f 100644 --- a/packages/coding-agent/test/skills.test.ts +++ b/packages/coding-agent/test/skills.test.ts @@ -284,7 +284,7 @@ describe("skills", () => { wslPath: () => undefined, }); - expect(resolved).toBe(path.join("/mnt", "c", "Users", "alice")); + expect(resolved).toBe("/mnt/c/Users/alice"); }); it("resolves the Windows profile through interop when USERPROFILE is not exported (#3779)", () => {