fix(daytona): don't guess /root on cwd probe failure, keep constructor default; update tests to reflect this
Signed-off-by: rovle <lovre.pesut@gmail.com>
This commit is contained in:
@@ -115,15 +115,15 @@ class TestCwdResolution:
|
||||
env = make_env(cwd="/workspace", home_dir="/root")
|
||||
assert env.cwd == "/workspace"
|
||||
|
||||
def test_home_detection_failure_falls_back_to_root(self, make_env):
|
||||
def test_home_detection_failure_keeps_default_cwd(self, make_env):
|
||||
sb = _make_sandbox()
|
||||
sb.process.exec.side_effect = RuntimeError("exec failed")
|
||||
env = make_env(sandbox=sb)
|
||||
assert env.cwd == "/root"
|
||||
assert env.cwd == "/home/daytona" # keeps constructor default
|
||||
|
||||
def test_empty_home_falls_back_to_root(self, make_env):
|
||||
def test_empty_home_keeps_default_cwd(self, make_env):
|
||||
env = make_env(home_dir="")
|
||||
assert env.cwd == "/root"
|
||||
assert env.cwd == "/home/daytona" # keeps constructor default
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -98,9 +98,10 @@ class DaytonaEnvironment(BaseEnvironment):
|
||||
if self._requested_cwd in ("~", "/home/daytona"):
|
||||
try:
|
||||
home = self._sandbox.process.exec("echo $HOME").result.strip()
|
||||
self.cwd = home or "/root"
|
||||
if home:
|
||||
self.cwd = home
|
||||
except Exception:
|
||||
self.cwd = "/root"
|
||||
pass # leave cwd as-is; sandbox will use its own default
|
||||
logger.info("Daytona: resolved cwd to %s", self.cwd)
|
||||
|
||||
def _ensure_sandbox_ready(self):
|
||||
|
||||
Reference in New Issue
Block a user