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: stop the false "Could not sync pinned chats" toast during a desktop update (#16188)
oobaboogab7c7cde4b58a
diff --git a/studio/frontend/src/features/chat/api/chat-pins-api.ts b/studio/frontend/src/features/chat/api/chat-pins-api.tsindex b307669788a..ae95f7daccc 100644--- a/studio/frontend/src/features/chat/api/chat-pins-api.ts+++ b/studio/frontend/src/features/chat/api/chat-pins-api.ts@@ -2,11 +2,16 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0import { authFetch } from "@/features/auth";+import { isBackendDownForDesktopUpdate } from "@/lib/desktop-update-activity";import {getChatSettings,saveChatSettingsPatchIfCurrent,} from "./chat-settings-api";-import { ChatSettingsRequestError } from "../utils/settings-retry";+import {+ ChatSettingsRequestError,+ asBodyTransportFailure,+} from "../utils/settings-retry";+import { notePinRequestFailure } from "../utils/pinned-chats-update-failure";import {type PinOperation,PinnedChatsValidationError,@@ -26,8 +31,12 @@ export function createChatPinsApi(sessionSignal: AbortSignal) {sessionSignal.addEventListener("abort", abort);if (sessionSignal.aborted) abort();const timer = setTimeout(abort, 10_000);+ const downWhenIssued = isBackendDownForDesktopUpdate();try {return await run(controller.signal);+ } catch (error) {+ notePinRequestFailure(error, downWhenIssued);+ throw error;} finally {clearTimeout(timer);sessionSignal.removeEventListener("abort", abort);@@ -51,7 +60,7 @@ export function createChatPinsApi(sessionSignal: AbortSignal) {});const data: unknown = await response.json().catch((error: unknown) => {// A 200 whose body was cut off is a transport failure to retry, not an invalid answer.- if (signal.aborted || response.ok) throw error;+ if (signal.aborted || response.ok) throw asBodyTransportFailure(error);return null;});if (!response.ok) {diff --git a/studio/frontend/src/features/chat/api/chat-settings-api.ts b/studio/frontend/src/features/chat/api/chat-settings-api.tsindex a97526096ff..f413a964f60 100644--- a/studio/frontend/src/features/chat/api/chat-settings-api.ts+++ b/studio/frontend/src/features/chat/api/chat-settings-api.ts@@ -18,6 +18,8 @@ import type {import type { PersistedInferenceParams } from "../types/runtime";import {ChatSettingsRequestError,+ asBodyTransportFailure,+ isAbortOrTimeout,isUnderKeepaliveBudget,} from "../utils/settings-retry";@@ -123,7 +125,13 @@ function parseErrorText(status: number, body: unknown): string {}async function parseJsonOrThrow<T>(response: Response): Promise<T> {- const body = await response.json().catch(() => null);+ const body = await response.json().catch((error: unknown) => {+ // A 200 cut off or aborted mid-body has no answer; invalid JSON (SyntaxError) still returns null.+ if (response.ok && (error instanceof TypeError || isAbortOrTimeout(error))) {+ throw asBodyTransportFailure(error);+ }+ return null;+ });if (!response.ok) {// Typed so the settings queue can tell server-down (keep patch) from rejection (drop fields).throw new ChatSettingsRequestError(diff --git a/studio/frontend/src/features/chat/hooks/use-pinned-chats-sync.ts b/studio/frontend/src/features/chat/hooks/use-pinned-chats-sync.tsindex aaf45598555..9a3172f93f2 100644--- a/studio/frontend/src/features/chat/hooks/use-pinned-chats-sync.ts+++ b/studio/frontend/src/features/chat/hooks/use-pinned-chats-sync.ts@@ -9,6 +9,7 @@ import {AUTH_TOKEN_KEY,hasAuthToken,} from "@/features/auth";+import { isBackendDownForDesktopUpdate } from "@/lib/desktop-update-activity";import {PIN_JOURNAL_PREFIX,discardUnboundPinEdits,@@ -28,6 +29,8 @@ export function usePinnedChatsSync(): void {useEffect(() => {let sessionMark = localStorage.getItem(AUTH_SESSION_MARK_KEY);const refresh = () => {+ // The update screen stops the backend; the poll after it drops picks the pins back up.+ if (isBackendDownForDesktopUpdate()) return;if (hasAuthToken() && document.visibilityState === "visible") {void loadRuntime().then((sync) => {diff --git a/studio/frontend/src/features/chat/sync-pinned-chats.ts b/studio/frontend/src/features/chat/sync-pinned-chats.tsindex 2430f3393c2..f3ec09afe32 100644--- a/studio/frontend/src/features/chat/sync-pinned-chats.ts+++ b/studio/frontend/src/features/chat/sync-pinned-chats.ts@@ -18,6 +18,7 @@ import {import { createPinnedChatsJournal } from "./utils/pinned-chats-journal";import { createPinnedChatsSync } from "./utils/pinned-chats-sync";import { createPinnedChatsTransport } from "./utils/pinned-chats-transport";+import { isPinFailureUnderDesktopUpdate } from "./utils/pinned-chats-update-failure";import { isRetryablePinError } from "./utils/settings-retry";import { onChatThreadsDeleted } from "./utils/chat-thread-tombstones";@@ -62,10 +63,12 @@ function createRuntime(sessionScope: string) {writePending: journal.writePending,isRetryable: isRetryablePinError,publish: (pinnedIds) => usePinnedChatsStore.setState({ pinnedIds }),- onError: () =>+ onError: (error) => {+ if (isPinFailureUnderDesktopUpdate(error)) return;toast.error("Could not sync pinned chats. Try again when connected.", {id: "pinned-chats-sync-error",- }),+ });+ },});// Every delete path unpins what it removed, so a never-imported comparison's pin cannot block.const stopWatchingDeletes = onChatThreadsDeleted((threadIds, pairIds) => {diff --git a/studio/frontend/src/features/chat/utils/pinned-chats-sync.ts b/studio/frontend/src/features/chat/utils/pinned-chats-sync.tsindex 0ab09a71a9b..2a00c4988b1 100644--- a/studio/frontend/src/features/chat/utils/pinned-chats-sync.ts+++ b/studio/frontend/src/features/chat/utils/pinned-chats-sync.ts@@ -32,6 +32,9 @@ export interface PinnedChatsSyncOptions {export class PinnedChatsValidationError extends Error {}+/** A queued intent behind one that has not saved yet; `cause` is that one's failure, when known. */+export class PinnedChatsBlockedError extends Error {}+export function isValidPinId(value: unknown): value is string {if (typeof value !== "string" || value.length === 0 || value.length > 512) {return false;@@ -119,6 +122,7 @@ export function createPinnedChatsSync(options: PinnedChatsSyncOptions) {const scheduled = new Map<string, Promise<void>>();// A response arrived, but removing its journal entry may still need retrying.const acknowledged = new Set<string>();+ let lastFailure: { operationId: string; error: unknown } | undefined;function publish() {options.publish(pending.reduce(applyPinOperation, confirmed ?? []));@@ -315,8 +319,12 @@ export function createPinnedChatsSync(options: PinnedChatsSyncOptions) {if (!pending.some((entry) => entry.operationId === operation.operationId)) {return;}- if (pending[0]?.operationId !== operation.operationId) {- throw new Error("An earlier pin change is still waiting to save.");+ const head = pending[0]?.operationId;+ if (head !== operation.operationId) {+ throw new PinnedChatsBlockedError(+ "An earlier pin change is still waiting to save.",+ { cause: lastFailure?.operationId === head ? lastFailure.error : undefined },+ );}try {if (acknowledged.has(operation.operationId)) {@@ -329,6 +337,7 @@ export function createPinnedChatsSync(options: PinnedChatsSyncOptions) {if (epoch !== generation) {return;}+ lastFailure = { operationId: operation.operationId, error };await recover(operation, error, epoch);throw error;}@@ -438,6 +447,7 @@ export function createPinnedChatsSync(options: PinnedChatsSyncOptions) {refreshing = undefined;scheduled.clear();acknowledged.clear();+ lastFailure = undefined;publish();if (clearPending) {persist([]);diff --git a/studio/frontend/src/features/chat/utils/pinned-chats-update-failure.ts b/studio/frontend/src/features/chat/utils/pinned-chats-update-failure.tsnew file mode 100644index 00000000000..80ea5b239ae--- /dev/null+++ b/studio/frontend/src/features/chat/utils/pinned-chats-update-failure.ts@@ -0,0 +1,40 @@+// 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 {+ isBackendDownForDesktopUpdate,+ isSilencedDesktopUpdateFailure,+} from "../../../lib/desktop-update-activity.ts";+import { PinnedChatsBlockedError } from "./pinned-chats-sync.ts";+import { isAbortOrTimeout } from "./settings-retry.ts";++// Judged when the request fails: the queue reports after a recovery read, by when the flag may be gone.+const failedUnderUpdate = new WeakSet<object>();++function unreachable(error: unknown, down: boolean): boolean {+ return (+ isSilencedDesktopUpdateFailure(error, down) ||+ // The pins API aborts at 10s.+ (down && isAbortOrTimeout(error))+ );+}++export function notePinRequestFailure(error: unknown, downWhenIssued: boolean): void {+ const down = downWhenIssued || isBackendDownForDesktopUpdate();+ if (typeof error === "object" && error !== null && unreachable(error, down)) {+ failedUnderUpdate.add(error);+ }+}++/** A pin sync failure caused by the backend the desktop update stopped: no toast for it. */+export function isPinFailureUnderDesktopUpdate(error: unknown): boolean {+ if (error instanceof PinnedChatsBlockedError) {+ return error.cause === undefined+ ? isBackendDownForDesktopUpdate()+ : isPinFailureUnderDesktopUpdate(error.cause);+ }+ if (typeof error === "object" && error !== null && failedUnderUpdate.has(error)) {+ return true;+ }+ return unreachable(error, isBackendDownForDesktopUpdate());+}diff --git a/studio/frontend/src/features/chat/utils/settings-retry.ts b/studio/frontend/src/features/chat/utils/settings-retry.tsindex afe601036db..746e47fb37d 100644--- a/studio/frontend/src/features/chat/utils/settings-retry.ts+++ b/studio/frontend/src/features/chat/utils/settings-retry.ts@@ -16,6 +16,24 @@ export class ChatSettingsRequestError extends Error {}}+export function isAbortOrTimeout(error: unknown): boolean {+ return (+ error instanceof Error &&+ (error.name === "AbortError" || error.name === "TimeoutError")+ );+}++/** A body that broke off mid-read (TypeError) is a transport failure; invalid JSON (SyntaxError) is not. */+export function asBodyTransportFailure(error: unknown): unknown {+ if (!(error instanceof TypeError)) return error;+ return Object.assign(+ new Error("The connection closed before the server's reply finished.", {+ cause: error,+ }),+ { unslothTransportFailure: true },+ );+}+/** 4xx is terminal except 408 and 429; network errors, 5xx and timeouts are transient. */export function isTerminalSettingsRejection(error: unknown): boolean {if (!(error instanceof ChatSettingsRequestError)) return false;diff --git a/studio/frontend/tests/desktop-update-refresh-toast.test.ts b/studio/frontend/tests/desktop-update-refresh-toast.test.tsindex 7ba7ef50b61..09a2b28450c 100644--- a/studio/frontend/tests/desktop-update-refresh-toast.test.ts+++ b/studio/frontend/tests/desktop-update-refresh-toast.test.ts@@ -13,6 +13,8 @@ import { readSrc } from "./helpers/kit.ts";const RUNTIME = readSrc("features/chat/hooks/use-chat-model-runtime.ts");const RAG = readSrc("features/rag/components/use-rag-documents.ts");+const PIN_HOOK = readSrc("features/chat/hooks/use-pinned-chats-sync.ts");+const PIN_SYNC = readSrc("features/chat/sync-pinned-chats.ts");function region(source: string, from: string, to: string): string {const start = source.indexOf(from);@@ -120,6 +122,18 @@ test("the documents refresh latches the flag at issue and checks it before reporassert.ok(guard !== -1 && guard < refresh.indexOf("toast.error"));});+test("the pin sync poll stands down under the update screen", () => {+ const refresh = region(PIN_HOOK, "const refresh = () => {", "const reconcileSession");+ const gate = refresh.indexOf("if (isBackendDownForDesktopUpdate()) return;");+ assert.ok(gate !== -1 && gate < refresh.indexOf("loadRuntime()"));+});++test("the pin sync error toast checks for an update failure first", () => {+ const onError = region(PIN_SYNC, "onError: (error) => {", "// Every delete path");+ const guard = onError.indexOf("if (isPinFailureUnderDesktopUpdate(error)) return;");+ assert.ok(guard !== -1 && guard < onError.indexOf("toast.error"));+});+test("the update layer drives the flag and resyncs chat when the screen drops", () => {const layer = region(readSrc("app/provider.tsx"),diff --git a/studio/frontend/tests/pinned-chats-update-failure.test.ts b/studio/frontend/tests/pinned-chats-update-failure.test.tsnew file mode 100644index 00000000000..4a089d363d1--- /dev/null+++ b/studio/frontend/tests/pinned-chats-update-failure.test.ts@@ -0,0 +1,326 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// The real pins API and sync runtime under the desktop update screen: a failure the stopped+// backend caused must not toast, however late the queue reports it.++import assert from "node:assert/strict";+import { register } from "node:module";+import test from "node:test";++// See helpers/auth-stub.mjs.+register("./helpers/settings-api-resolver.mjs", import.meta.url);++const { followDesktopUpdateScreen } = await import(+ "../src/lib/desktop-update-activity.ts"+);+const { createChatPinsApi } = await import("../src/features/chat/api/chat-pins-api.ts");+const {+ PinnedChatsBlockedError,+ PinnedChatsValidationError,+ createPinnedChatsSync,+} = await import("../src/features/chat/utils/pinned-chats-sync.ts");+const { isPinFailureUnderDesktopUpdate } = await import(+ "../src/features/chat/utils/pinned-chats-update-failure.ts"+);+const { ChatSettingsRequestError, isRetryablePinError } = await import(+ "../src/features/chat/utils/settings-retry.ts"+);++const noResync = () => Promise.resolve();++// What the real authFetch throws when the backend is unreachable.+const transport = () =>+ Object.assign(new Error("Unsloth isn't running -- please relaunch it."), {+ unslothTransportFailure: true,+ });++function deferred() {+ let resolve!: () => void;+ const promise = new Promise<void>((r) => (resolve = r));+ return { promise, resolve };+}++function json(body: unknown): Response {+ return new Response(JSON.stringify(body), {+ status: 200,+ headers: { "Content-Type": "application/json" },+ });+}++/** A 200 whose headers arrived but whose body the shutdown cut off. */+function interrupted(): Response {+ const body = new ReadableStream<Uint8Array>({+ start(controller) {+ controller.enqueue(new TextEncoder().encode('{"pinnedIds": ["a"'));+ controller.error(new TypeError("network error"));+ },+ });+ return new Response(body, { status: 200 });+}++/** A 200 whose body never finishes; like fetch, the request's signal aborts the read. */+function stalled(init?: RequestInit): Response {+ const signal = init?.signal;+ const body = new ReadableStream<Uint8Array>({+ start(controller) {+ controller.enqueue(new TextEncoder().encode('{"settings": {'));+ signal?.addEventListener("abort", () => controller.error(signal.reason));+ },+ });+ return new Response(body, { status: 200 });+}++type Handler = (url: string, init?: RequestInit) => Promise<Response>;+let handle: Handler = async () => json({});+globalThis.fetch = ((input: RequestInfo | URL, init?: RequestInit) =>+ handle(String(input), init)) as typeof fetch;++/** The pins routes over an in-memory list; `down` makes every request fail like authFetch would. */+function pinsServer() {+ const server = {+ down: false,+ pins: [] as string[],+ // When set, a read while down waits for it before failing.+ holdReads: undefined as Promise<void> | undefined,+ readsWhileDown: 0,+ };+ handle = async (url, init) => {+ if (server.down) {+ if (url.endsWith("/api/chat/pins")) {+ server.readsWhileDown += 1;+ await server.holdReads;+ }+ throw transport();+ }+ if (url.endsWith("/api/chat/pins")) return json({ pinnedIds: server.pins });+ if (url.endsWith("/api/chat/settings/compare-and-set")) {+ const body = JSON.parse(String(init?.body));+ const applied =+ JSON.stringify(body.expected.pinnedChatIds ?? server.pins) ===+ JSON.stringify(server.pins);+ if (applied) server.pins = body.patch.pinnedChatIds;+ return json({ settings: { pinnedChatIds: server.pins }, applied });+ }+ throw new Error(`unexpected ${url}`);+ };+ return server;+}++/** The runtime as sync-pinned-chats wires it, toasting what isPinFailureUnderDesktopUpdate lets through. */+function pinRuntime() {+ const api = createChatPinsApi(new AbortController().signal);+ const raised: unknown[] = [];+ const toasted: unknown[] = [];+ const sync = createPinnedChatsSync({+ load: api.load,+ compareAndSet: api.compareAndSet,+ readLegacy: () => [],+ isRetryable: isRetryablePinError,+ publish: () => {},+ onError: (error) => {+ raised.push(error);+ if (!isPinFailureUnderDesktopUpdate(error)) toasted.push(error);+ },+ });+ return { api, sync, raised, toasted };+}++test("only failures from the stopped backend are pin update failures", () => {+ const failures = [+ transport(),+ // createChatPinsApi aborts a request after 10s.+ new DOMException("The operation was aborted.", "AbortError"),+ new DOMException("The operation timed out.", "TimeoutError"),+ new PinnedChatsBlockedError("An earlier pin change is still waiting to save."),+ ];+ for (const error of failures) assert.equal(isPinFailureUnderDesktopUpdate(error), false);+ const leave = followDesktopUpdateScreen(true, false, noResync);+ try {+ for (const error of failures) assert.equal(isPinFailureUnderDesktopUpdate(error), true);+ // The backend answered: a real rejection still reports.+ assert.equal(+ isPinFailureUnderDesktopUpdate(new ChatSettingsRequestError("Bad", 500, null)),+ false,+ );+ assert.equal(+ isPinFailureUnderDesktopUpdate(new PinnedChatsValidationError("Invalid")),+ false,+ );+ } finally {+ leave();+ }+});++test("a pin read whose body the shutdown cut off is an update failure", async () => {+ const { api } = pinRuntime();+ handle = async () => interrupted();+ const leave = followDesktopUpdateScreen(true, false, noResync);+ let failure: unknown;+ try {+ failure = await api.load().then(() => assert.fail("expected the read to fail"), (e) => e);+ } finally {+ leave();+ }+ assert.equal((failure as { unslothTransportFailure?: boolean }).unslothTransportFailure, true);+ assert.equal(isPinFailureUnderDesktopUpdate(failure), true);+});++test("a pin write whose body the shutdown cut off is an update failure", async () => {+ const { api } = pinRuntime();+ handle = async () => interrupted();+ const leave = followDesktopUpdateScreen(true, false, noResync);+ let failure: unknown;+ try {+ failure = await api+ .compareAndSet([], ["a"])+ .then(() => assert.fail("expected the write to fail"), (e) => e);+ } finally {+ leave();+ }+ assert.equal((failure as { unslothTransportFailure?: boolean }).unslothTransportFailure, true);+ assert.equal(isPinFailureUnderDesktopUpdate(failure), true);+});++/** Runs `call` against a backend that sends 200 headers and stalls, until the 10s timeout fires. */+async function timedOutAfterHeaders(+ t: import("node:test").TestContext,+ call: (api: ReturnType<typeof createChatPinsApi>) => Promise<unknown>,+): Promise<unknown> {+ t.mock.timers.enable({ apis: ["setTimeout"] });+ const { api } = pinRuntime();+ let stalledRequests = 0;+ handle = async (url, init) => {+ // The pins routes predate this backend: fall back to /api/chat/settings.+ if (url.includes("/api/chat/pins")) return new Response(null, { status: 404 });+ stalledRequests += 1;+ return stalled(init);+ };+ const leave = followDesktopUpdateScreen(true, false, noResync);+ try {+ const failure = call(api).then(() => assert.fail("expected a timeout"), (e) => e);+ while (stalledRequests === 0) await new Promise((r) => setImmediate(r));+ t.mock.timers.tick(10_000);+ return await failure;+ } finally {+ leave();+ }+}++test("a pin write that times out after 200 headers is an update failure", async (t) => {+ const failure = await timedOutAfterHeaders(t, (api) => api.compareAndSet([], ["a"]));+ assert.equal((failure as Error).name, "AbortError");+ assert.equal(isPinFailureUnderDesktopUpdate(failure), true);+});++test("a legacy pin read that times out after 200 headers is an update failure", async (t) => {+ const failure = await timedOutAfterHeaders(t, (api) => api.load());+ assert.equal((failure as Error).name, "AbortError");+ assert.equal(isPinFailureUnderDesktopUpdate(failure), true);+});++test("a legacy pin migration that times out after 200 headers is an update failure", async (t) => {+ const failure = await timedOutAfterHeaders(t, (api) => api.migrateLegacy(["a"]));+ assert.equal((failure as Error).name, "AbortError");+ assert.equal(isPinFailureUnderDesktopUpdate(failure), true);+});++test("a malformed pin response still reports under the update screen", async () => {+ const { api } = pinRuntime();+ handle = async () => new Response('{"pinnedIds": [', { status: 200 });+ const leave = followDesktopUpdateScreen(true, false, noResync);+ try {+ const failure = await api.load().then(() => assert.fail("expected the read to fail"), (e) => e);+ assert.ok(failure instanceof SyntaxError);+ assert.equal(isPinFailureUnderDesktopUpdate(failure), false);+ } finally {+ leave();+ }+});++async function queueTwoEditsWhileDown(+ runtime: ReturnType<typeof pinRuntime>,+ server: ReturnType<typeof pinsServer>,+) {+ await runtime.sync.refresh();+ server.down = true;+ return Promise.allSettled([+ runtime.sync.setPinned(["a"], true),+ runtime.sync.setPinned(["b"], true),+ ]);+}++test("pin edits queued behind a failed write stay silent under the update screen", async () => {+ const server = pinsServer();+ const runtime = pinRuntime();+ const leave = followDesktopUpdateScreen(true, false, noResync);+ try {+ await queueTwoEditsWhileDown(runtime, server);+ } finally {+ leave();+ }+ // The second edit waited behind the first, which could not reach the backend.+ assert.ok(runtime.raised.some((error) => error instanceof PinnedChatsBlockedError));+ assert.deepEqual(runtime.toasted, []);+ // Both edits stayed queued and save once the backend is back.+ server.down = false;+ await runtime.sync.refresh();+ assert.deepEqual([...server.pins].sort(), ["a", "b"]);+});++test("a write that fails under the update stays silent when it reports after the screen drops", async () => {+ const server = pinsServer();+ const runtime = pinRuntime();+ const release = deferred();+ server.holdReads = release.promise;+ const leave = followDesktopUpdateScreen(true, false, noResync);+ const settled = queueTwoEditsWhileDown(runtime, server);+ // The failed write's recovery read is in flight when the update screen drops.+ while (server.readsWhileDown === 0) await new Promise((r) => setImmediate(r));+ leave();+ release.resolve();+ await settled;+ assert.equal(runtime.raised.length, 2);+ assert.ok(runtime.raised[1] instanceof PinnedChatsBlockedError);+ assert.deepEqual(runtime.toasted, []);+});++test("a queued write that times out after 200 headers stays silent with the edit behind it", async (t) => {+ const server = pinsServer();+ const runtime = pinRuntime();+ await runtime.sync.refresh();+ t.mock.timers.enable({ apis: ["setTimeout"] });+ let stalledWrites = 0;+ handle = async (url, init) => {+ if (url.endsWith("/api/chat/settings/compare-and-set")) {+ stalledWrites += 1;+ return stalled(init);+ }+ // The recovery read finds the backend gone.+ throw transport();+ };+ const leave = followDesktopUpdateScreen(true, false, noResync);+ try {+ const settled = Promise.allSettled([+ runtime.sync.setPinned(["a"], true),+ runtime.sync.setPinned(["b"], true),+ ]);+ while (stalledWrites === 0) await new Promise((r) => setImmediate(r));+ t.mock.timers.tick(10_000);+ await settled;+ } finally {+ leave();+ }+ assert.equal((runtime.raised[0] as Error).name, "AbortError");+ assert.ok(runtime.raised[1] instanceof PinnedChatsBlockedError);+ assert.deepEqual(runtime.toasted, []);+ assert.deepEqual(server.pins, []);+});++test("the same pin failures still toast outside an update", async () => {+ const server = pinsServer();+ const runtime = pinRuntime();+ await queueTwoEditsWhileDown(runtime, server);+ assert.ok(runtime.raised.length > 0);+ assert.equal(runtime.toasted.length, runtime.raised.length);+});