kimi-code
kimi-code copied to clipboard
feat(cli): support direct global session resume across working directories
Is your feature request related to a problem? Please describe.
Currently, running kimi -r <sessionId> from outside a session's original creation directory refuses to resume directly, printing a message instructing the user to manually cd "<workDir>" && kimi -r <sessionId>. Additionally, path resolution differences (such as symlinks, trailing slashes, or subdirectories) can trigger [session.not_found] errors during session operations and model switches.
Describe the solution you'd like
- Direct Global Session Resume:
kimi -r <sessionId>should seamlessly resolve the session viasession_index.jsonlregardless of the current working directory, automatically adopting the session's recordedworkDirfor execution context. - Fallback Session Lookup: Session lookup methods in
SessionStore,sessionLifecycleService, andhandlerForSessionshould fall back to querying the globalsession_index.jsonlindex when an explicitsessionIdis provided. - Canonical Path Normalization: Ensure
realpath/areSameFsPathnormalization is consistently applied when comparing sessionworkDirentries to avoid[session.not_found]when using symlinked or relative directory paths.