@@ -183,7 +183,7 @@ describe("resolveSandboxFsPathWithMounts", () => {
183183 expect ( thrown ) . toBeInstanceOf ( Error ) ;
184184 const message = ( thrown as Error ) . message ;
185185 expect ( message ) . toContain (
186- ` Path escapes sandbox root (~${ path . sep } workspace-coder; container root /workspace): /tmp/outside` ,
186+ " Path escapes sandbox root (~/ workspace-coder; container root /workspace): /tmp/outside" ,
187187 ) ;
188188 expect ( message ) . toContain ( "Use a path under /workspace/ instead." ) ;
189189 expect ( message ) . not . toContain ( os . homedir ( ) ) ;
@@ -208,12 +208,29 @@ describe("resolveSandboxFsPathWithMounts", () => {
208208 defaultContainerRoot : sandbox . containerWorkdir ,
209209 mounts : buildSandboxFsMounts ( sandbox ) ,
210210 } ) ,
211- ) . toThrow (
212- `Path escapes sandbox root (~${ path . sep } workspace-coder; container root /workspace)` ,
213- ) ;
211+ ) . toThrow ( "Path escapes sandbox root (~/workspace-coder; container root /workspace)" ) ;
214212 } ,
215213 ) ;
216214
215+ it ( "keeps non-home workspace roots in the native host format" , ( ) => {
216+ const root = path . parse ( os . homedir ( ) ) . root ;
217+ const workspaceDir = path . join ( root , "openclaw-non-home-workspace" ) ;
218+ const sandbox = createSandbox ( {
219+ workspaceDir,
220+ agentWorkspaceDir : workspaceDir ,
221+ } ) ;
222+
223+ expect ( ( ) =>
224+ resolveSandboxFsPathWithMounts ( {
225+ filePath : path . join ( root , "openclaw-outside" , "secret.txt" ) ,
226+ cwd : sandbox . workspaceDir ,
227+ defaultWorkspaceRoot : sandbox . workspaceDir ,
228+ defaultContainerRoot : sandbox . containerWorkdir ,
229+ mounts : buildSandboxFsMounts ( sandbox ) ,
230+ } ) ,
231+ ) . toThrow ( `Path escapes sandbox root (${ workspaceDir } ; container root /workspace)` ) ;
232+ } ) ;
233+
217234 it ( "prefers custom bind mounts over default workspace mount at /workspace" , ( ) => {
218235 const sandbox = createSandbox ( {
219236 docker : {
0 commit comments