Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Sessions/chat history hidden after update: existing sessions not re-keyed to new workspace-path scheme

Open DUn2 opened this issue 5 months ago • 7 comments

Sessions/chat history disappears after update: old sessions not re-keyed to the new workspace-path scheme

Summary

After updating Kiro, the session/chat history for existing workspaces appears empty. The session data is not deleted: the files are still on disk under ~/.kiro/sessions/<workspace-hash>/. The problem is that the updated version no longer associates those existing sessions with the opened workspace, so the history list shows nothing.

Severity / impact

High perceived impact: users reasonably believe all their previous work and reasoning history has been permanently lost after a routine update. The data is recoverable, but only by manually editing internal session files.

Environment

  • OS: Microsoft Windows 11 Enterprise (build 26200)
  • Kiro version: 1.0.0 (commit 0974fb9837d3a1c159ee4016bbbcd4fc21e14111)
  • Update: occurred after upgrading to the latest version

Observed behavior

  • All previous sessions for a workspace are missing from the history list.
  • A brand-new session created after the update is shown correctly.

Root cause (from investigation)

Two distinct, compounding issues:

  1. Workspace path normalization changed between versions.

    • Older sessions store the workspace path in session.json as lowercase with forward slashes, e.g. c:/users/<you>/projects/<project>.
    • The updated version stores it with real on-disk casing and backslashes, e.g. c:\Users\<you>\projects\<Project>.
    • The history list appears to match sessions to the open workspace by exact string comparison of this path, so old-format entries no longer match and are hidden — even though they sit in the correct per-workspace folder.
  2. Sessions are keyed by a hash of the path; moving the project folder breaks it.

    • The per-workspace session folder name is the first 16 hex characters of the SHA-256 of the normalized (lowercased, forward-slash) path. This was verified: the same scheme reproduces the existing folder names exactly, and the updated version itself writes new sessions into the folder computed this way.
    • If the project folder is moved/renamed (e.g. relocated into another parent directory), the new path hashes to a different folder name. Old sessions remain under the previous hash folder and are never located when the project is opened at its new location.

Steps to reproduce

  1. On an older version, create a workspace and have a few sessions.
  2. Update Kiro to the latest version.
  3. Open the same workspace and check the session history → previous sessions are missing.
  4. (Variant) Move/rename the project folder before opening → still missing, and now stored under the old-path hash folder.

Expected vs actual

  • Expected: existing sessions remain visible in history after an update (and ideally after a project-folder move).
  • Actual: existing sessions are hidden; only post-update sessions appear.

Workaround (manual, what recovered the data)

  • Locate the workspace's session folder under ~/.kiro/sessions/<hash>/.
  • Update the workspacePaths field inside each session.json to the new canonical format (real OS casing + backslashes). Only this field needs changing; messages.jsonl is untouched.
  • For a moved project folder: recompute the hash for the new path (sha256(lowercased-forward-slash-path) → first 16 hex chars), move/copy the session folders into that new hash folder, and fix workspacePaths.

Suggested fixes

  • During migration, re-key existing sessions: rewrite workspacePaths to the new canonical form for all stored sessions.
  • Make history matching normalization-insensitive (case-insensitive on Windows, slash-normalized) instead of exact string comparison.
  • Decouple session storage from the raw path hash, or detect moved/renamed project folders, so relocating a workspace does not orphan its sessions.

Notes

  • No data loss occurred; this is an association/indexing regression in the migration.
  • Paths in this report are genericized on purpose since the issue is public.

DUn2 avatar Jun 17 '26 12:06 DUn2

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both describe identical issue of chat history missing from sidebar after update due to session format/path migration problems, with very similar technical details about workspace path handling

github-actions[bot] avatar Jun 17 '26 12:06 github-actions[bot]

REOPEN, this is a new issue, not a duplicate! @AnilMaktala

gtava5813 avatar Jun 17 '26 15:06 gtava5813

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Jun 17 '26 15:06 github-actions[bot]

Thanks for the thorough diagnosis, @DUn2. We've been looking into this and your root cause analysis appears to check out:

  • The workspace hash computation (SHA-256(normalized_path)[0:16]) appears stable across versions — sessions seem to land in the correct directory
  • workspacePaths in session.json appears to store the raw path from the IDE, not the normalized form used for hashing
  • The session list matching logic may be doing an exact string comparison between the stored workspacePaths and the current workspace path — which would cause old sessions (lowercase + forward slashes) to not match the new format (real casing + backslashes)

Your suggested fixes align with what we're seeing. We're treating this as the canonical tracking issue for this cluster (#9472, #9476 appear to report the same underlying bug)

Could you confirm: after the update, are new sessions created in the same ~/.kiro/sessions/<hash>/ directory as the old ones, just with the updated path format in session.json?

AnilMaktala avatar Jun 17 '26 16:06 AnilMaktala

**Can confirm on an independent setup, same version (1.0.0, commit 0974fb9), Windows. Two things to add:

Independent corroboration of root cause #1. A pre-update session here stored workspacePaths as lowercase/forward-slash (c:/.../); every post-update session stores it with backslashes (c:...<Project>). Same normalization divergence, reproduced on a second machine.

Extra trigger (no folder move required). Just having opened both a parent folder and a subfolder as workspace roots at different times reproduces it, each hashes to its own bucket, so opening one hides the sessions logged under the other. All still on disk, just split across two hash folders.

Most visible symptom: open chat tabs aren't restored after the update (likely downstream of the same association failure). Worth covering in the fix, since that's what users notice first.**

MikeDunn-Infor avatar Jun 17 '26 19:06 MikeDunn-Infor

IDE 1.0.89 (Jul 3) shipped a fix so sessions restore automatically on launch. Could you update and confirm whether your chat history/sessions now appear correctly? To update: download from kiro.dev. If it's still missing, a fresh Conversation ID and your exact version would help us dig in.

AnilMaktala avatar Jul 07 '26 15:07 AnilMaktala

This issue has been automatically closed due to inactivity. It has been 7 days since we requested additional information.

If you still need help with this issue, please feel free to reopen it or create a new issue with the requested details.

github-actions[bot] avatar Jul 15 '26 00:07 github-actions[bot]