MoonshotAI / MoonshotAI/kimi-code

[Bug] Windows: sessions imported by kimi migrate invisible in /sessions picker (workDir slash mismatch)

Open
#3,151 0 comments 0 reactions 0 assignees View on GitHub

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>/, tagged custom.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 migrate should normalize workDir to 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

  1. On Windows, have legacy kimi-cli sessions created with a backslash cwd (e.g. D:\foo).
  2. Install kimi-code 0.38.0, run kimi migrate, choose "Config + N sessions".
  3. cd D:\foo && kimi, then /sessions → imported sessions are missing.
  4. kimi vis shows them; session_index.jsonl shows their workDir with 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.