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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: fix download card alignment and surface the stop button (#7848)
Michael Han0f30e360aa09
diff --git a/studio/backend/hub/schemas/downloads.py b/studio/backend/hub/schemas/downloads.pyindex 98b100fac60..05fc735c0fd 100644--- a/studio/backend/hub/schemas/downloads.py+++ b/studio/backend/hub/schemas/downloads.py@@ -78,6 +78,13 @@ class DownloadStartResponse(BaseModel):state: straccepted: boolgeneration: int+ # The transport the job is really on: the one the backend resolved for a+ # fresh start, or the running job's own when this start adopted one.+ # Either can differ from what the client asked for.+ transport: Optional[str] = None+ # Set only when an adopted job had fallen back from Xet to HTTP: stopping+ # it still writes the original marker, so it is a restart, not a resume.+ cancel_transport: Optional[str] = Noneclass CancelDownloadResponse(BaseModel):@@ -91,6 +98,10 @@ class ActiveDownload(BaseModel):repo_id: Optional[str] = Nonevariant: Optional[str] = Nonetransport: Optional[str] = None+ # Set only on a job that fell back from Xet to HTTP mid-flight: cancelling+ # it still writes the original transport's marker, so the partial is+ # restart-only even though the worker is on resumable HTTP.+ cancel_transport: Optional[str] = Nonestate: strfiles: Optional[List[str]] = Field(None,@@ -189,6 +200,9 @@ class DatasetDownloadStartResponse(BaseModel):state: straccepted: boolgeneration: int+ # The transport the job is really on, and its cancel marker (see above).+ transport: Optional[str] = None+ cancel_transport: Optional[str] = Noneclass CancelDatasetDownloadResponse(BaseModel):diff --git a/studio/backend/hub/services/datasets/downloads.py b/studio/backend/hub/services/datasets/downloads.pyindex 9ca78698106..5b31013069f 100644--- a/studio/backend/hub/services/datasets/downloads.py+++ b/studio/backend/hub/services/datasets/downloads.py@@ -188,6 +188,12 @@ async def download_dataset_response("state": claim_state,"accepted": _registry.adoptable(key),"generation": generation,+ # An adopted job keeps the transport it started on, so report it+ # rather than let the caller assume the one it asked for.+ "transport": _registry.job_transport(key),+ # And its cancel marker: a run that fell back from Xet to HTTP+ # still cancels into a restart-only partial.+ "cancel_transport": _registry.job_cancel_transport(key),}download_manifest.clear_cancel_marker("dataset",@@ -220,6 +226,9 @@ async def download_dataset_response("state": state,"accepted": True,"generation": generation,+ # See models: the resolved transport, which a downgrade can make+ # different from the one requested.+ "transport": transport,}diff --git a/studio/backend/hub/services/download_lifecycle.py b/studio/backend/hub/services/download_lifecycle.pyindex b512bba4b37..9e564ee09c3 100644--- a/studio/backend/hub/services/download_lifecycle.py+++ b/studio/backend/hub/services/download_lifecycle.py@@ -1105,6 +1105,9 @@ def active_download_refs(repo_id = ref_repo_id,variant = variant,transport = metadata.transport if metadata is not None else None,+ cancel_transport = (+ metadata.cancel_marker_transport if metadata is not None else None+ ),state = ref.state,generation = ref.generation,files = scoped_files or None,diff --git a/studio/backend/hub/services/models/downloads.py b/studio/backend/hub/services/models/downloads.pyindex 7323c89e38d..32b85cb0be6 100644--- a/studio/backend/hub/services/models/downloads.py+++ b/studio/backend/hub/services/models/downloads.py@@ -309,6 +309,12 @@ async def download_model_response("state": claim_state,"accepted": _registry.adoptable(key),"generation": generation,+ # An adopted job keeps the transport it started on, so report it+ # rather than let the caller assume the one it asked for.+ "transport": _registry.job_transport(key),+ # And its cancel marker: a run that fell back from Xet to HTTP+ # still cancels into a restart-only partial.+ "cancel_transport": _registry.job_cancel_transport(key),}download_manifest.clear_cancel_marker("model",@@ -349,6 +355,10 @@ async def download_model_response("state": state,"accepted": True,"generation": generation,+ # The transport that was actually resolved: an explicit "xet" is+ # downgraded to HTTP where hf_xet is unavailable, and a client that+ # assumed its request stood would offer the wrong stop control.+ "transport": transport,}diff --git a/studio/backend/hub/utils/download_registry.py b/studio/backend/hub/utils/download_registry.pyindex ccef05ee983..ec7ccf27c89 100644--- a/studio/backend/hub/utils/download_registry.py+++ b/studio/backend/hub/utils/download_registry.py@@ -987,6 +987,20 @@ class DownloadRegistry:metadata = replace(metadata, transport = marker_transport)return terminal_state, metadata+ def job_transport(self, key: str) -> Optional[str]:+ """The transport a live job is running on. None when it has no metadata."""+ key = normalize_job_key(key)+ with self._lock:+ metadata = self._metadata.get(key)+ return metadata.transport if metadata is not None else None++ def job_cancel_transport(self, key: str) -> Optional[str]:+ """A live job's cancel marker, when a fallback left one. See metadata."""+ key = normalize_job_key(key)+ with self._lock:+ metadata = self._metadata.get(key)+ return metadata.cancel_marker_transport if metadata is not None else None+def update_job_transport(self, key: str, transport: str) -> None:key = normalize_job_key(key)with self._lock:diff --git a/studio/backend/tests/test_download_adoption_transport.py b/studio/backend/tests/test_download_adoption_transport.pynew file mode 100644index 00000000000..c9d56145a59--- /dev/null+++ b/studio/backend/tests/test_download_adoption_transport.py@@ -0,0 +1,127 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++"""A start that adopts a running job reports the transport that job is on."""++from hub.utils.download_registry import DownloadRegistry+++def _claim(registry, key, transport):+ accepted, state = registry.claim(+ key,+ transport,+ repo_type = "model",+ repo_id = key.split("::", 1)[0],+ )+ return accepted, state+++def test_a_running_job_reports_the_transport_it_started_on():+ registry = DownloadRegistry()+ assert _claim(registry, "unsloth/Qwen3-4B-GGUF", "xet") == (True, "running")++ # The second client asked for HTTP; the claim is refused and it adopts.+ accepted, state = _claim(registry, "unsloth/Qwen3-4B-GGUF", "http")+ assert accepted is False and state == "running"+ assert registry.adoptable("unsloth/Qwen3-4B-GGUF") is True+ # What it must be told, rather than the http it asked for: pausing a Xet+ # run promises a resume that does not exist.+ assert registry.job_transport("unsloth/Qwen3-4B-GGUF") == "xet"+++def test_an_unknown_job_has_no_transport_to_report():+ registry = DownloadRegistry()+ assert registry.job_transport("unsloth/never-started") is None+++def test_a_job_claimed_without_metadata_reports_nothing():+ registry = DownloadRegistry()+ assert registry.claim("unsloth/bare", "http")[0] is True+ assert registry.job_transport("unsloth/bare") is None+++def test_a_fresh_start_reports_the_transport_the_backend_resolved(monkeypatch):+ """An explicit Xet request is downgraded where hf_xet is unavailable, and a+ client that assumed its request stood shows Cancel for a resumable HTTP+ transfer."""+ from hub.services import download_lifecycle++ monkeypatch.setattr(+ download_lifecycle.download_registry,+ "download_transport_unavailable_reason",+ lambda transport: "hf_xet is not installed" if transport == "xet" else None,+ )+ use_xet, _reason = download_lifecycle.resolve_requested_use_xet("xet", True)+ assert use_xet is False, "the downgrade this reports is what the client must be told"+ assert download_lifecycle.resolve_transport(use_xet) == "http"+++def test_an_available_xet_request_is_left_alone(monkeypatch):+ from hub.services import download_lifecycle++ monkeypatch.setattr(+ download_lifecycle.download_registry,+ "download_transport_unavailable_reason",+ lambda transport: None,+ )+ use_xet, _reason = download_lifecycle.resolve_requested_use_xet("xet", True)+ assert download_lifecycle.resolve_transport(use_xet) == "xet"+++def test_a_fallback_run_publishes_the_marker_that_decides_its_stop_control():+ """The Xet-to-HTTP retry reclaims as HTTP but keeps the Xet cancel marker,+ so stopping it is a restart even though the worker is on HTTP."""+ from hub.services.download_lifecycle import active_download_refs++ registry = DownloadRegistry()+ key = "unsloth/Qwen3-4B-GGUF"+ assert (+ registry.claim(+ key,+ "http",+ repo_type = "model",+ repo_id = key,+ cancel_marker_transport = "xet",+ )[0]+ is True+ )++ ref = active_download_refs(registry, key, with_variant = True)[0]+ assert ref.transport == "http", "the worker really is on HTTP"+ assert ref.cancel_transport == "xet", "but cancelling writes the Xet marker"+++def test_an_ordinary_run_publishes_no_cancel_marker():+ from hub.services.download_lifecycle import active_download_refs++ registry = DownloadRegistry()+ key = "unsloth/Qwen3-4B-GGUF"+ registry.claim(key, "http", repo_type = "model", repo_id = key)+ ref = active_download_refs(registry, key, with_variant = True)[0]+ assert ref.cancel_transport is None+++def test_an_adopted_fallback_run_reports_its_marker_to_the_new_client():+ """The start response is the only source for that adoption path, so it has+ to carry the marker as well as the live transport."""+ registry = DownloadRegistry()+ key = "unsloth/Qwen3-4B-GGUF"+ registry.claim(+ key,+ "http",+ repo_type = "model",+ repo_id = key,+ cancel_marker_transport = "xet",+ )+ # What the rejected second claim then reports.+ assert registry.adoptable(key) is True+ assert registry.job_transport(key) == "http"+ assert registry.job_cancel_transport(key) == "xet"+++def test_an_ordinary_adopted_run_reports_no_marker():+ registry = DownloadRegistry()+ key = "unsloth/Qwen3-4B-GGUF"+ registry.claim(key, "xet", repo_type = "model", repo_id = key)+ assert registry.job_cancel_transport(key) is None+ assert registry.job_cancel_transport("unsloth/never-started") is Nonediff --git a/studio/frontend/src/features/hub/catalog/dataset-download-section.tsx b/studio/frontend/src/features/hub/catalog/dataset-download-section.tsxindex 4a3e3f9ff6f..45988e05e4c 100644--- a/studio/frontend/src/features/hub/catalog/dataset-download-section.tsx+++ b/studio/frontend/src/features/hub/catalog/dataset-download-section.tsx@@ -179,6 +179,7 @@ export function DatasetDownloadSection({loading={downloadAction.starting}isPartial={downloadAction.isPartial}partialTransport={downloadAction.partialTransport}+ stopMode={downloadAction.stopMode}progressPercent={downloadAction.progressPercent}disabled={downloadAction.disabled}onClick={downloadAction.onClick}diff --git a/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsx b/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsxindex 48bb9c1bce1..13188f5e89c 100644--- a/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsx+++ b/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsx@@ -1,25 +1,24 @@// 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 { Spinner } from "@/components/ui/spinner";-import { Cancel01Icon } from "@hugeicons/core-free-icons";+import { Cancel01Icon, PauseIcon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";+/** What stopping this download costs. HTTP keeps the partial to continue from,+ * so it is a pause; Xet has to start over, so it is a cancel. */+export type DownloadStopMode = "cancel" | "pause";+/**- * Inspector action-button affordance during a download: spinner that cross-fades- * to a cancel glyph on `.hub-action-btn` hover, in the same 16x16 slot so the- * percentage label never shifts. The swap is pure CSS- * (`.hub-action-btn:hover .hub-cta-indicator-*`); the component only carries- * the marker classes.+ * The stop glyph beside the percentage during a download. Always visible: it is+ * the only way to stop, so it should not need a hover to be found. Sits in a+ * fixed 16x16 slot so the percentage never shifts.*/-export function DownloadCancelIndicator() {+export function DownloadStopIndicator({ mode }: { mode: DownloadStopMode }) {return (<span className="hub-cta-indicator">- <Spinner className="hub-cta-indicator-spinner" /><HugeiconsIcon- icon={Cancel01Icon}+ icon={mode === "pause" ? PauseIcon : Cancel01Icon}strokeWidth={1.75}- className="hub-cta-indicator-cancel"/></span>);diff --git a/studio/frontend/src/features/hub/catalog/download-card.tsx b/studio/frontend/src/features/hub/catalog/download-card.tsxindex cf767c7903d..c313441c7e6 100644--- a/studio/frontend/src/features/hub/catalog/download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/download-card.tsx@@ -31,7 +31,10 @@ import {type DownloadJob,type DownloadJobProgress,} from "../download-manager";-import { DownloadCancelIndicator } from "./download-cancel-indicator";+import {+ type DownloadStopMode,+ DownloadStopIndicator,+} from "./download-cancel-indicator";import { TransportConflictDialog } from "./transport-conflict-dialog";import {downloadActionAriaLabel,@@ -59,7 +62,15 @@ export function DownloadCard({<div className="hub-download-card"><div className="group/dl flex items-center">{children}</div>{progress && (- <DownloadProgressBar progress={progress} bytesPerSec={job.bytesPerSec} />+ // Match the row's inner text bounds: the trigger and the action+ // button both inset 12px, so the bar lines up with the quant label+ // on the left and the percentage on the right.+ <div className="px-3">+ <DownloadProgressBar+ progress={progress}+ bytesPerSec={job.bytesPerSec}+ />+ </div>)}</div><TransportConflictDialog@@ -223,6 +234,7 @@ export function DownloadActionButton({loading = false,isPartial = false,partialTransport = null,+ stopMode = "cancel",progressPercent = null,disabled,onClick,@@ -233,6 +245,8 @@ export function DownloadActionButton({loading?: boolean;isPartial?: boolean;partialTransport?: string | null;+ /** What stopping the running job costs; see downloadStopMode. */+ stopMode?: DownloadStopMode;progressPercent?: number | null;disabled: boolean;onClick: () => void;@@ -243,7 +257,7 @@ export function DownloadActionButton({type="button"disabled={disabled}onClick={onClick}- aria-label={downloadActionAriaLabel(downloading, cancelling)}+ aria-label={downloadActionAriaLabel(downloading, cancelling, stopMode)}className={cn("hub-action-btn w-28",(loading || cancelling) && "opacity-70",@@ -260,7 +274,7 @@ export function DownloadActionButton({</span>) : downloading ? (<>- <DownloadCancelIndicator />+ <DownloadStopIndicator mode={stopMode} />{progressPercent != null ? `${progressPercent}%` : null}</>) : loading ? (diff --git a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsxindex 6f6fd685a0e..ba0ef297131 100644--- a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx@@ -73,7 +73,7 @@ import {} from "../lib/model-identity";import { useHfTokenStore } from "../stores/hf-token-store";import { DotTag } from "./dot-tag";-import { DownloadCancelIndicator } from "./download-cancel-indicator";+import { DownloadStopIndicator } from "./download-cancel-indicator";import {CardDivider,DeleteConfirmDialog,@@ -942,9 +942,11 @@ export function GgufDownloadCard({className="hub-menu-trigger flex h-9 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-full px-3 text-left transition-colors hover:bg-foreground/[0.04] data-[state=open]:bg-foreground/[0.06] dark:hover:bg-white/[0.04] dark:data-[state=open]:bg-white/[0.06]">{/* Quant label + status tags travel together as one left-aligned- group so the fit-info icon never floats orphaned from its tags;- only the chevron pins right, the standard select affordance. */}- <span className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden text-ui-12 text-muted-foreground">+ group so the fit-info icon never floats orphaned from its tags.+ The group sizes to its content (it still shrinks when the row+ is tight) so the chevron follows the tags instead of stranding+ itself at the far edge of a full-width trigger. */}+ <span className="flex min-w-0 items-center gap-2 overflow-hidden text-ui-12 text-muted-foreground">{selected ? (<QuantBadgequant={selectedLabel ?? selected.quant}@@ -1119,7 +1121,7 @@ export function GgufDownloadCard({</span>) : downloadingThisVariant ? (<span className="inline-flex items-center gap-2">- <DownloadCancelIndicator />+ <DownloadStopIndicator mode={downloadAction.stopMode} />{downloadAction.progressPercent != null? `${downloadAction.progressPercent}%`: null}diff --git a/studio/frontend/src/features/hub/catalog/gguf-status-cards.tsx b/studio/frontend/src/features/hub/catalog/gguf-status-cards.tsxindex f4f4fb27d2f..9c7e9937cd7 100644--- a/studio/frontend/src/features/hub/catalog/gguf-status-cards.tsx+++ b/studio/frontend/src/features/hub/catalog/gguf-status-cards.tsx@@ -10,6 +10,7 @@ import {DownloadActionButton,DownloadCard,} from "./download-card";+import { downloadStopMode } from "./use-download-card-state";export function GgufDownloadStatusCard({job,@@ -101,6 +102,7 @@ export function GgufDownloadingFallbackCard({downloadingcancelling={cancelling}progressPercent={Math.round(Math.min(progress.fraction, 1) * 100)}+ stopMode={downloadStopMode(job.transport, null, job.cancelTransport)}disabled={cancelling}onClick={() => void job.cancelDownload(progress.variant)}/>diff --git a/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx b/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsxindex 94c5175e8ed..d1211942baf 100644--- a/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx@@ -326,6 +326,7 @@ export function SafetensorsDownloadCard({loading={isLoadingThisModel || downloadAction.starting}isPartial={downloadAction.isPartial}partialTransport={downloadAction.partialTransport}+ stopMode={downloadAction.stopMode}progressPercent={downloadAction.progressPercent}disabled={downloadAction.disabled}onClick={downloadAction.onClick}diff --git a/studio/frontend/src/features/hub/catalog/use-download-card-state.ts b/studio/frontend/src/features/hub/catalog/use-download-card-state.tsindex 67613d9abe4..cdabdb6940e 100644--- a/studio/frontend/src/features/hub/catalog/use-download-card-state.ts+++ b/studio/frontend/src/features/hub/catalog/use-download-card-state.ts@@ -3,6 +3,7 @@import type { DownloadJob } from "../download-manager";import { useCallback, useEffect, useRef, useState } from "react";+import type { DownloadStopMode } from "./download-cancel-indicator";export function partialResumeLabel(transport: string | null | undefined): string {if (transport === "xet") return "Redownload";@@ -10,11 +11,33 @@ export function partialResumeLabel(transport: string | null | undefined): stringreturn "Retry";}+/** Stopping an HTTP download leaves a partial to continue from, so it is a+ * pause. Xet has to start over, so it is a cancel. Unknown assumes the costlier+ * one rather than promising a resume that may not exist.+ *+ * Reads the running job's transport, not the partial's: a fresh HTTP download+ * has no partial yet, and a restarted conflict switches transport, so the+ * partial describes neither. */+export function downloadStopMode(+ activeTransport: string | null | undefined,+ partialTransport?: string | null,+ cancelTransport?: string | null,+): DownloadStopMode {+ // The cancel marker wins where there is one: a Xet run that fell back to+ // HTTP still cancels into a restart-only partial, so Pause would promise a+ // resume the marker does not allow.+ const transport = cancelTransport ?? activeTransport ?? partialTransport;+ return transport === "http" ? "pause" : "cancel";+}+export function downloadActionAriaLabel(downloading: boolean,cancelling: boolean,+ stopMode: DownloadStopMode = "cancel",): string | undefined {- return cancelling ? "Cancelling…" : downloading ? "Cancel download" : undefined;+ if (cancelling) return "Cancelling…";+ if (!downloading) return undefined;+ return stopMode === "pause" ? "Pause download" : "Cancel download";}export function downloadActionLabel(@@ -80,6 +103,11 @@ export function useDownloadCardState({starting,variant,]);+ const stopMode = downloadStopMode(+ job.transport,+ partialTransport,+ job.cancelTransport,+ );return {downloading,cancelling,@@ -87,8 +115,9 @@ export function useDownloadCardState({isPartial,partialTransport,progressPercent,+ stopMode,disabled: effectiveDisabled,- ariaLabel: downloadActionAriaLabel(downloading, cancelling),+ ariaLabel: downloadActionAriaLabel(downloading, cancelling, stopMode),downloadLabel: downloadActionLabel(isPartial, partialTransport),onClick,};diff --git a/studio/frontend/src/features/hub/download-manager/api.ts b/studio/frontend/src/features/hub/download-manager/api.tsindex 1f7392807d3..6876e1be61f 100644--- a/studio/frontend/src/features/hub/download-manager/api.ts+++ b/studio/frontend/src/features/hub/download-manager/api.ts@@ -52,12 +52,20 @@ export interface DownloadStartResult {state: DownloadStartState;accepted: boolean;generation?: number;+ // Present only when the start adopted a job another client had already+ // begun: the transport it is really running on.+ transport?: TransportMode | null;+ // And its cancel marker, when that job had fallen back from Xet to HTTP.+ cancel_transport?: TransportMode | null;}export interface ActiveModelDownload {repo_id?: string;variant: string | null;transport?: TransportMode | null;+ // Set only on a Xet run that fell back to HTTP: stopping it still leaves a+ // restart-only partial, so this and not `transport` decides the stop control.+ cancel_transport?: TransportMode | null;state: DownloadJobState;generation?: number;// Scoped jobs only: the exact files this job is fetching. Every file set of one repo rides the same "@scope" slot, so an@@ -69,6 +77,7 @@ export interface ActiveDatasetDownload {repo_id: string;variant: null;transport?: TransportMode | null;+ cancel_transport?: TransportMode | null;state: DownloadJobState;generation?: number;}@@ -310,8 +319,12 @@ async function getActiveModelDownloadsForKey(export async function getActiveDatasetDownloads(signal?: AbortSignal,+ repoId?: string,): Promise<ActiveDatasetDownload[]> {- const response = await authFetch("/api/hub/datasets/active-downloads", {+ // No repo id lists every active dataset download, which is what hydration+ // wants; one narrows it, which is what a single repo view wants.+ const params = repoId ? `?${new URLSearchParams({ repo_id: repoId })}` : "";+ const response = await authFetch(`/api/hub/datasets/active-downloads${params}`, {signal,});const data = await parseJsonOrThrow<{diff --git a/studio/frontend/src/features/hub/download-manager/constants.ts b/studio/frontend/src/features/hub/download-manager/constants.tsindex 340cf54d8c2..eeadaee4427 100644--- a/studio/frontend/src/features/hub/download-manager/constants.ts+++ b/studio/frontend/src/features/hub/download-manager/constants.ts@@ -30,6 +30,67 @@ export function isTransportMode(value: unknown): value is TransportMode {);}+/** The transport a started job is really running on.+ *+ * An accepted start can mean the backend attached this client to a job another+ * one had already begun, which keeps the transport it started on. Trusting the+ * locally requested value there offers Pause for a Xet run, or Cancel for a+ * resumable HTTP one. */+export function transportAfterStart(+ requested: ResolvedTransport,+ reported: unknown,+): ResolvedTransport {+ return isResolvedTransport(reported) ? reported : requested;+}++/** Whether a probe response describes the run a job is currently on.+ *+ * A cancel and restart between the request and its reply makes the answer+ * about a different job, possibly on the other transport. A job with no+ * generation recorded yet has nothing better to go on, so any generation the+ * probe reports is taken (along with the generation itself). */+export function probeDescribesCurrentRun(+ known: unknown,+ reported: unknown,+): boolean {+ return Number.isSafeInteger(known)+ ? reported === known+ : Number.isSafeInteger(reported);+}++export type AdoptedTransports = {+ transport?: ResolvedTransport;+ cancelTransport?: ResolvedTransport;+};++/** What a probe says about the pair. `cancelTransport: null` is the backend+ * reporting no marker, which is not the same as a source that cannot report one+ * at all (undefined). */+export type ReportedTransports = {+ transport?: ResolvedTransport;+ cancelTransport?: ResolvedTransport | null;+};++/** What an adopted job records for its transport pair: what the backend just+ * reported, else what was restored from storage.+ *+ * Both fields together, so a probe carrying only one cannot erase the other.+ * `/download-status` has no cancel marker at all, and it can win the hydration+ * race against `/active-downloads`, which does. A reported null still clears a+ * stored marker: the run being adopted is the one the backend just described. */+export function adoptedTransports(+ reported: ReportedTransports,+ existing: AdoptedTransports | undefined,+): AdoptedTransports {+ return {+ transport: reported.transport ?? existing?.transport,+ cancelTransport:+ reported.cancelTransport === undefined+ ? existing?.cancelTransport+ : (reported.cancelTransport ?? undefined),+ };+}+export function isResolvedTransport(value: unknown,): value is ResolvedTransport {diff --git a/studio/frontend/src/features/hub/download-manager/download-manager-state.ts b/studio/frontend/src/features/hub/download-manager/download-manager-state.tsindex 1f129ac895e..7dbca7f08e1 100644--- a/studio/frontend/src/features/hub/download-manager/download-manager-state.ts+++ b/studio/frontend/src/features/hub/download-manager/download-manager-state.ts@@ -12,6 +12,7 @@ import {DOWNLOAD_KIND,type DownloadKind,isDownloadKind,+ isResolvedTransport,} from "./constants";import {ACTIVE_STATES,@@ -75,6 +76,12 @@ function sanitizePersistedJob(value: unknown): ManagedDownload | null {value.scopedFiles.every((f) => typeof f === "string")? { scopedFiles: value.scopedFiles as string[] }: {}),+ ...(isResolvedTransport(value.transport)+ ? { transport: value.transport }+ : {}),+ ...(isResolvedTransport(value.cancelTransport)+ ? { cancelTransport: value.cancelTransport }+ : {}),};}@@ -114,6 +121,13 @@ function toPersistedJob(? { serverGeneration: job.serverGeneration }: {}),...(job.scopedFiles !== undefined ? { scopedFiles: job.scopedFiles } : {}),+ ...(job.transport !== undefined ? { transport: job.transport } : {}),+ // Alongside the transport, never instead of it: a fallback run reads as+ // plain HTTP without this and the reloaded card offers Pause for a stop+ // that leaves a restart-only partial.+ ...(job.cancelTransport !== undefined+ ? { cancelTransport: job.cancelTransport }+ : {}),};}diff --git a/studio/frontend/src/features/hub/download-manager/download-manager-types.ts b/studio/frontend/src/features/hub/download-manager/download-manager-types.tsindex b1474ea3681..3dde57e259e 100644--- a/studio/frontend/src/features/hub/download-manager/download-manager-types.ts+++ b/studio/frontend/src/features/hub/download-manager/download-manager-types.ts@@ -4,7 +4,7 @@import type { TransferSample } from "@/lib/transfer-stats";import type { InventoryHint } from "../inventory/types";import type { DownloadJobState } from "./api";-import type { DownloadKind } from "./constants";+import type { DownloadKind, ResolvedTransport } from "./constants";import type { TransportConflictInfo } from "./types";export interface ManagedDownload {@@ -28,6 +28,14 @@ export interface ManagedDownload {serverGeneration?: number;/** Files a scoped job is fetching, when known. Every file set of one repo rides the same scope slot (see `scopedVariant`), so this separates "my transfer is already running" from "a different quant of this repo is running": adopting the latter would report ready for files nobody fetched. Unknown stays adoptable only for an UNSCOPED job. */scopedFiles?: string[];+ // The transport this run resolved to, so a surface can say whether stopping+ // keeps a resumable partial. Absent only when neither the backend nor+ // persisted state identifies an adopted job's transport.+ transport?: ResolvedTransport;+ /** A Xet run that fell back to HTTP keeps its original cancel marker, so+ * stopping it still leaves a restart-only partial. Set only in that case,+ * and it, not `transport`, decides the stop control. */+ cancelTransport?: ResolvedTransport;// Driven by another subsystem (see external-jobs.ts), not the poll loop. Such// a job is never persisted, probed against the hub API, or published as a// chat-inventory hint when it completes.diff --git a/studio/frontend/src/features/hub/download-manager/hydration.ts b/studio/frontend/src/features/hub/download-manager/hydration.tsindex e33aefbfff2..84d38312817 100644--- a/studio/frontend/src/features/hub/download-manager/hydration.ts+++ b/studio/frontend/src/features/hub/download-manager/hydration.ts@@ -7,7 +7,7 @@ import {getAllActiveModelDownloads,type DownloadJobState,} from "./api";-import { DOWNLOAD_KIND } from "./constants";+import { DOWNLOAD_KIND, isResolvedTransport } from "./constants";import { ACTIVE_STATES, POLL_REQUEST_TIMEOUT_MS } from "./download-manager-config";import {apiGetProgress,@@ -98,6 +98,12 @@ async function adoptActiveModelDownloads(): Promise<void> {},safeGeneration(download.generation),download.state,+ isResolvedTransport(download.transport) ? download.transport : undefined,+ // null, not undefined: this endpoint always reports the marker, so "no+ // marker" has to clear one a previous run left in storage.+ isResolvedTransport(download.cancel_transport)+ ? download.cancel_transport+ : null,);}}@@ -119,6 +125,12 @@ async function adoptActiveDatasetDownloads(): Promise<void> {},safeGeneration(download.generation),download.state,+ isResolvedTransport(download.transport) ? download.transport : undefined,+ // null, not undefined: this endpoint always reports the marker, so "no+ // marker" has to clear one a previous run left in storage.+ isResolvedTransport(download.cancel_transport)+ ? download.cancel_transport+ : null,);}}diff --git a/studio/frontend/src/features/hub/download-manager/poll-loop.ts b/studio/frontend/src/features/hub/download-manager/poll-loop.tsindex 1a755ec7ee7..13d0604b894 100644--- a/studio/frontend/src/features/hub/download-manager/poll-loop.ts+++ b/studio/frontend/src/features/hub/download-manager/poll-loop.ts@@ -7,8 +7,8 @@ import { bumpInventoryVersion } from "../stores/inventory-events";import { toast } from "@/lib/toast";import { appendSample, computeTransferStats } from "@/lib/transfer-stats";import {+ getActiveDatasetDownloads,getActiveModelDownloads,- getDatasetDownloadStatus,type ActiveModelDownload,type DownloadJobState,} from "./api";@@ -39,6 +39,10 @@ import {type DownloadKind,type ResolvedTransport,type TransportMode,+ adoptedTransports,+ isResolvedTransport,+ probeDescribesCurrentRun,+ transportAfterStart,} from "./constants";import {apiCancel,@@ -588,6 +592,8 @@ export async function startJob(useXet?: boolean;generation?: number;state?: DownloadJobState;+ transport?: ResolvedTransport;+ cancelTransport?: ResolvedTransport | null;} = {},): Promise<void> {const key = jobKeyOf(req.kind, req.repoId, req.variant);@@ -655,6 +661,15 @@ export async function startJob(? opts.generation: existing?.serverGeneration: undefined;+ // An adopted job prefers what the backend just reported and falls back to+ // the persisted value, for the transport and its cancel marker alike.+ const adopted = opts.adopt+ ? adoptedTransports(+ { transport: opts.transport, cancelTransport: opts.cancelTransport },+ existing,+ )+ : { transport: mode, cancelTransport: undefined };+ const activeTransport = adopted.transport;if (!opts.adopt && hasActiveRepoPeer(req.kind, req.repoId, key, req.variant)) {teardownRuntime(key);return;@@ -673,6 +688,14 @@ export async function startJob(bytesPerSec: 0,error: null,startedAt: opts.adopt ? (existing?.startedAt ?? Date.now()) : Date.now(),+ // An adopted job prefers the backend's live transport, then a persisted+ // value. It never claims the HTTP placeholder used to skip resolution.+ ...(activeTransport ? { transport: activeTransport } : {}),+ // A fallback run's cancel marker. Only an adopted job can have one: the+ // fallback happens long after a start.+ ...(adopted.cancelTransport+ ? { cancelTransport: adopted.cancelTransport }+ : {}),...(Number.isSafeInteger(seedGeneration)? { serverGeneration: seedGeneration }: {}),@@ -708,6 +731,13 @@ export async function startJob(if (Number.isSafeInteger(result.generation)) {patchJob(key, { serverGeneration: result.generation });}+ const started = transportAfterStart(mode, result.transport);+ if (started !== activeTransport) patchJob(key, { transport: started });+ // An adopted job can already have fallen back from Xet to HTTP, which+ // keeps its original cancel marker and so its stop control.+ if (isResolvedTransport(result.cancel_transport)) {+ patchJob(key, { cancelTransport: result.cancel_transport });+ }}beginPolling(key, rt);@@ -896,10 +926,36 @@ export function adoptJob(req: DownloadRequest,generation?: number,state?: DownloadJobState,+ transport?: ResolvedTransport,+ // null is the backend reporting no marker, which must clear a stored one;+ // undefined is a caller that cannot report one at all.+ cancelTransport?: ResolvedTransport | null,): void {const key = jobKeyOf(req.kind, req.repoId, req.variant);- if (runtimeRegistry.runtimes.get(key)?.pollingStarted) return;- void startJob(req, { adopt: true, generation, state });+ if (runtimeRegistry.runtimes.get(key)?.pollingStarted) {+ // Persistence hydration and the backend-active probe run concurrently, so a+ // late backend response must still replace a missing or stale stored value.+ // Only for the run it described, though: a cancel and restart in between+ // makes this a different job, possibly on the other transport.+ const known = getState().jobs[key]?.serverGeneration;+ if (transport && probeDescribesCurrentRun(known, generation)) {+ patchJob(key, {+ transport,+ ...(cancelTransport === undefined+ ? {}+ : { cancelTransport: cancelTransport ?? undefined }),+ ...(Number.isSafeInteger(known) ? {} : { serverGeneration: generation }),+ });+ }+ return;+ }+ void startJob(req, {+ adopt: true,+ generation,+ state,+ ...(transport ? { transport } : {}),+ ...(cancelTransport === undefined ? {} : { cancelTransport }),+ });}type ProbeAndAdoptOptions = {@@ -939,18 +995,33 @@ export async function probeAndAdopt(},active.generation,active.state,+ isResolvedTransport(active.transport) ? active.transport : undefined,+ isResolvedTransport(active.cancel_transport)+ ? active.cancel_transport+ : null,);}return;}- const status = await getDatasetDownloadStatus(repoId, signal);+ // The active-downloads list, not download-status: only the list reports the+ // transport, without which an adopted HTTP dataset shows Cancel for a+ // transfer that would have resumed.+ const datasets = await getActiveDatasetDownloads(signal, repoId);if (signal.aborted) return;- if (status.state === "running" || status.state === "cancelling") {+ // No repo compare here: the endpoint resolves the cached casing before it+ // filters, so an exact match against the card's spelling would drop the+ // very row it just asked for.+ for (const active of datasets) {+ if (active.state !== "running" && active.state !== "cancelling") continue;adoptJob({ kind, repoId, variant: null, expectedBytes: 0 },- status.generation,- status.state,+ active.generation,+ active.state,+ isResolvedTransport(active.transport) ? active.transport : undefined,+ isResolvedTransport(active.cancel_transport)+ ? active.cancel_transport+ : null,);}} catch (error) {diff --git a/studio/frontend/src/features/hub/download-manager/use-repo-download.ts b/studio/frontend/src/features/hub/download-manager/use-repo-download.tsindex 9b9f33d8a2e..45586ebe6eb 100644--- a/studio/frontend/src/features/hub/download-manager/use-repo-download.ts+++ b/studio/frontend/src/features/hub/download-manager/use-repo-download.ts@@ -4,6 +4,7 @@import { useCallback, useEffect, useMemo } from "react";import { useShallow } from "zustand/react/shallow";import { useLatestRef } from "../hooks/use-latest-ref";+import type { ResolvedTransport } from "./constants";import type { TransportConflictInfo } from "./types";import {type DownloadKind,@@ -25,6 +26,11 @@ export interface DownloadJobProgress {export interface DownloadJob {progress: DownloadJobProgress | null;bytesPerSec: number;+ /** Transport the running job resolved to, when it started on this frontend. */+ transport: ResolvedTransport | null;+ /** Its cancel marker, when a Xet run fell back to HTTP: stopping it is still+ * a restart, so this and not `transport` decides the stop control. */+ cancelTransport: ResolvedTransport | null;cancelling: boolean;repoPeerActive: boolean;transportConflict: TransportConflictInfo | null;@@ -179,6 +185,8 @@ export function useRepoDownload(config: RepoDownloadConfig): DownloadJob {return {progress,bytesPerSec: active?.bytesPerSec ?? 0,+ transport: active?.transport ?? null,+ cancelTransport: active?.cancelTransport ?? null,cancelling: active?.state === "cancelling",repoPeerActive: activeState.repoPeerActive,transportConflict,diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.cssindex 086796f18b9..bd08db04a08 100644--- a/studio/frontend/src/features/hub/hub.css+++ b/studio/frontend/src/features/hub/hub.css@@ -1230,24 +1230,6 @@justify-content: center;}- .hub-cta-indicator-spinner,- .hub-cta-indicator-cancel {- transition: opacity 150ms;- }-- .hub-cta-indicator-cancel {- position: absolute;- opacity: 0;- }-- .hub-action-btn:hover .hub-cta-indicator-spinner {- opacity: 0;- }-- .hub-action-btn:hover .hub-cta-indicator-cancel {- opacity: 1;- }-/* Hover-revealed inline action overlay (used for the row-end trash ondownloaded models and datasets in the inspector). Wrapper 28×28 with a16px glyph — same icon size as `.hub-action-btn` so the destructivediff --git a/studio/frontend/tests/download-stop-mode.test.ts b/studio/frontend/tests/download-stop-mode.test.tsnew file mode 100644index 00000000000..47356625e26--- /dev/null+++ b/studio/frontend/tests/download-stop-mode.test.ts@@ -0,0 +1,62 @@+// 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 {+ downloadActionAriaLabel,+ downloadStopMode,+} from "../src/features/hub/catalog/use-download-card-state.ts";++test("an HTTP download pauses, because its partial can be continued", () => {+ assert.equal(downloadStopMode("http"), "pause");+});++test("a Xet download cancels, because it has to start over", () => {+ assert.equal(downloadStopMode("xet"), "cancel");+});++test("a fresh HTTP download reads its own transport, not the absent partial", () => {+ assert.equal(downloadStopMode("http", null), "pause");+});++test("a restarted conflict follows the new transport, not the old partial", () => {+ assert.equal(downloadStopMode("xet", "http"), "cancel");+ assert.equal(downloadStopMode("http", "xet"), "pause");+});++test("an adopted job with no known transport falls back to the partial", () => {+ assert.equal(downloadStopMode(null, "http"), "pause");+});++test("an unknown transport cancels, never promising a resume", () => {+ assert.equal(downloadStopMode(null), "cancel");+ assert.equal(downloadStopMode(undefined, undefined), "cancel");+});++test("the accessible label matches what the button does", () => {+ assert.equal(downloadActionAriaLabel(true, false, "pause"), "Pause download");+ assert.equal(+ downloadActionAriaLabel(true, false, "cancel"),+ "Cancel download",+ );+ assert.equal(downloadActionAriaLabel(true, true, "pause"), "Cancelling…");+ assert.equal(downloadActionAriaLabel(false, false, "pause"), undefined);+});++test("a Xet run that fell back to HTTP still cancels, not pauses", () => {+ // The retry reclaims the job as HTTP but keeps the Xet cancel marker, so+ // stopping it leaves a partial that has to start over.+ assert.equal(downloadStopMode("http", null, "xet"), "cancel");+});++test("an HTTP job whose marker is also HTTP still pauses", () => {+ assert.equal(downloadStopMode("http", null, "http"), "pause");+});++test("no marker leaves the live transport in charge", () => {+ assert.equal(downloadStopMode("http", null, null), "pause");+ assert.equal(downloadStopMode("http", null, undefined), "pause");+ assert.equal(downloadStopMode("xet", "http", null), "cancel");+});diff --git a/studio/frontend/tests/download-transport-after-start.test.ts b/studio/frontend/tests/download-transport-after-start.test.tsnew file mode 100644index 00000000000..026cae6cdc7--- /dev/null+++ b/studio/frontend/tests/download-transport-after-start.test.ts@@ -0,0 +1,105 @@+// 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 {+ adoptedTransports,+ probeDescribesCurrentRun,+ transportAfterStart,+} from "../src/features/hub/download-manager/constants.ts";++test("a start of its own keeps the transport it resolved", () => {+ assert.equal(transportAfterStart("http", null), "http");+ assert.equal(transportAfterStart("xet", undefined), "xet");+});++test("adopting another client's run takes that run's transport", () => {+ // Requested HTTP, attached to a Xet job: Pause would promise a resume the+ // Xet worker cannot give.+ assert.equal(transportAfterStart("http", "xet"), "xet");+ assert.equal(transportAfterStart("xet", "http"), "http");+});++test("an unresolved or unknown report is ignored, not trusted", () => {+ assert.equal(transportAfterStart("http", "auto"), "http");+ assert.equal(transportAfterStart("xet", "ftp"), "xet");+ assert.equal(transportAfterStart("xet", 3), "xet");+});++test("a probe for the run a job is on may patch it", () => {+ assert.equal(probeDescribesCurrentRun(7, 7), true);+});++test("a probe from before a cancel and restart may not", () => {+ // The old response would otherwise hand the restarted job the old+ // transport, and the fresh start's own reply cannot repair it.+ assert.equal(probeDescribesCurrentRun(8, 7), false);+});++test("a job with no generation yet takes what the probe reports", () => {+ assert.equal(probeDescribesCurrentRun(undefined, 7), true);+ assert.equal(probeDescribesCurrentRun(null, 0), true);+});++test("a probe with no generation proves nothing", () => {+ assert.equal(probeDescribesCurrentRun(undefined, undefined), false);+ assert.equal(probeDescribesCurrentRun(7, undefined), false);+ assert.equal(probeDescribesCurrentRun(7, 7.5), false);+});++test("adoption keeps a persisted marker when the probe carries none", () => {+ // `/download-status` has no cancel marker and can win the hydration race+ // against `/active-downloads`, which does.+ assert.deepEqual(+ adoptedTransports(+ { transport: "http" },+ { transport: "http", cancelTransport: "xet" },+ ),+ { transport: "http", cancelTransport: "xet" },+ );+});++test("a probe that reports both wins over what was stored", () => {+ assert.deepEqual(+ adoptedTransports(+ { transport: "xet", cancelTransport: "http" },+ { transport: "http", cancelTransport: "xet" },+ ),+ { transport: "xet", cancelTransport: "http" },+ );+});++test("an adoption with nothing stored and nothing reported holds neither", () => {+ assert.deepEqual(adoptedTransports({}, undefined), {+ transport: undefined,+ cancelTransport: undefined,+ });+});++test("the persisted transport survives a probe that omits it too", () => {+ assert.deepEqual(+ adoptedTransports({ cancelTransport: "xet" }, { transport: "http" }),+ { transport: "http", cancelTransport: "xet" },+ );+});++test("a reported null clears a marker left by an earlier run", () => {+ // /active-downloads always carries the field, so null is the backend saying+ // this run has no marker, not a source that cannot report one.+ assert.deepEqual(+ adoptedTransports(+ { transport: "http", cancelTransport: null },+ { transport: "xet", cancelTransport: "xet" },+ ),+ { transport: "http", cancelTransport: undefined },+ );+});++test("a reported null with nothing stored still holds no marker", () => {+ assert.deepEqual(+ adoptedTransports({ transport: "http", cancelTransport: null }, undefined),+ { transport: "http", cancelTransport: undefined },+ );+});diff --git a/studio/frontend/tests/download-transport-persistence.test.ts b/studio/frontend/tests/download-transport-persistence.test.tsnew file mode 100644index 00000000000..d2362b0ba68--- /dev/null+++ b/studio/frontend/tests/download-transport-persistence.test.ts@@ -0,0 +1,147 @@+// 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 { ManagedDownload } from "../src/features/hub/download-manager/download-manager-types.ts";+import {+ installLocalStorageFake,+ registerBundlerResolver,+} from "./helpers/kit.ts";++registerBundlerResolver();+const { store } = installLocalStorageFake();++const PERSIST_KEY = "unsloth.studio.downloads";+let flushPersistedState: (() => void) | undefined;+Object.assign(globalThis.window, {+ addEventListener: (type: string, listener: () => void) => {+ if (type === "pagehide") flushPersistedState = listener;+ },+});++function persistedJob(+ repoId: string,+ transport: unknown,+ cancelTransport?: unknown,+) {+ return {+ key: `model:${repoId}`,+ kind: "model",+ repoId,+ variant: null,+ state: "running",+ downloadedBytes: 25,+ completedBytes: 0,+ expectedBytes: 100,+ fraction: 0.25,+ error: null,+ startedAt: 1,+ transport,+ ...(cancelTransport === undefined ? {} : { cancelTransport }),+ };+}++store.set(+ PERSIST_KEY,+ JSON.stringify({+ state: {+ jobs: {+ http: persistedJob("org/http-model", "http"),+ invalid: persistedJob("org/auto-model", "auto"),+ fallback: persistedJob("org/fallback-model", "http", "xet"),+ badMarker: persistedJob("org/bad-marker-model", "http", "auto"),+ },+ conflicts: {},+ },+ version: 1,+ }),+);++const { getState, jobKeyOf, putJob } = await import(+ "../src/features/hub/download-manager/download-manager-state.ts"+);++test("reload hydration keeps only a resolved active transport", () => {+ const jobs = getState().jobs;+ assert.equal(+ jobs[jobKeyOf("model", "org/http-model", null)]?.transport,+ "http",+ );+ assert.equal(+ jobs[jobKeyOf("model", "org/auto-model", null)]?.transport,+ undefined,+ );+});++test("the active transport is written with the persisted job", () => {+ const key = jobKeyOf("dataset", "org/dataset", null);+ const job: ManagedDownload = {+ key,+ kind: "dataset",+ repoId: "org/dataset",+ variant: null,+ state: "running",+ downloadedBytes: 50,+ completedBytes: 0,+ completeOnDisk: false,+ expectedBytes: 100,+ fraction: 0.5,+ bytesPerSec: 10,+ error: null,+ startedAt: 2,+ transport: "xet",+ };++ putJob(job);+ assert.ok(flushPersistedState);+ flushPersistedState();++ const persisted = JSON.parse(store.get(PERSIST_KEY) ?? "null");+ assert.equal(persisted.state.jobs[key].transport, "xet");+});++test("a fallback run's cancel marker survives the reload too", () => {+ // Without it the restored job reads as plain HTTP and offers Pause for a+ // stop that leaves a restart-only partial.+ const jobs = getState().jobs;+ const job = jobs[jobKeyOf("model", "org/fallback-model", null)];+ assert.equal(job?.transport, "http");+ assert.equal(job?.cancelTransport, "xet");+});++test("an unresolved persisted marker is dropped, not trusted", () => {+ const jobs = getState().jobs;+ assert.equal(+ jobs[jobKeyOf("model", "org/bad-marker-model", null)]?.cancelTransport,+ undefined,+ );+});++test("the cancel marker is written with the persisted job", () => {+ const key = jobKeyOf("model", "org/retry-model", null);+ putJob({+ key,+ kind: "model",+ repoId: "org/retry-model",+ variant: null,+ state: "running",+ downloadedBytes: 10,+ completedBytes: 0,+ completeOnDisk: false,+ expectedBytes: 100,+ fraction: 0.1,+ bytesPerSec: 0,+ error: null,+ startedAt: 3,+ transport: "http",+ cancelTransport: "xet",+ });+ assert.ok(flushPersistedState);+ flushPersistedState();++ const persisted = JSON.parse(store.get(PERSIST_KEY) ?? "null");+ assert.equal(persisted.state.jobs[key].transport, "http");+ assert.equal(persisted.state.jobs[key].cancelTransport, "xet");+});