platform icon indicating copy to clipboard operation
platform copied to clipboard

fix: desktop client should trust server's MODEL_VERSION (not bake its own)

Open shanzez opened this issue 6 months ago • 1 comments

Summary

The desktop preload (desktop/src/ui/preload.ts:113) explicitly overrides serverConfig.MODEL_VERSION with the value baked into the desktop binary at build time. This causes the "New version is available" blocking dialog to fire whenever the desktop's bundled MODEL_VERSION differs from the server's reported value — even when the server is fully healthy.

This PR uses the server's authoritative MODEL_VERSION instead, falling back to the bundled value only when the server does not report one.

Tag-convention note: Thanks to @armisav for clarifying that v* are production desktop/server builds and s* are developer builds — they are not paired. This PR is not about pairing the two; it's about making the production v* desktop tolerant of any server whose MODEL_VERSION differs from what the desktop happened to bake at build time. That includes self-hosted users running s* server images from Docker Hub, but also any future drift between desktop and server version.txt within the same track.

Symptom (from a real self-hosted user)

  • Desktop: production v0.7.423 Mac binary, downloaded from huly.io
  • Server: self-hosted hardcoreeng/*:s0.7.423 images (the s* Docker tags are what's published for self-hosting)
  • Server /config.json reports MODEL_VERSION="0.7.422"
  • Desktop's bundled MODEL_VERSION="0.7.423" (from version.txt at the v0.7.423 commit)
  • Result: blocking dialog "New version is available / Please update / 0.7.422 => 0.7.423" on every launch; the client refuses to connect.

The only workaround is to manually patch app.asar to overwrite the bundled MODEL_VERSION to match what the server reports. Self-hosted users hit this any time a v* desktop release bakes a different version.txt than the s* server they're running.

Trace

  • desktop/src/ui/preload.ts:113 overrides server-provided MODEL_VERSION with mainConfig.MODEL_VERSION (the bundled value from webpack DefinePlugin reading version.txt at build time).
  • plugins/workbench-resources/src/connect.ts:550 then compares the workspace's actual data model version against this bundled "required" value with strict inequality (requiredVersion !== versionStr), failing in either direction — client newer or older than server.
  • For self-hosted users on s* servers, the bundled value is regularly newer than the server, and the dialog blocks every launch.

The fix

-              MODEL_VERSION: mainConfig.MODEL_VERSION,
+              MODEL_VERSION: serverConfig.MODEL_VERSION ?? mainConfig.MODEL_VERSION,

The server already publishes MODEL_VERSION in /config.json (the front-image / workspace-service authoritative value). Trusting that:

  • Eliminates the false-positive dialog when the desktop's bundled version.txt happens to differ from the server's.
  • Still works correctly when the workspace data is genuinely behind what the server requires (the workbench check fires legitimately against serverConfig.MODEL_VERSION).
  • Falls back to the bundled value if the server does not report MODEL_VERSION — no regression for legacy server images.

Why not solve at the CI / release-process layer

CI-level guards (e.g., validating version.txt consistency before tagging) are good defense-in-depth, but they can't unbreak users who already have an affected binary installed. This client-side change makes the desktop robust to whatever version.txt was baked at build time, so the next time desktop and server drift, customers don't get stuck.

Testing

Verified the dialog is suppressed by reproducing the underlying effect on an installed v0.7.423 Mac binary: extracted app.asar, replaced MODEL_VERSION:"0.7.423" with "0.7.422" (the server's reported value) in dist/main/electron.js, repacked, re-signed. The Mac client then connects to a self-hosted s0.7.423 server with no dialog and full functionality. This PR achieves the same effect at runtime by reading the value from the server rather than from the bundle.

Related

  • #10796 (merged) — re-enabled check_model_version.js to catch models/-without-version.txt drift within a single branch.

shanzez avatar May 20 '26 14:05 shanzez

Connected to Huly®: UBERF-16461

huly-github-staging avatar May 20 '26 14:05 huly-github-staging