MoonshotAI / MoonshotAI/kimi-code
[Bug] Windows: sessions imported by kimi migrate invisible in /sessions picker (workDir slash mismatch)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Environment
- kimi-code 0.38.0, native Windows install (
~/.kimi-code/bin/kimi.exe) - Windows, migrated from legacy Python kimi-cli via
kimi migrate(chose Config + sessions)
What happened
kimi migrate completed successfully and reported 60+ sessions imported. However, opening /sessions (or kimi --session) inside the same working directory shows none of the imported sessions — only sessions newly created by the native build appear.
Root cause (from local data inspection)
The sessions themselves are imported correctly:
- They exist under
~/.kimi-code/sessions/<workDirKey>/, taggedcustom.imported_from_kimi_cli: true - They are listed in
~/.kimi-code/session_index.jsonl - They are visible in
kimi vis
The problem is a path normalization mismatch in session_index.jsonl:
- Imported entries keep the legacy backslash form:
"workDir": "D:\code\edcbook" - Native 0.38.0 sessions are recorded with forward slashes:
"workDir": "D:/code/edcbook"
The session picker appears to filter index entries by exact string match against the current process working directory, so imported entries never match. Historical spelling variants (d:\code\edcbook, d:/code/edcbook, different drive-letter casing) also fragment one real directory into multiple invisible buckets. In my index the same physical directory existed under 4 different spellings.
Expected behavior
kimi migrateshould normalizeworkDirto the native canonical form when importing, and/or- the session picker should canonicalize both sides before comparing (on Windows: slash-direction agnostic, drive-letter case-insensitive).
Reproduction
- On Windows, have legacy kimi-cli sessions created with a backslash cwd (e.g.
D:\foo). - Install kimi-code 0.38.0, run
kimi migrate, choose "Config + N sessions". cd D:\foo && kimi, then/sessions→ imported sessions are missing.kimi visshows them;session_index.jsonlshows theirworkDirwith backslashes.
Workaround
Manually rewriting workDir values in session_index.jsonl to the forward-slash form (D:/foo) makes the imported sessions appear in the picker. No session files needed to be moved.
Happy to provide a debug ZIP or the before/after index files 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 tracing kimi migrate's handling of session_index.jsonl and the /sessions picker lookup, using the reported workDir mismatch as the reproduction. Verify the behavior with legacy Windows paths and confirm that imported sessions appear in /sessions without manually editing the index.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100