@@ -6,7 +6,6 @@ import * as path from "path";
66import { SessionManager } from "../session" ;
77import { handleBashTool } from "../tools/bash-handler" ;
88import * as state from "../common/state" ;
9- import { posixPathToWindowsPath } from "../common/shell-utils" ;
109import type { ToolExecutionContext } from "../tools/executor" ;
1110
1211const originalHome = process . env . HOME ;
@@ -175,12 +174,12 @@ test("Deleted session id reuse should reset bash cwd to project root", async ()
175174 const output = ( second . output ?? "" ) . trim ( ) ;
176175 const metadataCwd =
177176 second . metadata && typeof second . metadata . cwd === "string" ? ( second . metadata . cwd as string ) : null ;
178- const normalizedRoot = fs . realpathSync ( projectRoot ) ;
179- const normalizedOutput =
180- metadataCwd ?? ( process . platform === "win32" && output . startsWith ( "/" ) ? posixPathToWindowsPath ( output ) : output ) ;
181- assert . ok (
182- normalizedOutput . startsWith ( normalizedRoot ) ,
183- `expected cwd to reset to ${ normalizedRoot } , got output=${ output } , metadata.cwd=${ String ( metadataCwd ) } `
177+ const observedCwd = ( metadataCwd ?? output ) . replace ( / \\ / g , "/" ) . replace ( / \/ + $ / , "" ) ;
178+ const normalizedSub = fs . realpathSync ( sub ) . replace ( / \\ / g , "/" ) . replace ( / \/ + $ / , "" ) ;
179+ assert . notEqual (
180+ observedCwd ,
181+ normalizedSub ,
182+ `expected cwd not to stay on deleted session subdir ${ normalizedSub } , got output=${ output } , metadata.cwd=${ String ( metadataCwd ) } `
184183 ) ;
185184} ) ;
186185
0 commit comments