@@ -355,19 +355,28 @@ export class SessionDiscovery {
355355 if ( await this . pathExists ( workspaceStoragePath ) ) {
356356 const workspaceDirs = await fs . promises . readdir ( workspaceStoragePath ) ;
357357 await this . runWithConcurrency ( workspaceDirs , async ( workspaceDir ) => {
358- const chatSessionsPath = path . join ( workspaceStoragePath , workspaceDir , 'chatSessions' ) ;
359- try {
360- if ( await this . pathExists ( chatSessionsPath ) ) {
361- const sessionFiles2 = ( await fs . promises . readdir ( chatSessionsPath ) )
362- . filter ( file => file . endsWith ( '.json' ) || file . endsWith ( '.jsonl' ) )
363- . map ( file => path . join ( chatSessionsPath , file ) ) ;
364- if ( sessionFiles2 . length > 0 ) {
365- this . deps . log ( `📄 Found ${ sessionFiles2 . length } session files in ${ pathName } /workspaceStorage/${ workspaceDir } ` ) ;
366- sessionFiles . push ( ...sessionFiles2 ) ;
358+ // Older Copilot Chat versions stored sessions at <hash>/chatSessions/
359+ // Newer versions (v0.45+) nest under <hash>/GitHub.copilot-chat/chatSessions/
360+ // On Linux the filesystem is case-sensitive so check both casings.
361+ const chatSessionsCandidates = [
362+ path . join ( workspaceStoragePath , workspaceDir , 'chatSessions' ) ,
363+ path . join ( workspaceStoragePath , workspaceDir , 'GitHub.copilot-chat' , 'chatSessions' ) ,
364+ path . join ( workspaceStoragePath , workspaceDir , 'github.copilot-chat' , 'chatSessions' ) ,
365+ ] ;
366+ for ( const chatSessionsPath of chatSessionsCandidates ) {
367+ try {
368+ if ( await this . pathExists ( chatSessionsPath ) ) {
369+ const sessionFiles2 = ( await fs . promises . readdir ( chatSessionsPath ) )
370+ . filter ( file => file . endsWith ( '.json' ) || file . endsWith ( '.jsonl' ) )
371+ . map ( file => path . join ( chatSessionsPath , file ) ) ;
372+ if ( sessionFiles2 . length > 0 ) {
373+ this . deps . log ( `📄 Found ${ sessionFiles2 . length } session files in ${ pathName } /workspaceStorage/${ workspaceDir } ` ) ;
374+ sessionFiles . push ( ...sessionFiles2 ) ;
375+ }
367376 }
377+ } catch {
378+ // Ignore individual workspace dir errors
368379 }
369- } catch {
370- // Ignore individual workspace dir errors
371380 }
372381 } , 6 ) ;
373382 }
@@ -391,15 +400,20 @@ export class SessionDiscovery {
391400 this . deps . warn ( `Could not check global storage path ${ globalStoragePath } : ${ checkError } ` ) ;
392401 }
393402
394- // GitHub Copilot Chat extension global storage
395- const copilotChatGlobalPath = path . join ( codeUserPath , 'globalStorage' , 'github.copilot-chat' ) ;
396- try {
397- if ( await this . pathExists ( copilotChatGlobalPath ) ) {
398- this . deps . log ( `📄 Scanning ${ pathName } /globalStorage/github.copilot-chat` ) ;
399- await this . scanDirectoryForSessionFiles ( copilotChatGlobalPath , sessionFiles ) ;
403+ // GitHub Copilot Chat extension global storage.
404+ // VS Code creates the folder using the extension's publisher+name ID as-is.
405+ // On case-sensitive Linux filesystems 'GitHub.copilot-chat' and
406+ // 'github.copilot-chat' are distinct — check both to be safe.
407+ for ( const extFolderName of [ 'GitHub.copilot-chat' , 'github.copilot-chat' ] ) {
408+ const copilotChatGlobalPath = path . join ( codeUserPath , 'globalStorage' , extFolderName ) ;
409+ try {
410+ if ( await this . pathExists ( copilotChatGlobalPath ) ) {
411+ this . deps . log ( `📄 Scanning ${ pathName } /globalStorage/${ extFolderName } ` ) ;
412+ await this . scanDirectoryForSessionFiles ( copilotChatGlobalPath , sessionFiles ) ;
413+ }
414+ } catch ( checkError ) {
415+ this . deps . warn ( `Could not check Copilot Chat global storage path ${ copilotChatGlobalPath } : ${ checkError } ` ) ;
400416 }
401- } catch ( checkError ) {
402- this . deps . warn ( `Could not check Copilot Chat global storage path ${ copilotChatGlobalPath } : ${ checkError } ` ) ;
403417 }
404418 } , 4 ) ;
405419
0 commit comments