@@ -904,6 +904,54 @@ describe("session HttpApi", () => {
904904 { git : true , config : { formatter : false , lsp : false , share : "disabled" } } ,
905905 )
906906
907+ it . instance (
908+ "lists Windows sessions for equivalent directory spellings" ,
909+ ( ) =>
910+ Effect . gen ( function * ( ) {
911+ if ( process . platform !== "win32" ) return
912+ const test = yield * TestInstance
913+ const headers = { "x-opencode-directory" : test . directory , "content-type" : "application/json" }
914+ const created = yield * requestJson < Session . Info > ( SessionPaths . create , {
915+ method : "POST" ,
916+ headers,
917+ body : JSON . stringify ( { title : "windows spelling" } ) ,
918+ } )
919+
920+ const forwardSlashes = test . directory . replaceAll ( "\\" , "/" )
921+ const lowercaseDrive = test . directory . replace ( / ^ [ A - Z ] : / , ( drive ) => drive . toLowerCase ( ) )
922+ const trailingSeparator = `${ test . directory } \\`
923+ for ( const spelling of [ forwardSlashes , lowercaseDrive , trailingSeparator ] ) {
924+ const query = new URLSearchParams ( { directory : spelling , roots : "true" } )
925+ const listed = yield * requestJson < Session . Info [ ] > ( `${ SessionPaths . list } ?${ query } ` , { headers } )
926+ expect ( { spelling, ids : listed . map ( ( item ) => item . id ) } ) . toEqual ( { spelling, ids : [ created . id ] } )
927+ }
928+ } ) ,
929+ { git : true , config : { formatter : false , lsp : false , share : "disabled" } } ,
930+ { timeout : 15000 } ,
931+ )
932+
933+ it . instance (
934+ "lists Windows sessions created through the global worktree sentinel" ,
935+ ( ) =>
936+ Effect . gen ( function * ( ) {
937+ if ( process . platform !== "win32" ) return
938+ const globalWorktreeSentinel = "/"
939+ const headers = { "x-opencode-directory" : globalWorktreeSentinel , "content-type" : "application/json" }
940+ const driveRootSession = yield * requestJson < Session . Info > ( SessionPaths . create , {
941+ method : "POST" ,
942+ headers,
943+ body : JSON . stringify ( { title : "created at drive root" } ) ,
944+ } )
945+ expect ( driveRootSession . directory ) . toMatch ( / ^ [ A - Z a - z ] : \\ $ / )
946+
947+ const query = new URLSearchParams ( { directory : globalWorktreeSentinel , roots : "true" } )
948+ const listed = yield * requestJson < Session . Info [ ] > ( `${ SessionPaths . list } ?${ query } ` , { headers } )
949+ expect ( listed . map ( ( item ) => item . id ) ) . toContain ( driveRootSession . id )
950+ } ) ,
951+ { git : true , config : { formatter : false , lsp : false , share : "disabled" } } ,
952+ { timeout : 15000 } ,
953+ )
954+
907955 it . instance (
908956 "serves paginated message link headers" ,
909957 ( ) =>
0 commit comments