File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,6 +262,18 @@ describe('cli', () => {
262262 expect ( renderApp ) . toHaveBeenCalledWith ( 'session-1' ) ;
263263 } ) ;
264264
265+ it ( 'allows resume when session has no directory field (legacy session)' , async ( ) => {
266+ loadSession . mockReturnValueOnce ( {
267+ metadata : { id : 'session-1' , directory : undefined } ,
268+ messages : [ ] ,
269+ } ) ;
270+
271+ await commandState . resumeAction ?.( 'session-1' ) ;
272+
273+ expect ( renderApp ) . toHaveBeenCalledWith ( 'session-1' ) ;
274+ expect ( writeError ) . not . toHaveBeenCalled ( ) ;
275+ } ) ;
276+
265277 it ( 'blocks TUI and errors when resuming a session from a different directory' , async ( ) => {
266278 loadSession . mockReturnValueOnce ( {
267279 metadata : { id : 'session-1' , directory : '/other/project' } ,
Original file line number Diff line number Diff line change 3131 . action ( async ( sessionId : string ) => {
3232 try {
3333 const loaded = session . loadSession ( sessionId ) ;
34- if ( loaded . metadata . directory !== process . cwd ( ) ) {
34+ if (
35+ loaded . metadata . directory &&
36+ loaded . metadata . directory !== process . cwd ( )
37+ ) {
3538 terminal . writeError (
3639 terminal . color (
3740 `${ UI . WARNING } Cannot resume: session belongs to ${ loaded . metadata . directory } \n` ,
You can’t perform that action at this time.
0 commit comments