Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Desktop: pin the shipped backend package version so a shared venv gets upgraded (#7926)

Daniel Han614cae8793d6
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index 996bd6b9486..05bce2161e0 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -371,6 +371,9 @@ jobs:
STUDIO_VERSION: ${{ needs.prepare-version.outputs.studio_version }}
DESKTOP_RELEASE_TAG: ${{ needs.prepare-version.outputs.desktop_release_tag }}
DESKTOP_PRERELEASE: ${{ needs.prepare-version.outputs.prerelease }}
+ # Compiled in by preflight/version.rs. Without it the app only knows the
+ # floor, so a shared venv left by the CLI installer is never upgraded again.
+ UNSLOTH_DESKTOP_BACKEND_VERSION: ${{ needs.prepare-version.outputs.pypi_version }}
steps:
# harden-runner in audit mode: surfaces every egress destination in
diff --git a/studio/src-tauri/src/commands.rs b/studio/src-tauri/src/commands.rs
index 0c637312d91..1fd26b77be5 100644
--- a/studio/src-tauri/src/commands.rs
+++ b/studio/src-tauri/src/commands.rs
@@ -682,7 +682,7 @@ mod tests {
String::new()
};
format!(
- r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.5.3","desktop_protocol_version":1,"desktop_manageability_version":1,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{ROOT_ID}"{owner}}}"#
+ r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.8.4","desktop_protocol_version":1,"desktop_manageability_version":1,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{ROOT_ID}"{owner}}}"#
)
}
diff --git a/studio/src-tauri/src/desktop_backend_owner.rs b/studio/src-tauri/src/desktop_backend_owner.rs
index fc35f7143da..5e0c7b13edf 100644
--- a/studio/src-tauri/src/desktop_backend_owner.rs
+++ b/studio/src-tauri/src/desktop_backend_owner.rs
@@ -1096,7 +1096,7 @@ mod tests {
async fn authenticated_health_uses_login_bearer_and_accepts_ready_version() {
let (port, seen, server) = http_sequence_server(vec![
("200 OK", r#"{"access_token":"test-access-token"}"#),
- ("200 OK", r#"{"version":"2026.5.3"}"#),
+ ("200 OK", r#"{"version":"2026.8.4"}"#),
])
.await;
diff --git a/studio/src-tauri/src/preflight.rs b/studio/src-tauri/src/preflight.rs
index fdacab8538b..b093ed25533 100644
--- a/studio/src-tauri/src/preflight.rs
+++ b/studio/src-tauri/src/preflight.rs
@@ -23,7 +23,10 @@ use backend::{backend_desktop_auth_status, backend_health};
#[cfg(test)]
use managed::probe_managed_bin;
#[cfg(test)]
-use version::{backend_version_compatible, MIN_DESKTOP_BACKEND_VERSION};
+use version::{
+ backend_version_compatible, backend_version_outdated_reason, expected_backend_version,
+ managed_backend_version_stale_reason, MIN_DESKTOP_BACKEND_VERSION,
+};
fn release_auto_repair() -> bool {
!cfg!(debug_assertions)
@@ -433,23 +436,22 @@ mod tests {
fn backend_version_gate_classifies_core_cases() {
for version in [
MIN_DESKTOP_BACKEND_VERSION,
- "2026.5.4",
+ "2026.8.5",
"2027.1.0",
- "2026.5.3.post1",
- "2026.5.3+local",
- "2026.5.3.post1",
+ "2026.8.4.post1",
+ "2026.8.4+local",
] {
assert!(backend_version_compatible(Some(version)), "{version}");
}
for (version, reason) in [
(None, "desktop_backend_version_missing"),
(Some("not-a-version"), "desktop_backend_version_invalid"),
- (Some("2026.5.3.1"), "desktop_backend_version_invalid"),
- (Some("2026.5.3foo"), "desktop_backend_version_invalid"),
- (Some("2026.5.3.devx"), "desktop_backend_version_invalid"),
+ (Some("2026.8.4.1"), "desktop_backend_version_invalid"),
+ (Some("2026.8.4foo"), "desktop_backend_version_invalid"),
+ (Some("2026.8.4.devx"), "desktop_backend_version_invalid"),
(Some("2026.5.2"), "desktop_backend_version_too_old"),
- (Some("2026.5.3rc1"), "desktop_backend_version_too_old"),
- (Some("2026.5.3.dev1"), "desktop_backend_version_too_old"),
+ (Some("2026.8.4rc1"), "desktop_backend_version_too_old"),
+ (Some("2026.8.4.dev1"), "desktop_backend_version_too_old"),
] {
assert_eq!(
backend_version_stale_reason(version).as_deref(),
@@ -462,6 +464,45 @@ mod tests {
);
}
+ #[test]
+ fn managed_venv_behind_the_shipped_backend_is_outdated() {
+ // Above the floor but below what this build shipped: the exact case the
+ // standalone installer leaves behind in the shared venv.
+ assert_eq!(
+ backend_version_outdated_reason(Some("2026.8.4"), "2026.8.5").as_deref(),
+ Some("desktop_backend_version_outdated")
+ );
+ for version in ["2026.8.5", "2026.8.6", "2027.1.0"] {
+ assert_eq!(
+ backend_version_outdated_reason(Some(version), "2026.8.5"),
+ None,
+ "{version}"
+ );
+ }
+ // The floor still speaks first, so its reasons keep reaching the UI.
+ for (version, reason) in [
+ (None, "desktop_backend_version_missing"),
+ (Some("not-a-version"), "desktop_backend_version_invalid"),
+ (Some("2026.5.2"), "desktop_backend_version_too_old"),
+ ] {
+ assert_eq!(
+ backend_version_outdated_reason(version, "2026.8.5").as_deref(),
+ Some(reason)
+ );
+ }
+ // Unstamped builds fall back to the floor, so the managed gate reduces
+ // to the shared one for dev and CI.
+ assert_eq!(expected_backend_version(), MIN_DESKTOP_BACKEND_VERSION);
+ assert_eq!(
+ managed_backend_version_stale_reason(Some(MIN_DESKTOP_BACKEND_VERSION)),
+ None
+ );
+ assert_eq!(
+ managed_backend_version_stale_reason(Some("2026.5.2")).as_deref(),
+ Some("desktop_backend_version_too_old")
+ );
+ }
+
#[cfg(unix)]
struct FakeCli {
bin: PathBuf,
@@ -578,7 +619,7 @@ exit 1
r#"#!/bin/sh
if [ "$1" = "-h" ]; then exit 0; fi
if [ "$1" = "studio" ] && [ "$2" = "desktop-capabilities" ] && [ "$3" = "--json" ]; then
- printf '{"desktop_protocol_version":1,"desktop_manageability_version":2,"supports_api_only":true,"supports_provision_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_install_ok":true,"version":"2026.5.3"}'
+ printf '{"desktop_protocol_version":1,"desktop_manageability_version":2,"supports_api_only":true,"supports_provision_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_install_ok":true,"version":"2026.8.4"}'
exit 0
fi
exit 1
@@ -590,7 +631,7 @@ exit 1
r#"#!/bin/sh
if [ "$1" = "-h" ]; then exit 0; fi
if [ "$1" = "studio" ] && [ "$2" = "desktop-capabilities" ] && [ "$3" = "--json" ]; then
- printf '{"desktop_protocol_version":1,"desktop_manageability_version":2,"supports_api_only":true,"supports_provision_desktop_auth":false,"supports_desktop_backend_ownership":true,"desktop_auth_stale_reason":"cap_false","studio_install_ok":true,"version":"2026.5.3"}'
+ printf '{"desktop_protocol_version":1,"desktop_manageability_version":2,"supports_api_only":true,"supports_provision_desktop_auth":false,"supports_desktop_backend_ownership":true,"desktop_auth_stale_reason":"cap_false","studio_install_ok":true,"version":"2026.8.4"}'
exit 0
fi
if [ "$1" = "studio" ] && [ "$2" = "provision-desktop-auth" ] && [ "$3" = "--help" ]; then exit 0; fi
@@ -643,7 +684,7 @@ if [ "$1" = "-h" ]; then
fi
if [ "$1" = "studio" ] && [ "$2" = "desktop-capabilities" ] && [ "$3" = "--json" ]; then
if [ -f "$modecap" ]; then exit 42; fi
- printf '{"desktop_protocol_version":1,"desktop_manageability_version":2,"supports_api_only":true,"supports_provision_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_install_ok":true,"version":"2026.5.3"}'
+ printf '{"desktop_protocol_version":1,"desktop_manageability_version":2,"supports_api_only":true,"supports_provision_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_install_ok":true,"version":"2026.8.4"}'
exit 0
fi
exit 1
@@ -713,7 +754,7 @@ exit 1
fn desktop_ready_health_with_owner(root_id: &str, include_owner: bool) -> String {
let owner = desktop_owner_json(include_owner);
format!(
- r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.5.3","desktop_protocol_version":1,"desktop_manageability_version":2,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{root_id}"{owner}}}"#
+ r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.8.4","desktop_protocol_version":1,"desktop_manageability_version":2,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{root_id}"{owner}}}"#
)
}
@@ -773,7 +814,7 @@ exit 1
async fn backend_with_auth_support_but_missing_protocol_is_old() {
let probe = probe_test_backend(
format!(
- r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.5.3","desktop_manageability_version":2,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
+ r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.8.4","desktop_manageability_version":2,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
desktop_owner_json(true)
),
"401 Unauthorized",
@@ -799,7 +840,7 @@ exit 1
// protocol-compatible backend into a conflict the user has to kill.
let probe = probe_test_backend(
format!(
- r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.5.3","desktop_protocol_version":1,"desktop_manageability_version":1,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
+ r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.8.4","desktop_protocol_version":1,"desktop_manageability_version":1,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
desktop_owner_json(true)
),
"401 Unauthorized",
@@ -813,7 +854,7 @@ exit 1
async fn backend_without_any_manageability_field_is_old() {
let probe = probe_test_backend(
format!(
- r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.5.3","desktop_protocol_version":1,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
+ r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.8.4","desktop_protocol_version":1,"supports_desktop_auth":true,"supports_desktop_backend_ownership":true,"studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
desktop_owner_json(true)
),
"401 Unauthorized",
@@ -921,7 +962,7 @@ exit 1
async fn backend_capability_false_is_old_even_when_route_401() {
let probe = probe_test_backend(
format!(
- r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.5.3","desktop_protocol_version":1,"desktop_manageability_version":2,"supports_desktop_auth":false,"supports_desktop_backend_ownership":true,"desktop_auth_stale_reason":"cap_false","studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
+ r#"{{"status":"healthy","service":"Unsloth UI Backend","version":"2026.8.4","desktop_protocol_version":1,"desktop_manageability_version":2,"supports_desktop_auth":false,"supports_desktop_backend_ownership":true,"desktop_auth_stale_reason":"cap_false","studio_root_id":"{EXPECTED_ROOT_ID}"{}}}"#,
desktop_owner_json(true)
),
"401 Unauthorized",
diff --git a/studio/src-tauri/src/preflight/backend.rs b/studio/src-tauri/src/preflight/backend.rs
index 3eec71ea352..595abed58fb 100644
--- a/studio/src-tauri/src/preflight/backend.rs
+++ b/studio/src-tauri/src/preflight/backend.rs
@@ -155,9 +155,8 @@ fn backend_capability_stale_reason(health: &BackendHealth) -> Option<String> {
if health.supports_desktop_backend_ownership != Some(true) {
return Some("desktop_backend_ownership_unsupported".to_string());
}
- // Unauthenticated /api/health gates `version` behind a bearer; capability bits
- // (protocol/manageability/auth/ownership) above are only set by backends >=
- // MIN_DESKTOP_BACKEND_VERSION, so missing version means "auth-gated", not "old".
+ // Unauthenticated /api/health gates `version` behind a bearer, and the bits
+ // above predate the floor, so no version means "auth-gated", not "old".
match health.version.as_deref() {
Some(version) if !version.is_empty() => backend_version_stale_reason(Some(version)),
_ => None,
diff --git a/studio/src-tauri/src/preflight/managed.rs b/studio/src-tauri/src/preflight/managed.rs
index 276ca05f5f3..e9c651c9b21 100644
--- a/studio/src-tauri/src/preflight/managed.rs
+++ b/studio/src-tauri/src/preflight/managed.rs
@@ -1,6 +1,6 @@
use super::types::ManagedProbe;
use super::version::{
- backend_version_stale_reason, DESKTOP_MANAGEABILITY_VERSION, DESKTOP_PROTOCOL_VERSION,
+ managed_backend_version_stale_reason, DESKTOP_MANAGEABILITY_VERSION, DESKTOP_PROTOCOL_VERSION,
};
use log::{info, warn};
use serde::{Deserialize, Serialize};
@@ -450,7 +450,7 @@ fn desktop_capability_stale_reason(capability: &DesktopCapability) -> Option<Str
.unwrap_or_else(|| "studio_install_incomplete".to_string()),
);
}
- backend_version_stale_reason(capability.version.as_deref())
+ managed_backend_version_stale_reason(capability.version.as_deref())
}
fn desktop_capability_ready(capability: &DesktopCapability) -> bool {
@@ -544,6 +544,7 @@ pub async fn managed_install_ready() -> bool {
#[cfg(test)]
mod tests {
+ use super::super::version::MIN_DESKTOP_BACKEND_VERSION;
use super::*;
fn healthy_capability() -> DesktopCapability {
@@ -556,7 +557,7 @@ mod tests {
desktop_auth_stale_reason: None,
studio_install_ok: Some(true),
studio_install_reason: None,
- version: Some("2026.7.5".to_string()),
+ version: Some(MIN_DESKTOP_BACKEND_VERSION.to_string()),
}
}
@@ -566,6 +567,19 @@ mod tests {
assert!(desktop_capability_ready(&healthy_capability()));
}
+ #[test]
+ fn a_venv_behind_the_desktop_backend_version_is_stale() {
+ // The CLI installer shares this venv, so its package version is the only
+ // thing that pulls an old-but-launchable install forward via repair.
+ let mut capability = healthy_capability();
+ capability.version = Some("2026.5.2".to_string());
+ assert_eq!(
+ desktop_capability_stale_reason(&capability).as_deref(),
+ Some("desktop_backend_version_too_old")
+ );
+ assert!(!desktop_capability_ready(&capability));
+ }
+
#[test]
fn incomplete_install_is_stale_with_the_cli_reason() {
// The venv has the CLI but not structlog, so preflight must repair
diff --git a/studio/src-tauri/src/preflight/version.rs b/studio/src-tauri/src/preflight/version.rs
index a39681416a6..add4dac191a 100644
--- a/studio/src-tauri/src/preflight/version.rs
+++ b/studio/src-tauri/src/preflight/version.rs
@@ -12,7 +12,7 @@ pub(crate) const DESKTOP_MANAGEABILITY_VERSION: u16 = 2;
pub(crate) const DESKTOP_BACKEND_MANAGEABILITY_VERSION: u16 = 1;
// Explicit backend package minimum, not the desktop app Cargo version: backend
// and app releases can diverge. When bumping, verify this package exists on PyPI.
-pub(super) const MIN_DESKTOP_BACKEND_VERSION: &str = "2026.5.3";
+pub(super) const MIN_DESKTOP_BACKEND_VERSION: &str = "2026.8.4";
#[derive(Debug, Eq, PartialEq)]
pub(super) struct ParsedVersion {
@@ -169,3 +169,31 @@ pub(crate) fn backend_version_stale_reason(version: Option<&str>) -> Option<Stri
Some(_) => Some("desktop_backend_version_too_old".to_string()),
}
}
+
+// The backend package this build shipped with, stamped by the release workflow
+// from the same pypi_version as the updater manifest. Local and CI builds leave
+// it unset, so the floor above stays their only gate.
+pub(super) fn expected_backend_version() -> &'static str {
+ option_env!("UNSLOTH_DESKTOP_BACKEND_VERSION").unwrap_or(MIN_DESKTOP_BACKEND_VERSION)
+}
+
+pub(super) fn backend_version_outdated_reason(
+ version: Option<&str>,
+ expected: &str,
+) -> Option<String> {
+ if let Some(reason) = backend_version_stale_reason(version) {
+ return Some(reason);
+ }
+ // Anything unparseable here already cleared the floor, so leave it there.
+ let actual = version.and_then(parse_version)?;
+ let expected = parse_version(expected)?;
+ (compare_versions(&actual, &expected) == Ordering::Less)
+ .then(|| "desktop_backend_version_outdated".to_string())
+}
+
+// Managed venv only: ~/.unsloth/studio is shared with the CLI installer, so a
+// venv can clear the floor yet predate this app forever, and only repair moves
+// it. Running backends keep the floor alone, so an older one stays adoptable.
+pub(super) fn managed_backend_version_stale_reason(version: Option<&str>) -> Option<String> {
+ backend_version_outdated_reason(version, expected_backend_version())
+}