@@ -490,6 +490,8 @@ describe('ClaudeCodeSessionService', () => {
490490 let noWorkspaceDirUri : URI ;
491491 let noWorkspaceService : ClaudeCodeSessionService ;
492492 let noWorkspaceMockFs : MockFileSystemService ;
493+ // No-workspace uses process.cwd() to compute the slug (matching SDK behavior)
494+ const cwdSlug = computeFolderSlug ( URI . file ( process . cwd ( ) ) ) ;
493495
494496 beforeEach ( ( ) => {
495497 noWorkspaceMockFs = new MockFileSystemService ( ) ;
@@ -504,12 +506,12 @@ describe('ClaudeCodeSessionService', () => {
504506 noWorkspaceMockFs = accessor . get ( IFileSystemService ) as MockFileSystemService ;
505507 const instaService = accessor . get ( IInstantiationService ) ;
506508 const nativeEnvService = accessor . get ( INativeEnvService ) ;
507- // When there's no workspace, sessions are stored in the '-' directory
508- noWorkspaceDirUri = URI . joinPath ( nativeEnvService . userHome , '.claude' , 'projects' , '-' ) ;
509+ // When there's no workspace, sessions are stored based on process.cwd()
510+ noWorkspaceDirUri = URI . joinPath ( nativeEnvService . userHome , '.claude' , 'projects' , cwdSlug ) ;
509511 noWorkspaceService = instaService . createInstance ( ClaudeCodeSessionService ) ;
510512 } ) ;
511513
512- it ( 'loads sessions from no-project directory when there are no workspace folders' , async ( ) => {
514+ it ( 'loads sessions from process.cwd() directory when there are no workspace folders' , async ( ) => {
513515 const fileName = 'no-workspace-session.jsonl' ;
514516 const fileContents = JSON . stringify ( {
515517 parentUuid : null ,
@@ -530,7 +532,7 @@ describe('ClaudeCodeSessionService', () => {
530532 expect ( sessions [ 0 ] . label ) . toBe ( 'session without workspace' ) ;
531533 } ) ;
532534
533- it ( 'returns empty array when no-project directory does not exist' , async ( ) => {
535+ it ( 'returns empty array when process.cwd() directory does not exist' , async ( ) => {
534536 // Don't mock any directory - simulate non-existent directory
535537
536538 const sessions = await noWorkspaceService . getAllSessions ( CancellationToken . None ) ;
@@ -543,6 +545,8 @@ describe('ClaudeCodeSessionService', () => {
543545 let multiRootDirUri : URI ;
544546 let multiRootService : ClaudeCodeSessionService ;
545547 let multiRootMockFs : MockFileSystemService ;
548+ // Multi-root workspaces use process.cwd() to compute the slug (matching SDK behavior)
549+ const cwdSlug = computeFolderSlug ( URI . file ( process . cwd ( ) ) ) ;
546550
547551 beforeEach ( ( ) => {
548552 multiRootMockFs = new MockFileSystemService ( ) ;
@@ -559,12 +563,12 @@ describe('ClaudeCodeSessionService', () => {
559563 multiRootMockFs = accessor . get ( IFileSystemService ) as MockFileSystemService ;
560564 const instaService = accessor . get ( IInstantiationService ) ;
561565 const nativeEnvService = accessor . get ( INativeEnvService ) ;
562- // Multi-root workspaces use the '-' directory (same as no-workspace)
563- multiRootDirUri = URI . joinPath ( nativeEnvService . userHome , '.claude' , 'projects' , '-' ) ;
566+ // Multi-root workspaces use process.cwd() slug to match where SDK stores sessions
567+ multiRootDirUri = URI . joinPath ( nativeEnvService . userHome , '.claude' , 'projects' , cwdSlug ) ;
564568 multiRootService = instaService . createInstance ( ClaudeCodeSessionService ) ;
565569 } ) ;
566570
567- it ( 'loads sessions from no-project directory for multi-root workspaces' , async ( ) => {
571+ it ( 'loads sessions from process.cwd() directory for multi-root workspaces' , async ( ) => {
568572 const fileName = 'multi-root-session.jsonl' ;
569573 const fileContents = JSON . stringify ( {
570574 parentUuid : null ,
@@ -585,16 +589,16 @@ describe('ClaudeCodeSessionService', () => {
585589 expect ( sessions [ 0 ] . label ) . toBe ( 'session in multi-root workspace' ) ;
586590 } ) ;
587591
588- it ( 'returns empty array when no-project directory does not exist for multi-root' , async ( ) => {
592+ it ( 'returns empty array when process.cwd() directory does not exist for multi-root' , async ( ) => {
589593 // Don't mock any directory - simulate non-existent directory
590594
591595 const sessions = await multiRootService . getAllSessions ( CancellationToken . None ) ;
592596
593597 expect ( sessions ) . toHaveLength ( 0 ) ;
594598 } ) ;
595599
596- it ( 'uses dash directory not individual folder slugs for multi-root' , async ( ) => {
597- // Mock the '-' directory with a session
600+ it ( 'uses process.cwd() directory not individual folder slugs for multi-root' , async ( ) => {
601+ // Mock the process.cwd() directory with a session
598602 const fileName = 'shared-session.jsonl' ;
599603 const fileContents = JSON . stringify ( {
600604 parentUuid : null ,
@@ -608,7 +612,7 @@ describe('ClaudeCodeSessionService', () => {
608612 multiRootMockFs . mockDirectory ( multiRootDirUri , [ [ fileName , FileType . File ] ] ) ;
609613 multiRootMockFs . mockFile ( URI . joinPath ( multiRootDirUri , fileName ) , fileContents , 1000 ) ;
610614
611- // The session should only come from the '-' directory, not individual folder slugs
615+ // The session should only come from the process.cwd() directory, not individual folder slugs
612616 const sessions = await multiRootService . getAllSessions ( CancellationToken . None ) ;
613617
614618 expect ( sessions ) . toHaveLength ( 1 ) ;
0 commit comments