diff --git a/agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/local/LocalFilesystemWithShell.java b/agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/local/LocalFilesystemWithShell.java index 2de590b4d2..fc0b743406 100644 --- a/agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/local/LocalFilesystemWithShell.java +++ b/agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/local/LocalFilesystemWithShell.java @@ -409,18 +409,17 @@ public ExecuteResponse execute( } private Path resolveExecuteCwd(RuntimeContext rc) { - if (shellCwd != null) { - return shellCwd; - } + Path base = shellCwd != null ? shellCwd : getCwd(); + NamespaceFactory nsf = getNamespaceFactory(); if (nsf == null) { - return getCwd(); + return base; } List ns = nsf.getNamespace(rc); if (ns == null || ns.isEmpty()) { - return getCwd(); + return base; } - Path namespaced = getCwd(); + Path namespaced = base; for (String segment : ns) { namespaced = namespaced.resolve(segment); }