Skip to content

[Desktop] Same folder registered as two workspaces — sidebar lists the same sessions under two groups #4137

Description

@Eternal-QY

Environment

  • Kimi Code Desktop 1.0.4 (win32, x64, packaged)
  • Windows

Summary

The session sidebar shows the same sessions twice, under two different workspace group headings. The sessions exist only once on disk, so this looks like a grouping / attribution problem rather than duplicated data.

Actual

The sidebar renders two groups:

  • KIMI Code
  • E:\Users\<user>\Desktop\其余事项

Both groups list the same three sessions, with identical titles and timestamps.

Evidence

1. Two workspace IDs point at the same folder

~/.kimi-code/workspaces.json:

"wd_workspace_f4fcbc1b8059": {
  "root": "E:\\Users\\<user>\\Desktop\\KIMI Code",
  "name": "KIMI Code",
  "created_at": "2026-10-06T13:08:53.756Z",
  "last_opened_at": "2026-10-06T15:59:23.831Z"
},
"wd_kimi-code_5dd6703f82c2": {
  "root": "E:\\Users\\<user>\\Desktop\\KIMI Code",
  "name": "KIMI Code",
  "created_at": "2026-10-06T16:43:07.484Z",
  "last_opened_at": "2026-10-06T16:43:07.484Z"
}

Note the two ID schemes: wd_workspace_<hash> (older) versus wd_<dirname-slug>_<hash> (newer). The legacy entry is neither migrated nor merged.

2. A workspace's root disagrees with the workDir of sessions stored under it

~/.kimi-code/session_index.jsonl:

session_f3a7a11d-...  sessionDir=.../sessions/wd_workspace_f4fcbc1b8059/...  workDir="E:\Users\<user>\Desktop\KIMI Code"
session_1537bb46-...  sessionDir=.../sessions/wd_workspace_f4fcbc1b8059/...  workDir="E:\Users\<user>\Desktop\其余事项"
session_40bf182f-...  sessionDir=.../sessions/wd_workspace_f4fcbc1b8059/...  workDir="E:\Users\<user>\Desktop\其余事项"

wd_workspace_f4fcbc1b8059 has root = "...\Desktop\KIMI Code", yet two of the sessions recorded under it belong to ...\Desktop\其余事项.

3. The root field appears to have been overwritten

An earlier backup of the same file, workspaces.json.bak, still contains:

"wd_workspace_f4fcbc1b8059": {
  "root": "E:\\Users\\<user>\\Desktop\\其余事项",
  "name": "KIMI Code"
}

So at that point root was 其余事项 while name was already KIMI Code — the display name never matched, and root later changed, leaving the sessions stranded.

Suspected cause

  1. The same folder ends up with two workspace records because the workspace-ID scheme changed; the legacy record is not merged.
  2. Switching folders overwrites an existing workspace record's root instead of creating a new record, so it stops matching the workDir of sessions already stored under it.
  3. The sidebar derives one group heading from the workspace name and another from the sessions' workDir, but takes the session set for the whole session directory without splitting it by workDir — so the same list is rendered under both headings.

Expected

Each session appears exactly once, under the workspace it actually belongs to.

Notes

  • Restarting the app does not help; the inconsistent state is persisted in workspaces.json / session_index.jsonl.
  • I have not modified these files.
  • ~/.kimi-code/sessions/.index-cache/scan.json is {"version":1,"sessions":{}} with an mtime a day old, in case the cache is involved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions