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 Images: another account's loaded model no longer offers Generate (#16200)

Debojyoti Banerjee7d5c612a49c7
diff --git a/studio/frontend/src/features/images/api.ts b/studio/frontend/src/features/images/api.ts
index c7f470f340f..ced87ea63ed 100644
--- a/studio/frontend/src/features/images/api.ts
+++ b/studio/frontend/src/features/images/api.ts
@@ -29,6 +29,8 @@ export interface DiffusionResolvedControl {
export interface DiffusionStatus {
loaded: boolean;
+ // False when the resident model belongs to another account; the response then carries nothing else.
+ yours?: boolean;
repo_id: string | null;
display_repo_id?: string | null;
resident_mib?: number | null;
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 15494155f51..6b4323eea97 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -370,6 +370,7 @@ import {
shouldOfferGenerateAnyway,
shouldRunQueuedOversizedRetry,
} from "./lib/memory-refusal";
+import { HELD_BY_OTHER_ACCOUNT_NOTICE, heldByOtherAccount, ownDiffusionStatus } from "./lib/resident-owner";
import {
AUTOMATIC_SCHEDULE,
DEFAULT_SAMPLER,
@@ -3325,7 +3326,7 @@ export function ImagesPage({
const refreshStatus = useCallback(async () => {
const ticket = ++statusTicket.current;
try {
- setStatusIfNewest(ticket, await getDiffusionStatus());
+ setStatusIfNewest(ticket, ownDiffusionStatus(await getDiffusionStatus()));
} catch {
// Status is best-effort; a failed poll should not surface an error toast.
}
@@ -3441,7 +3442,7 @@ export function ImagesPage({
if (p.phase === "ready") {
dismissLoadToast();
const ticket = ++statusTicket.current;
- const loaded = await getDiffusionStatus();
+ const loaded = ownDiffusionStatus(await getDiffusionStatus());
if (seq !== cancelSeq.current) {
// Cancelled mid-read: drop it, the unload's own response is authoritative.
return;
@@ -3608,7 +3609,7 @@ export function ImagesPage({
void pollLoadProgress();
} else if (p.phase === "ready") {
const ticket = ++statusTicket.current;
- const loaded = await getDiffusionStatus();
+ const loaded = ownDiffusionStatus(await getDiffusionStatus());
setStatusIfNewest(ticket, loaded);
const resumed = finishedLoadTarget<LastLoad>(null, loaded);
if (resumed) {
@@ -7070,6 +7071,11 @@ export function ImagesPage({
</div>
{/* The scroll mask provides the fade; leave the footer unpainted to avoid dark-mode banding. */}
<div className="relative z-10 flex shrink-0 flex-wrap justify-center gap-2 px-4 pt-0.5 pb-3">
+ {!external && busy === null && heldByOtherAccount(status) && (
+ <p role="status" className="w-full text-center text-ui-11 leading-snug text-muted-foreground">
+ {HELD_BY_OTHER_ACCOUNT_NOTICE}
+ </p>
+ )}
{busy === "generating" ? (
<Button
className="relative z-10 text-ui-13 hover:bg-muted dark:hover:bg-muted"
diff --git a/studio/frontend/src/features/images/lib/resident-owner.ts b/studio/frontend/src/features/images/lib/resident-owner.ts
new file mode 100644
index 00000000000..c4c936385d8
--- /dev/null
+++ b/studio/frontend/src/features/images/lib/resident-owner.ts
@@ -0,0 +1,19 @@
+// 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 type { DiffusionStatus } from "../api";
+
+export const HELD_BY_OTHER_ACCOUNT_NOTICE =
+ "Another account has an image model loaded. Select and load a model to generate with your own.";
+
+/**
+ * The status as this account sees it. Another account's resident answers `{loaded: true, yours: false}`
+ * with nothing else (#16178): generating or ejecting against it fails, so the page reads it as idle.
+ */
+export function ownDiffusionStatus(status: DiffusionStatus): DiffusionStatus {
+ return status.yours === false ? { ...status, loaded: false } : status;
+}
+
+export function heldByOtherAccount(status: DiffusionStatus | null): boolean {
+ return status?.yours === false;
+}
diff --git a/studio/frontend/tests/image-load-resume.test.ts b/studio/frontend/tests/image-load-resume.test.ts
index d6808644c59..1d4d1f69050 100644
--- a/studio/frontend/tests/image-load-resume.test.ts
+++ b/studio/frontend/tests/image-load-resume.test.ts
@@ -84,7 +84,7 @@ test("a load that finished while the page was closed records its paths before th
const probe = mount.slice(0, mount.indexOf("if (!inFlight) clearPendingImageLoad();"));
assert.match(
probe,
- /\} else if \(p\.phase === "ready"\) \{[\s\S]*?const loaded = await getDiffusionStatus\(\);\s*setStatusIfNewest\(ticket, loaded\);\s*const resumed = finishedLoadTarget<LastLoad>\(null, loaded\);\s*if \(resumed\) \{\s*lastLoad\.current = resumed;\s*rememberFinishedLoad\(resumed, loaded, true\);/,
+ /\} else if \(p\.phase === "ready"\) \{[\s\S]*?const loaded = ownDiffusionStatus\(await getDiffusionStatus\(\)\);\s*setStatusIfNewest\(ticket, loaded\);\s*const resumed = finishedLoadTarget<LastLoad>\(null, loaded\);\s*if \(resumed\) \{\s*lastLoad\.current = resumed;\s*rememberFinishedLoad\(resumed, loaded, true\);/,
);
const recorder = source.slice(source.indexOf("const rememberFinishedLoad = useCallback"));
const body = recorder.slice(0, recorder.indexOf("}, []);"));
@@ -106,7 +106,7 @@ test("the mount probe publishes the finished build's status before the reconcile
const probe = mount.slice(0, mount.indexOf('setInitialLoadProbe(inFlight ? "loading" : "idle");'));
assert.match(
probe,
- /\} else if \(p\.phase === "ready"\) \{[\s\S]*?const ticket = \+\+statusTicket\.current;\s*const loaded = await getDiffusionStatus\(\);\s*setStatusIfNewest\(ticket, loaded\);/,
+ /\} else if \(p\.phase === "ready"\) \{[\s\S]*?const ticket = \+\+statusTicket\.current;\s*const loaded = ownDiffusionStatus\(await getDiffusionStatus\(\)\);\s*setStatusIfNewest\(ticket, loaded\);/,
);
const newFiles = { vaeFile: "/models/new-vae.safetensors" };
diff --git a/studio/frontend/tests/image-resident-owner.test.ts b/studio/frontend/tests/image-resident-owner.test.ts
new file mode 100644
index 00000000000..650f4b79f75
--- /dev/null
+++ b/studio/frontend/tests/image-resident-owner.test.ts
@@ -0,0 +1,47 @@
+// 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 test from "node:test";
+
+import type { DiffusionStatus } from "../src/features/images/api.ts";
+import {
+ HELD_BY_OTHER_ACCOUNT_NOTICE,
+ heldByOtherAccount,
+ ownDiffusionStatus,
+} from "../src/features/images/lib/resident-owner.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+// What /api/inference/images/status answers for another account's resident.
+const hidden = { loaded: true, yours: false } as unknown as DiffusionStatus;
+
+test("another account's resident reads as no model loaded on the Images page (#16178)", () => {
+ const own = ownDiffusionStatus(hidden);
+ assert.equal(own.loaded, false);
+ assert.equal(heldByOtherAccount(own), true);
+});
+
+test("this account's own status passes through unchanged", () => {
+ const mine = { loaded: true, yours: true, repo_id: "org/model" } as unknown as DiffusionStatus;
+ assert.equal(ownDiffusionStatus(mine), mine);
+ assert.equal(heldByOtherAccount(mine), false);
+ const older = { loaded: true, repo_id: "org/model" } as unknown as DiffusionStatus;
+ assert.equal(ownDiffusionStatus(older), older);
+ assert.equal(heldByOtherAccount(older), false);
+ assert.equal(heldByOtherAccount(null), false);
+});
+
+test("every status read on the Images page goes through ownDiffusionStatus", () => {
+ const page = readSrc("features/images/images-page.tsx");
+ const reads = page.match(/await getDiffusionStatus\(\)/g) ?? [];
+ const owned = page.match(/ownDiffusionStatus\(await getDiffusionStatus\(\)\)/g) ?? [];
+ assert.ok(reads.length > 0);
+ assert.equal(owned.length, reads.length);
+});
+
+test("the Images page explains the account mismatch", () => {
+ const page = readSrc("features/images/images-page.tsx");
+ assert.match(page, /heldByOtherAccount\(status\)/);
+ assert.match(page, /\{HELD_BY_OTHER_ACCOUNT_NOTICE\}/);
+ assert.match(HELD_BY_OTHER_ACCOUNT_NOTICE, /Another account/);
+});
diff --git a/studio/frontend/tests/media-load-cancel.test.ts b/studio/frontend/tests/media-load-cancel.test.ts
index b01a0b3cee3..e07f42ebff1 100644
--- a/studio/frontend/tests/media-load-cancel.test.ts
+++ b/studio/frontend/tests/media-load-cancel.test.ts
@@ -192,7 +192,7 @@ for (const [page, path] of PAGES) {
);
assert.match(poll, /const seq = cancelSeq\.current;/);
assert.match(poll, /if \(seq !== cancelSeq\.current\) return;/);
- assert.match(poll, /const loaded = await get(Diffusion|Video)Status\(\);\s*\n\s*if \(seq !== cancelSeq\.current\) \{/);
+ assert.match(poll, /const loaded = (ownDiffusionStatus\(await getDiffusionStatus\(\)\)|await getVideoStatus\(\));\s*\n\s*if \(seq !== cancelSeq\.current\) \{/);
});
test(`the ${page} cancel counter is bumped by every teardown`, () => {