vscode-copilot-release icon indicating copy to clipboard operation
vscode-copilot-release copied to clipboard

Github Copilot Chat History not showing

Open usamashami11 opened this issue 1 year ago • 13 comments

I am a user of Github Copilot (via GitHub Education Pack). My GitHub Copilot Chat History is Not Showing, although it was working perfectly fine, earlier. I don't think there are exact steps to reproduce, but I'll try to mention what I think caused it. I have attached all logs from my VSCode, since I didn't know if there is any particular log file to attach.

Furthermore, I followed this too https://github.com/microsoft/vscode-copilot-release/issues/872 but no luck. I didn't uninstall the GitHub Copilot Extension for a reason. I had 5 VSCode windows opened. 1 window is of a Remote Instance connected via SSH, and it had GitHub Copilot History as well. So if it was extension related, then it should occur only in the local extension but all my chats are gone, including the ones which I accessed via the same VSCode, but for the remote instance session! I am pissed due to this, as the chat history had important stuff. There is no option to sync or export the chat easily, and even though I was planning to export it as .json, I was unsure if it will download all chats together or 1 chat individually, even if there are multiple chats in a session/window.

  • Copilot Chat Extension Version: 0.23.2
  • VS Code Version: 1.96.2
  • OS Version: Windows_NT x64 10.0.26100 (Windows 11 Home - Version 24H2)
  • Logs: vscode_logs.zip

Steps to Reproduce:

  1. My PC apps were a bit stuck, so I just ended VSCode from Task Manager, and relaunched it
  2. I have checked my chat sessions, but all sessions are gone!

I have done closing the VSCode in past too, via Task Manager, or even via direct shutdown, but all the windows, along with their Github Copilot chats, are always restored. Even for the remote instance, which I usually shut down and connect again daily, the chats stay there! So, I am surprised how all chats vanished! I didn't close sessions/windows for VSCode, so I won't lose the chat history and now it's gone! Please Help! Let me know if you need anything else.

usamashami11 avatar Dec 24 '24 13:12 usamashami11

Chat sessions are stored per workspace. May I know if it happened for all workspaces or to a specific one?

sandy081 avatar Dec 24 '24 15:12 sandy081

@sandy081 It happened to all workspaces, even the one which was utilizing the GitHub Copilot Chat Extension installed in the Remote Instance.

Moreover, If you see the log files, I did see the 5 window folders, but I believe they have data for today. Not sure they must contain older timestamp too, or they are refreshed everytime VSCode restarts.

usamashami11 avatar Dec 24 '24 18:12 usamashami11

Adding one more thing, previously I didn't restart my PC, but right now, I even tried restarting my PC after applying the pending update too, and restoring all the windows but nothing happened. Let me know if anything else is required from my side. I hope my chat history is recovered

usamashami11 avatar Dec 25 '24 12:12 usamashami11

For me this is happening to all of my WSL workspaces. My Windows workspaces appear to have their prior chats still, but I do most of my work in WSL so I've lost almost all of my Copilot Chats history. At first I lost all but the most recent one, then after I tried the suggestions in #872 even that one disappeared.

grantg-ht avatar Mar 24 '25 18:03 grantg-ht

I am also facing this type of problem. I have all my chat history in my local VS code, but when I connect my Linux server with SSH through VS code, I can't able to get my previous chat history.

shoaibmehrab avatar Mar 28 '25 18:03 shoaibmehrab

I am also facing this type of problem. I have all my chat history in my local VS code, but when I connect my Linux server with SSH through VS code, I can't able to get my previous chat history.

