Skip to content

Fix CLI chat history isolation for same-named projects - #1473

Open
Aaron-Savron wants to merge 1 commit into
CodebuffAI:mainfrom
Aaron-Savron:fix/cli-project-history-isolation
Open

Aaron-Savron wants to merge 1 commit into
CodebuffAI:mainfrom
Aaron-Savron:fix/cli-project-history-isolation

Conversation

@Aaron-Savron

Copy link
Copy Markdown

found this while walking through the CLI code a lil bit. chat storage was keyed by just the folder name, so /client-a/app and /client-b/app shared the same saved chats. continuing in B actually restored A's transcript and saved run state. matching chat IDs could also overwrite each other, and deleting the chat in B removed it from A too.

this keys storage by a SHA-256 of the resolved absolute project path, under a separate projects/by-path namespace. saving, history, deletion and continuation already use the same project directory helper so they stay isolated together.

old history stays on disk. there's no automatic basename fallback or migration because those files don't reliably identify their owning project, and guessing would keep the wrong-project resume bug around. added recovery instructions for copying individual chats after checking which project they belong to, linked from the README. this means old chats need that manual recovery step before they show up in the new history.

validation:

  • the real filesystem regression tests failed on the original source: wrong-project continuation, shared chat deletion and legacy auto-restoration. no module mocks or model calls
  • 70 tests passed across project history, chat ID lifecycle, run-state storage, chat history, chat metadata and atomic writes, including recovery of a selected legacy chat
  • CLI typecheck against the starting main snapshot (65bca0da9) had the same existing errors as its unchanged worktree after normalizing checkout paths; no new diagnostics. rebased onto latest main and reran all 70 tests successfully
  • verified on Linux with Bun 1.3.14. used the preceding lockfile's installed dependencies because the current exported AI SDK dependencies have an unrelated import incompatibility; no dependency changes in this PR

this only changes the CLI persistence key, tests and recovery docs. it does not include either of my other fixes.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant