From d74a73d31abcd07b24f49df98faafb08f9312bcf Mon Sep 17 00:00:00 2001 From: ShihChi Huang Date: Tue, 17 Nov 2026 01:32:43 +0000 Subject: [PATCH] fix: explain missing model loaders in the Cloud check (#23517) ## ELI5 When ComfyUI needs a node pack to check a workflow for Cloud, it now tells you which node needs the pack and what to do next. ## Motivation A workflow with a model loader from an uninstalled node pack can fail the Cloud compatibility check before ComfyUI sends a request. The generic retry message makes it hard to tell that the user can resolve this by installing the pack that provides the loader. ## Provenance - **Authored by:** interactive session - **Verified:** - 119 focused tests passed across 13 files, including the missing loader result and the message shown by the Cloud button. - Changed files passed formatting and whitespace checks. - Desktop verification of the updated message is pending. ## Reviewer context - **Type:** bug fix for the Cloud compatibility message. ## Summary - Carry the unrecognized model loader's node type to the existing error toast. - Name the node and tell the user to install the pack that provides it. ## Test plan - [ ] Open a workflow with a model loader from a missing node pack and click Run on Comfy Cloud. Verify that the message names the loader and gives the installation step. - [ ] Open a compatible workflow and verify that the Cloud dialog opens. --------- Co-authored-by: huang47 <157390+huang47@users.noreply.github.com> --- src/components/CloudButton.test.ts | 16 ++++++++++++++++ src/components/CloudButton.vue | 8 +++++++- src/locales/en/main.json | 3 ++- .../openOnCloud/cloudCompatibilityApi.test.ts | 7 +++++-- .../openOnCloud/cloudCompatibilityApi.ts | 19 +++++++++++++------ .../openOnCloud/cloudWorkflowCheck.ts | 11 ++++++++--- .../stores/cloudWorkflowCheckStore.ts | 12 ++++++++---- 7 files changed, 59 insertions(+), 17 deletions(-) diff --git a/src/components/CloudButton.test.ts b/src/components/CloudButton.test.ts index e127c9d3fea..4c035d9383e 100644 --- a/src/components/CloudButton.test.ts +++ b/src/components/CloudButton.test.ts @@ -249,6 +249,22 @@ describe('Cloud button compatibility checks', () => { expect(checkCloudCompatibility).toHaveBeenCalledTimes(2) }) + it('names the missing model loader and explains how to continue', async () => { + vi.mocked(checkCloudCompatibility).mockResolvedValue({ + kind: 'unreadableModelLoader', + nodeType: 'ImpactCheckpointLoader' + }) + render(CloudButton, { global: { plugins: [testI18n] } }) + + await userEvent.setup().click(screen.getByTestId('cloud-button')) + + await waitFor(() => + expect(useToast().toasts.map((toast) => toast.title)).toContain( + 'Could not read the model settings for ImpactCheckpointLoader. Install the node pack that provides it, then try again.' + ) + ) + }) + it('opens the dialog when Cloud is missing nodes or models', async () => { vi.mocked(checkCloudCompatibility).mockResolvedValue({ kind: 'missing', diff --git a/src/components/CloudButton.vue b/src/components/CloudButton.vue index c376244ceac..3687b574457 100644 --- a/src/components/CloudButton.vue +++ b/src/components/CloudButton.vue @@ -56,7 +56,13 @@ function prefetch() { function showModal() { const current = check.value if (current.phase === 'failed') { - toast.error(t('openOnCloud.checkFailed')) + toast.error( + current.nodeType + ? t('openOnCloud.missingLocalModelLoader', { + nodeType: current.nodeType + }) + : t('openOnCloud.checkFailed') + ) return } void openRunOnCloudDialog(() => isMounted && check.value === current) diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 28b66840ebc..b1106a08b5a 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -4185,7 +4185,8 @@ "title": "Missing {count} model | Missing {count} models", "unavailable": "Add these models to Comfy Cloud to run this workflow. Uploads from this ComfyUI are currently unavailable." }, - "checkFailed": "Could not check this workflow on Comfy Cloud. Try again." + "checkFailed": "Could not check this workflow on Comfy Cloud. Try again.", + "missingLocalModelLoader": "Could not read the model settings for {nodeType}. Install the node pack that provides it, then try again." }, "selectionToolbox": { "executeButton": { diff --git a/src/platform/openOnCloud/cloudCompatibilityApi.test.ts b/src/platform/openOnCloud/cloudCompatibilityApi.test.ts index dc801975dd6..92c34369cd6 100644 --- a/src/platform/openOnCloud/cloudCompatibilityApi.test.ts +++ b/src/platform/openOnCloud/cloudCompatibilityApi.test.ts @@ -240,7 +240,7 @@ describe(checkCloudCompatibility, () => { expect(requestBody().node_types).toEqual(['ImpactWildcard', 'KSampler']) }) - it('returns no verdict when a loader that is not installed locally picked a model', async () => { + it('identifies a missing local loader that prevents the Cloud check', async () => { const missing = new LGraphNode('ImpactCheckpointLoader') missing.last_serialization = fromPartial({ type: 'ImpactCheckpointLoader', @@ -248,7 +248,10 @@ describe(checkCloudCompatibility, () => { }) workflowHas(missing) - await expect(checkCloudCompatibility()).resolves.toBeNull() + await expect(checkCloudCompatibility()).resolves.toEqual({ + kind: 'unreadableModelLoader', + nodeType: 'ImpactCheckpointLoader' + }) expect(fetch).not.toHaveBeenCalled() }) diff --git a/src/platform/openOnCloud/cloudCompatibilityApi.ts b/src/platform/openOnCloud/cloudCompatibilityApi.ts index dedfea917ac..abe50f8719c 100644 --- a/src/platform/openOnCloud/cloudCompatibilityApi.ts +++ b/src/platform/openOnCloud/cloudCompatibilityApi.ts @@ -18,7 +18,7 @@ import { useModelStore } from '@/stores/modelStore' import { useModelToNodeStore } from '@/stores/modelToNodeStore' import { isModelFileName } from '@/platform/workflowErrors/missingModel/missingModelScan' import { matchesWidgetName } from '@/utils/widgetBinding' -import type { CloudWorkflowVerdict } from '@/platform/openOnCloud/cloudWorkflowCheck' +import type { CloudWorkflowCheckResult } from '@/platform/openOnCloud/cloudWorkflowCheck' const LINKED = Symbol('linked') @@ -192,7 +192,6 @@ async function resolveUnmapped( async function collectModels( nodes: CheckedNode[] ): Promise { - if (nodes.some((node) => node.hasUnreadableModels)) return null const { mapped, unmapped, hasLinkedModelInput } = scanModelInputs(nodes) if (hasLinkedModelInput) return null const resolved = await resolveUnmapped(unmapped) @@ -203,8 +202,9 @@ async function collectModels( return [...models.values()] } -async function postCompatibilityCheck(): Promise { - const nodes = checkedNodes(app.rootGraph) +async function postCompatibilityCheck( + nodes: CheckedNode[] +): Promise { const models = await collectModels(nodes) if (!models) return null const nodeTypes = [...new Set(nodes.map((node) => node.class_type))] @@ -229,10 +229,17 @@ function giveUp(cause: unknown): null { } /** Resolves null when no verdict is available. */ -export async function checkCloudCompatibility(): Promise { +export async function checkCloudCompatibility(): Promise { let body: unknown try { - const response = await postCompatibilityCheck() + const nodes = checkedNodes(app.rootGraph) + const unreadableLoader = nodes.find((node) => node.hasUnreadableModels) + if (unreadableLoader) + return { + kind: 'unreadableModelLoader', + nodeType: unreadableLoader.class_type + } + const response = await postCompatibilityCheck(nodes) if (!response) return null if (!response.ok) return giveUp( diff --git a/src/platform/openOnCloud/cloudWorkflowCheck.ts b/src/platform/openOnCloud/cloudWorkflowCheck.ts index 49fb515045c..6707cdbd510 100644 --- a/src/platform/openOnCloud/cloudWorkflowCheck.ts +++ b/src/platform/openOnCloud/cloudWorkflowCheck.ts @@ -9,16 +9,21 @@ export type CloudWorkflowVerdict = | { kind: 'canOpen' } | { kind: 'missing'; gaps: CloudWorkflowGaps } +export type CloudWorkflowCheckResult = + | CloudWorkflowVerdict + | { kind: 'unreadableModelLoader'; nodeType: string } + | null + export type CloudWorkflowCheckState = | { phase: 'idle' } | { phase: 'checking'; run: number } - | { phase: 'failed' } + | { phase: 'failed'; nodeType?: string } | { phase: 'answered'; verdict: CloudWorkflowVerdict } export type CloudWorkflowCheckEvent = | { type: 'invalidated' } | { type: 'started'; run: number } - | { type: 'failed'; run: number } + | { type: 'failed'; run: number; nodeType?: string } | { type: 'answered'; run: number; verdict: CloudWorkflowVerdict } export function reduceCloudWorkflowCheck( @@ -32,7 +37,7 @@ export function reduceCloudWorkflowCheck( return { phase: 'checking', run: event.run } case 'failed': return state.phase === 'checking' && state.run === event.run - ? { phase: 'failed' } + ? { phase: 'failed', nodeType: event.nodeType } : state case 'answered': return state.phase === 'checking' && state.run === event.run diff --git a/src/platform/openOnCloud/stores/cloudWorkflowCheckStore.ts b/src/platform/openOnCloud/stores/cloudWorkflowCheckStore.ts index f58e2793a60..1aa7a0aeafb 100644 --- a/src/platform/openOnCloud/stores/cloudWorkflowCheckStore.ts +++ b/src/platform/openOnCloud/stores/cloudWorkflowCheckStore.ts @@ -26,10 +26,14 @@ export const useCloudWorkflowCheckStore = defineStore( async function check(): Promise { const run = ++lastRun dispatch({ type: 'started', run }) - const verdict = await checkCloudCompatibility() - dispatch( - verdict ? { type: 'answered', run, verdict } : { type: 'failed', run } - ) + const result = await checkCloudCompatibility() + if (result?.kind === 'unreadableModelLoader') { + dispatch({ type: 'failed', run, nodeType: result.nodeType }) + } else if (result) { + dispatch({ type: 'answered', run, verdict: result }) + } else { + dispatch({ type: 'failed', run }) + } } function invalidate() {