What version of Kimi Code is running?
0.11.0
Which open platform/subscription were you using?
Allegretto
Which model were you using?
kimi - k2.6
What platform is your computer?
win10/win11
What issue are you seeing?
On Windows PowerShell/CMD, the kimi -S <session_id> command fails to resume a session even when the user is physically in the correct working directory.
The error message suggests switching to a different directory:
Session "session_xxx" was created under a different directory.
cd "D:/projects" && kimi -r session_xxx
error: failed to start shell: Session "session_xxx" was created under a different directory.
Root cause: session_index.jsonl stores workDir with forward slashes (D:/projects), while Windows GetCurrentDirectory() API returns backslashes (D:\projects). The session resumption logic uses strict string comparison, so the two values never match.
What steps can reproduce the bug?
-
Open PowerShell on Windows
-
Navigate to a working directory:
-
Start a kimi session and then exit:
kimi
# ... do some work ...
# exit
-
Try to resume the session by its exact ID:
kimi -S session_915726a2-c3f9-4ef3-87df-00cc8c4d1e64
-
The command fails with "created under a different directory"
What is the expected behavior?
kimi -S <session_id> should successfully resume the session when the user is in the same physical directory, regardless of path separator differences (\ vs /).
Path comparison should be normalized before checking (e.g., using path.normalize() or replacing separators) rather than strict string equality.
Additional information
Bug Report: kimi -S <session_id> Command Effectively Broken on Windows PowerShell
Summary
On Windows, the `kimi -S <session_id>` command fails to resume a session even when the user is physically in the correct working directory. The failure is caused by a strict string comparison between the current working directory (returned by the Windows API with backslashes `\`) and the `workDir` stored in `session_index.jsonl` (which uses forward slashes `/`).
As a result, the command is **effectively unusable** for direct session resumption in standard Windows terminals (PowerShell, CMD).
Environment
Item | Value
-- | --
OS | Windows 10/11
Terminal | PowerShell / CMD / Windows Terminal
kimi-code version | 0.11.0
Installation path | `C:\Users\\.kimi-code\bin\kimi.exe`
Severity
**High** — A core CLI command (`kimi -S <id>`) is effectively non-functional on the primary Windows shell.
Suggested Fix
Use **canonicalized path comparison** instead of strict string comparison when validating the working directory during session resumption.
Option A: Normalize separators before comparison (Recommended)
Before comparing, normalize both paths by replacing all `\` with `/` (or vice versa), then compare:
// Pseudo-code
const normalizedCurrent = currentDir.replace(/\\/g, '/');
const normalizedStored = session.workDir.replace(/\\/g, '/');
if (normalizedCurrent !== normalizedStored) {
throw "Different directory";
}
Option B: Use OS-native path comparison APIs
These APIs handle separator differences, `.` / `..` segments, and other edge cases automatically.
Additional Context
The TUI welcome screen displays paths with forward slashes (`D:/projects/kimi_code`), which suggests kimi-code already normalizes paths for display. The same normalization should be applied to the comparison logic.
This issue does **not** affect `kimi -S` (interactive mode without ID) or `kimi -C`, because those code paths do not enforce the directory check.
Attachments
What version of Kimi Code is running?
0.11.0
Which open platform/subscription were you using?
Allegretto
Which model were you using?
kimi - k2.6
What platform is your computer?
win10/win11
What issue are you seeing?
On Windows PowerShell/CMD, the
kimi -S <session_id>command fails to resume a session even when the user is physically in the correct working directory.The error message suggests switching to a different directory:
Root cause:
session_index.jsonlstoresworkDirwith forward slashes (D:/projects), while WindowsGetCurrentDirectory()API returns backslashes (D:\projects). The session resumption logic uses strict string comparison, so the two values never match.What steps can reproduce the bug?
Open PowerShell on Windows
Navigate to a working directory:
Start a kimi session and then exit:
Try to resume the session by its exact ID:
The command fails with "created under a different directory"
What is the expected behavior?
kimi -S <session_id>should successfully resume the session when the user is in the same physical directory, regardless of path separator differences (\vs/).Path comparison should be normalized before checking (e.g., using
path.normalize()or replacing separators) rather than strict string equality.Additional information
Bug Report: kimi -S <session_id> Command Effectively Broken on Windows PowerShell
Summary
On Windows, the
`kimi -S <session_id>`command fails to resume a session even when the user is physically in the correct working directory. The failure is caused by a strict string comparison between the current working directory (returned by the Windows API with backslashes`\`) and the`workDir`stored in`session_index.jsonl`(which uses forward slashes`/`).As a result, the command is **effectively unusable** for direct session resumption in standard Windows terminals (PowerShell, CMD).
Environment
Item | Value -- | -- OS | Windows 10/11 Terminal | PowerShell / CMD / Windows Terminal kimi-code version | 0.11.0 Installation path | `C:\Users\\.kimi-code\bin\kimi.exe`Severity
**High** — A core CLI command (
`kimi -S <id>`) is effectively non-functional on the primary Windows shell.Suggested Fix
Use **canonicalized path comparison** instead of strict string comparison when validating the working directory during session resumption.
Option A: Normalize separators before comparison (Recommended)
Before comparing, normalize both paths by replacing all
`\`with`/`(or vice versa), then compare:Option B: Use OS-native path comparison APIs
**Node.js**:
`path.normalize()`+`path.resolve()`**Rust**:
`std::fs::canonicalize()`or`std::path::Path::canonicalize()`These APIs handle separator differences,
`.`/`..`segments, and other edge cases automatically.Additional Context
The TUI welcome screen displays paths with forward slashes (
`D:/projects/kimi_code`), which suggests kimi-code already normalizes paths for display. The same normalization should be applied to the comparison logic.This issue does **not** affect
`kimi -S`(interactive mode without ID) or`kimi -C`, because those code paths do not enforce the directory check.Attachments
`session_index.jsonl`excerpt: