Files
magpie/internal
yetone 407595b2ab sessions: a Kimi Code session whose state.json names no folder takes it from session_index.jsonl (#2103, infinitr0us)
Early protocol 1.4 sessions and those migrated from the Python kimi-cli
(ses_* folders) have neither cwd nor workDir in state.json, so they were
listed under "No folder" and resumed with a bare `kimi --session <id>`.
Kimi Code's session_index.jsonl, at the root of its home beside sessions/,
has {sessionId, sessionDir, workDir} for every session (Kimi's
docs/en/configuration/data-locations.md). parseKimi now falls back to the
workDir of the index line whose sessionId is the session folder's name;
a folder state.json names still wins. The index is read again only when
its size or mtime changes. parseKimi is the only place a Kimi session's
folder is derived (the resume command is built from it).

Run:
- TestKimiCodeSessionFolderFromIndex (new): the reporter's 1.4 and
  migrated sessions get the index's folder and a `cd '<folder>' &&`
  resume; state.json's cwd beats a different index line; a session with
  no folder anywhere stays without one. With kimi.go put back it fails:
  `june folder ""`.
- go test -tags nogui ./internal/sessions/... under a sandbox HOME with
  pinned caches: ok.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean.

Not tried: a real Kimi Code home with an index (this machine's
~/.kimi-code has no sessions); the format is from Kimi's docs, the
reporter's line on the issue and Coffee-CLI's reader of the same file.
Not run: the full go test ./... suite.
2026-10-14 14:19:23 +08:00
..
…
…