@shoaibmehrab The VSCode Chat History is session dependent, meaning every new window (to open a new or same project), and the history will not show up. If your existing windows stays open, or you refresh it, it will load, however, in some cases, my history even got deleted after refreshing or restarting the PC (which shouldn't be happening). I think it's due to the fact that the files created locally, got deleted. I don't even know what's the fix but to keep on exporting the chat as JSON, and maybe convert them into .md files (so I may read it in future if I want to), otherwise it's something so saddening, regarding which no solution has been provided yet by MS.

usamashami11 avatar Apr 23 '25 05:04 usamashami11

The output codes and responses are stored at system folder but it's not human-friendly format.

# fish shell
set baseDir (wslpath (wslvar appdata))/Code/User/workspaceStorage  # stored here
ll -tr $baseDir          # find the latest folder number

# search target sessionId with the specific keyword: 'text'
rg -l --fixed-strings --glob '*.json' 'text' $baseDir/*/chatSessions 
rg -l --fixed-strings --glob '*.json' 'text' $baseDir/*/chatSessions | \
xargs -I {} jq -rc '
      try (
        {
          sessionId: .sessionId,
          creationDate: (.creationDate | strftime("%F %T")),
          lastMessageDate: (.lastMessageDate | strftime("%F %T")),
          firstRequest: .requests[0].message.text[:1000]
        }
      ) catch empty
    ' {}  | jq -s '[sort_by(.lastMessageDate)[]]'

convert to markdown

set sessionId 304a75a3-86c5-4615-a66c-a825467b9c44
fd -t d $sessionId $baseDir/*/chatEditingSessions
set folderNum 2e16bda007086c33c12ef0a569781251
set targetSession $baseDir/$folderNum/chatSessions/$sessionId.json
jq -r '.requests[] | "**Request:**\n" + .message.text + "\n\n**Response:**\n" + .response[0].value + "\n" ' $targetSession > chat.md

gh markdown-preview chat.md

So you should include chat.json to each commit with working version.

morisono avatar Apr 25 '25 03:04 morisono

Because I've experienced all of these (chat history getting lost, moving between computers), I built an extension to autosave chat history into my project folder. This way I can version the chat history in git, search it, and share it. I can't quite automagically pick up where an old chat left off, but I can create a new chat and # reference the saved chat file as a starting point. One caveat, when you use VSCode search with this extension, you need to be explicit about whether you want to include or exclude the .specstory directory otherwise you'll get a lot of noisy hits.

Image

jakelevirne avatar Apr 29 '25 21:04 jakelevirne

@jakelevirne better than nothing. Way to go! So annoying to lose context of the chat history every time. It defeats the purpose of a paid license.

SerhiiAksiutin avatar Apr 29 '25 22:04 SerhiiAksiutin

So it's not neatly in a folder somewhere on my computer? A copying and a pasting I go...

POPeeeDev avatar May 15 '25 17:05 POPeeeDev

It's absolutely ridiculous that copilot doesn't save chats cleanly. Mine are lost every single time I shut down visual studio. I expect better from a multi trillion dollar company...

Darknuke1987 avatar May 20 '25 18:05 Darknuke1987

@POPeeeDev @Darknuke1987 Well yes, they are not explicitly or cleanly stored rather they are stored temporarily in the VSCode folder which is present in User Directory I guess, when a software is installed. Moreover, don't expect a fix anymore and now yesterday Microsoft has Open Sourced Github Copilot code, so the only hope of fixing it would be the community now lol

usamashami11 avatar May 21 '25 07:05 usamashami11

This is like basic feature to have - sync the data with your GithHub account. OpenAI Codex also over-complicates but at least has a clear location for all Codex data so that I can copy that between computers and have full access to my history tasks....

marcinczenko avatar Nov 07 '25 02:11 marcinczenko

@marcinczenko Same for me here. My disk has just run out of space and several apps crashed. After cleaning things up and restarting the system, all my VS Code (local) settings are gone — including all chat sessions.

When I check the chatSessions directory under .../.config/Code/User/workspaceStorage, I can see all my lost chat sessions, but VS Code Copilot still doesn’t let me restore them as usable chat sessions.


EDIT:

I just found a way to recover the entire chatSessions (when the issue is just state.vscdb losing track of the existent sessions). You can check my solution in this repo: https://github.com/jeziellopes/vscode-chat-history-fix.

jeziellopes avatar Nov 19 '25 12:11 jeziellopes

I just found a way to recover the entire chatSessions (when the issue is just state.vscdb losing track of the existent sessions). You can check my solution in this repo: https://github.com/jeziellopes/vscode-chat-history-fix.

Hooray! Thanks @jeziellopes! Your tool just saved hundreds of my chats!

skehlet avatar Nov 26 '25 01:11 skehlet

@marcinczenko Same for me here. My disk has just run out of space and several apps crashed. After cleaning things up and restarting the system, all my VS Code (local) settings are gone — including all chat sessions.

When I check the chatSessions directory under .../.config/Code/User/workspaceStorage, I can see all my lost chat sessions, but VS Code Copilot still doesn’t let me restore them as usable chat sessions.


EDIT:

I just found a way to recover the entire chatSessions (when the issue is just state.vscdb losing track of the existent sessions). You can check my solution in this repo: https://github.com/jeziellopes/vscode-chat-history-fix.

Wow @jeziellopes! You really put lots of effort into it. Great job! Do you think it could work to move chats from one machine to another?

marcinczenko avatar Nov 26 '25 02:11 marcinczenko

@marcinczenko Same for me here. My disk has just run out of space and several apps crashed. After cleaning things up and restarting the system, all my VS Code (local) settings are gone — including all chat sessions. When I check the chatSessions directory under .../.config/Code/User/workspaceStorage, I can see all my lost chat sessions, but VS Code Copilot still doesn’t let me restore them as usable chat sessions.

EDIT: I just found a way to recover the entire chatSessions (when the issue is just state.vscdb losing track of the existent sessions). You can check my solution in this repo: https://github.com/jeziellopes/vscode-chat-history-fix.

Wow @jeziellopes! You really put lots of effort into it. Great job! Do you think it could work to move chats from one machine to another?

@marcinczenko I ran a test today and, although my fix works by simply reading the file structure of chatSessions (from existing workspaces) and reindexing it in state.vscdb, it still doesn't work for machine migration. VSCode has a peculiar way of handling new workspaces, and I don't fully understand it yet. But I'll try something soon.

jeziellopes avatar Nov 26 '25 14:11 jeziellopes