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.

Studio Settings: stop forcing a GitHub release lookup on every Settings open (#14649)

Michael Hanc2f75c486c78
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.ts
index ed5b6d1dfc0..a6cfbb8e76d 100644
--- a/studio/frontend/scripts/check-bundle-budget.ts
+++ b/studio/frontend/scripts/check-bundle-budget.ts
@@ -367,8 +367,10 @@ export const BUDGET = {
// 2,073,188 -> 2,074,915 B transfer against b2ba86a514, Node 26, 98 chunks). Raised by that.
// #14590 (eager locale strings, help entry, API buttons, update card close) merged with main at 356721b31e:
// 6,729.6 KB raw / 2,027.3 KB transfer (Node 24, 98 chunks). Raised to that plus about 200 B.
- transferBytes: 2_076_150,
- rawBytes: 6_891_300,
+ // Passive Settings update check: +24 B raw / +43 B transfer against e24fa71e1b
+ // (6,891,238 -> 6,891,262 raw, 2,076,088 -> 2,076,131 transfer, Node 26). Raised by that.
+ transferBytes: 2_076_193,
+ rawBytes: 6_891_324,
};
// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering the
diff --git a/studio/frontend/src/features/settings/components/engine-versions-section.tsx b/studio/frontend/src/features/settings/components/engine-versions-section.tsx
index 7c2497de900..c6cbcf3fcb3 100644
--- a/studio/frontend/src/features/settings/components/engine-versions-section.tsx
+++ b/studio/frontend/src/features/settings/components/engine-versions-section.tsx
@@ -30,6 +30,7 @@ export function EngineVersionsSection() {
const isOwner = useIsAccountOwner();
const { status, applying, apply, refresh } = useLlamaUpdateCheck({
onReloadRequired: resyncInferenceStatusAfterServerModelChange,
+ passive: true,
});
const [checking, setChecking] = useState(false);
const [checkFailed, setCheckFailed] = useState(false);
diff --git a/studio/frontend/src/hooks/use-llama-update-check.ts b/studio/frontend/src/hooks/use-llama-update-check.ts
index 311cbffa07a..ce5b143fabc 100644
--- a/studio/frontend/src/hooks/use-llama-update-check.ts
+++ b/studio/frontend/src/hooks/use-llama-update-check.ts
@@ -374,6 +374,8 @@ interface UseLlamaUpdateCheckOptions {
* cross-tab update mirrored through the background poll.
*/
onReloadRequired?: () => void;
+ /** Reads the cached status once on mount; only refresh() asks GitHub. For Settings, which remounts on every open. */
+ passive?: boolean;
}
export interface LlamaApplyResult {
@@ -390,6 +392,7 @@ export interface LlamaApplyResult {
export function useLlamaUpdateCheck({
enabled = true,
onReloadRequired,
+ passive = false,
}: UseLlamaUpdateCheckOptions = {}) {
const [status, setStatus] = useState<LlamaUpdateStatus | null>(null);
const [visible, setVisible] = useState(false);
@@ -423,7 +426,9 @@ export function useLlamaUpdateCheck({
if (snoozeTimer.current) clearTimeout(snoozeTimer.current);
snoozeTimer.current = null;
const suppression = suppressionRef.current;
- if (!activeRef.current || suppression?.kind !== "snoozed") return;
+ if (passive || !activeRef.current || suppression?.kind !== "snoozed") {
+ return;
+ }
const remaining = suppression.until - Date.now();
if (remaining <= 0) return;
snoozeTimer.current = setTimeout(() => {
@@ -432,7 +437,7 @@ export function useLlamaUpdateCheck({
if (activeRef.current) surfaceRef.current(next);
});
}, remaining);
- }, [readStatus]);
+ }, [passive, readStatus]);
const clearSuppression = useCallback(() => {
if (!suppressionRef.current) return;
@@ -605,17 +610,19 @@ export function useLlamaUpdateCheck({
if (statusRef.current) presentStatus(statusRef.current);
else armSnoozeTimer();
- const firstTimer = setTimeout(() => {
- readStatus(true).then((s) => {
- if (!canceled) surfaceIfAvailable(s);
- });
- }, FIRST_CHECK_DELAY_MS);
-
- const reminder = setInterval(() => {
- readStatus(true).then((s) => {
+ const check = (forceRefresh: boolean) => () => {
+ readStatus(forceRefresh).then((s) => {
if (!canceled) surfaceIfAvailable(s);
});
- }, REMINDER_INTERVAL_MS);
+ };
+ let firstTimer: ReturnType<typeof setTimeout> | undefined;
+ let reminder: ReturnType<typeof setInterval> | undefined;
+ if (passive) {
+ check(false)();
+ } else {
+ firstTimer = setTimeout(check(true), FIRST_CHECK_DELAY_MS);
+ reminder = setInterval(check(true), REMINDER_INTERVAL_MS);
+ }
return () => {
canceled = true;
@@ -630,6 +637,7 @@ export function useLlamaUpdateCheck({
};
}, [
enabled,
+ passive,
readStatus,
surfaceIfAvailable,
clearPollTimer,
@@ -664,7 +672,7 @@ export function useLlamaUpdateCheck({
event.newValue &&
event.newValue !== reloadNotifiedForRef.current
) {
- readStatus(true).then(surfaceIfAvailable);
+ readStatus(!passive).then(surfaceIfAvailable);
}
};
window.addEventListener(OFFER_SUPPRESSION_EVENT, onSuppression);
@@ -674,7 +682,14 @@ export function useLlamaUpdateCheck({
window.removeEventListener(OFFER_SUPPRESSION_EVENT, onSuppression);
window.removeEventListener("storage", onStorage);
};
- }, [enabled, readStatus, surfaceIfAvailable, presentStatus, armSnoozeTimer]);
+ }, [
+ enabled,
+ passive,
+ readStatus,
+ surfaceIfAvailable,
+ presentStatus,
+ armSnoozeTimer,
+ ]);
useEffect(() => {
if (!enabled) return;
diff --git a/studio/frontend/tests/llama-update-passive-check.test.ts b/studio/frontend/tests/llama-update-passive-check.test.ts
new file mode 100644
index 00000000000..75003ab2ad0
--- /dev/null
+++ b/studio/frontend/tests/llama-update-passive-check.test.ts
@@ -0,0 +1,124 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import { mock, test } from "node:test";
+import type * as HookModule from "../src/hooks/use-llama-update-check.ts";
+import * as lifecycle from "../src/lib/llama-job-lifecycle.ts";
+import { loadWithStubs } from "./helpers/module-stubs.ts";
+
+const STATUS_URL = "/api/llama/update-status";
+const FORCED_URL = `${STATUS_URL}?force_refresh=true`;
+
+function mount(options: { passive?: boolean }) {
+ const requests: string[] = [];
+ const cleanups: (() => void)[] = [];
+ const react = {
+ useState: (initial: unknown) => [initial, () => {}],
+ useRef: (current: unknown) => ({ current }),
+ useCallback: (fn: unknown) => fn,
+ useEffect(effect: () => (() => void) | undefined) {
+ const cleanup = effect();
+ if (cleanup) cleanups.push(cleanup);
+ },
+ };
+ const authFetch = async (url: string) => {
+ requests.push(url);
+ return {
+ ok: true,
+ json: async () => ({ supported: true, job: { state: "idle" } }),
+ };
+ };
+ const hookModule = loadWithStubs<typeof HookModule>(
+ new URL("../src/hooks/use-llama-update-check.ts", import.meta.url),
+ {
+ react,
+ "@/features/auth": { authFetch, getAuthToken: () => "token" },
+ "@/hooks/use-hardware-info": { refreshHardwareInfo: async () => {} },
+ "@/lib/model-lifecycle-events": { notifyModelLifecycle() {} },
+ "@/lib/llama-job-events": {
+ signalRunningLlamaJob() {},
+ subscribeToLlamaJobStarted: () => () => {},
+ },
+ "@/lib/llama-job-lifecycle": lifecycle,
+ },
+ );
+ const hook = hookModule.useLlamaUpdateCheck(options);
+ return {
+ hook,
+ requests,
+ unmount: () => {
+ for (const cleanup of cleanups) cleanup();
+ },
+ };
+}
+
+const flush = () => new Promise((resolve) => setImmediate(resolve));
+
+function withWindow(run: () => Promise<void>) {
+ return async () => {
+ const previous = (globalThis as { window?: unknown }).window;
+ (globalThis as { window?: unknown }).window = {
+ addEventListener() {},
+ removeEventListener() {},
+ dispatchEvent() {},
+ };
+ mock.timers.enable({ apis: ["setTimeout", "setInterval"] });
+ try {
+ await run();
+ } finally {
+ mock.timers.reset();
+ (globalThis as { window?: unknown }).window = previous;
+ }
+ };
+}
+
+test(
+ "a passive mount reads the cached status once and never forces a refresh",
+ withWindow(async () => {
+ const { hook, requests, unmount } = mount({ passive: true });
+ await flush();
+ assert.deepEqual(requests, [STATUS_URL]);
+
+ mock.timers.tick(3 * 60 * 60 * 1000);
+ await flush();
+ assert.deepEqual(requests, [STATUS_URL]);
+
+ await hook.refresh();
+ assert.deepEqual(requests, [STATUS_URL, FORCED_URL]);
+ unmount();
+ }),
+);
+
+test(
+ "the default mount still forces its first check and the hourly reminder",
+ withWindow(async () => {
+ const { requests, unmount } = mount({});
+ await flush();
+ assert.deepEqual(requests, []);
+
+ mock.timers.tick(1000);
+ await flush();
+ assert.deepEqual(requests, [FORCED_URL]);
+
+ mock.timers.tick(60 * 60 * 1000);
+ await flush();
+ assert.deepEqual(requests, [FORCED_URL, FORCED_URL]);
+ unmount();
+ }),
+);
+
+test("the Settings Engines section mounts the hook passively", async () => {
+ const { readFileSync } = await import("node:fs");
+ const section = readFileSync(
+ new URL(
+ "../src/features/settings/components/engine-versions-section.tsx",
+ import.meta.url,
+ ),
+ "utf8",
+ );
+ assert.match(
+ section,
+ /useLlamaUpdateCheck\(\{\s*onReloadRequired: resyncInferenceStatusAfterServerModelChange,\s*passive: true,\s*\}\)/,
+ );
+});