Skip to content

Do not downgrade runner and shim by default - #4297

Open
un-def wants to merge 1 commit into
masterfrom
pr_disallow_downgrade_runner_shim
Open

un-def wants to merge 1 commit into
masterfrom
pr_disallow_downgrade_runner_shim

Conversation

@un-def

@un-def un-def commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

When several server replicas of different versions run at the same time, as during a rolling deployment, each of them tried to install the component version matching its own, fighting over the instance and reinstalling the binaries in a loop.

The server now installs a component only if it can prove that the installed version is older than the expected one. Versions are compared as PyPA versions rather than as strings, so equivalent spellings such as 0.20.1 and 0.20.1.0 no longer trigger a reinstall. An unparseable version never leads to an install: on the installed side it means a dev build, which is assumed to be the newest one; on the expected side it's a server misconfiguration, which is logged as a warning.

Downgrading is still possible via DSTACK_RUNNER_ALLOW_DOWNGRADE and DSTACK_SHIM_ALLOW_DOWNGRADE. They are meant for a server downgrade, which requires manual actions anyway, and are incompatible with rolling deployment.

Also:

  • Drop the DSTACK_SHIM_VERSION fallback to DSTACK_RUNNER_VERSION, which was never documented and warned about its removal for a long time.
  • Document DSTACK_SHIM_VERSION and DSTACK_{RUNNER,SHIM}_VERSION_URL, and correct the DSTACK_RUNNER_VERSION description: it never defaulted to latest, that is only the download URL placeholder fallback when the version cannot be determined.

When several server replicas of different versions run at the same
time, as during a rolling deployment, each of them tried to install
the component version matching its own, fighting over the instance
and reinstalling the binaries in a loop.

The server now installs a component only if it can prove that the
installed version is older than the expected one. Versions are
compared as PyPA versions rather than as strings, so equivalent
spellings such as `0.20.1` and `0.20.1.0` no longer trigger a
reinstall. An unparseable version never leads to an install: on the
installed side it means a dev build, which is assumed to be the newest
one; on the expected side it's a server misconfiguration, which is
logged as a warning.

Downgrading is still possible via `DSTACK_RUNNER_ALLOW_DOWNGRADE` and
`DSTACK_SHIM_ALLOW_DOWNGRADE`. They are meant for a server downgrade,
which requires manual actions anyway, and are incompatible with
rolling deployment.

Also:

* Drop the `DSTACK_SHIM_VERSION` fallback to `DSTACK_RUNNER_VERSION`,
  which was never documented and warned about its removal for a long
  time.
* Document `DSTACK_SHIM_VERSION` and `DSTACK_{RUNNER,SHIM}_VERSION_URL`,
  and correct the `DSTACK_RUNNER_VERSION` description: it never
  defaulted to `latest`, that is only the download URL placeholder
  fallback when the version cannot be determined.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant