From 6d0fac5ea2eccf4de63f0df3d14be305657a3afe Mon Sep 17 00:00:00 2001 From: Dmitry Meyer Date: Thu, 11 Dec 2025 08:28:51 +0000 Subject: [PATCH] Restore `RunSpec.working_dir` field The field is not used by the server, but clients < 0.20 still send it Fixes: https://github.com/dstackai/dstack/issues/3370 --- src/dstack/_internal/core/models/runs.py | 3 +++ src/tests/_internal/server/routers/test_runs.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/dstack/_internal/core/models/runs.py b/src/dstack/_internal/core/models/runs.py index 13e6a15722..a966bc34a0 100644 --- a/src/dstack/_internal/core/models/runs.py +++ b/src/dstack/_internal/core/models/runs.py @@ -443,6 +443,9 @@ class RunSpec(generate_dual_core_model(RunSpecConfig)): list[FileArchiveMapping], Field(description="The list of file archive ID to container path mappings."), ] = [] + # Server uses configuration.working_dir since 0.19.27 and ignores this field, but the field + # still exists for compatibility with old clients that send it. + working_dir: Optional[str] = None configuration_path: Annotated[ Optional[str], Field( diff --git a/src/tests/_internal/server/routers/test_runs.py b/src/tests/_internal/server/routers/test_runs.py index acbc4aaba2..a5a86868c6 100644 --- a/src/tests/_internal/server/routers/test_runs.py +++ b/src/tests/_internal/server/routers/test_runs.py @@ -232,6 +232,7 @@ def get_dev_env_run_plan_dict( "repo_dir": "~/repo", "run_name": run_name, "ssh_key_pub": "ssh_key", + "working_dir": None, } return { "project_name": project_name, @@ -469,6 +470,7 @@ def get_dev_env_run_dict( "repo_dir": "~/repo", "run_name": run_name, "ssh_key_pub": "ssh_key", + "working_dir": None, }, "jobs": [ { @@ -612,6 +614,7 @@ def get_service_run_spec( "repo_dir": "~/repo", "run_name": run_name, "ssh_key_pub": "ssh_key", + "working_dir": None, }