Summary
In dstack CLI 0.22.0/0.22.1, dstack apply --no-repo still initializes the default virtual repository and calls POST /api/project/{project}/repos/init.
Reproduction
Run a repo-free task with dstack apply -f task.yml --no-repo -y. The CLI still calls /repos/init; on a project where the caller cannot initialize repositories, apply fails with 403.
Cause
In src/dstack/_internal/cli/services/configurators/run.py, get_repo() returns None when configurator_args.no_repo is set, but get_plan() unconditionally creates the default virtual repo:
repo = self.get_repo(conf, configuration_path, configurator_args)
if repo is None:
repo = init_default_virtual_repo(api=self.api)
Proposed fix
repo = self.get_repo(conf, configuration_path, configurator_args)
if repo is None and not configurator_args.no_repo:
repo = init_default_virtual_repo(api=self.api)
Expected behavior
- With
--no-repo, do not call /repos/init and submit the run without a repo.
- Without
--no-repo, preserve the current default virtual repo behavior.
- Add a CLI regression test asserting
init_default_virtual_repo() is not called when no_repo=True.
Summary
In dstack CLI 0.22.0/0.22.1,
dstack apply --no-repostill initializes the default virtual repository and callsPOST /api/project/{project}/repos/init.Reproduction
Run a repo-free task with
dstack apply -f task.yml --no-repo -y. The CLI still calls/repos/init; on a project where the caller cannot initialize repositories, apply fails with 403.Cause
In
src/dstack/_internal/cli/services/configurators/run.py,get_repo()returnsNonewhenconfigurator_args.no_repois set, butget_plan()unconditionally creates the default virtual repo:Proposed fix
Expected behavior
--no-repo, do not call/repos/initand submit the run without a repo.--no-repo, preserve the current default virtual repo behavior.init_default_virtual_repo()is not called whenno_repo=True.