Skip to content

[backport cloud/1.48] fix(workflow): repair the A1111 import lifecycle and report broken installs accurately - #14749

Merged
comfy-pr-bot merged 1 commit into
cloud/1.48from
backport-14556-to-cloud-1.48
Aug 5, 2026
Merged

comfy-pr-bot merged 1 commit into
cloud/1.48from
backport-14556-to-cloud-1.48

Conversation

@comfy-pr-bot

Copy link
Copy Markdown
Member

Backport of #14556 to cloud/1.48

Automatically created by backport workflow.

…stalls accurately (#14556)

Splits out of #14251. Five lifecycle fixes on the A1111 image-import
path. 30 production lines.

## What

Dropping an A1111-generated PNG parses its `parameters` string and
builds a ComfyUI graph from it. The path had four defects that only show
up when something goes wrong, plus one that shows up always:

1. **`afterLoadNewGraph` was not awaited.** It suspends before the
active workflow is reassigned, so `rootGraph.serialize()` on the next
line captured the *outgoing* graph — the new tab was born dirty against
a stale baseline.
2. **A rejection escaped an async DOM handler.** `importA1111` awaits
`api.getEmbeddings()`, which does not check `resp.ok`. On a 500 with an
HTML body it throws, `fileInput.value = ''` never runs, the input still
holds the file, re-selecting it fires no `change` event, and Open
silently does nothing on every retry. Now: `try`/`catch` with a toast,
`finally` resets the input.
3. **Two identical alerts for one file.** The invalid-structure `else`
and the parse `catch` each called `showErrorOnFileLoad`, then fell
through to the final call at the end of `handleFile`. Those two are the
`else` and `catch` of one `try`, so the maximum is two alerts, not
three.
4. **`beforeLoadNewGraph()` ran before an import that might bail.** It
calls `domWidgetStore.clear()`, and nothing re-registers on a bail path
— a workflow with a multiline prompt on screen lost its DOM widget
overlays when the user dropped a PNG that did not parse. It now runs
immediately before the mutation, and the A1111 path gets the subgraph
guard `clean()` already had.
5. **No message at all when required node types are unavailable, and
silent corruption of the open workflow.** `importA1111` logged to the
console and returned `void`. Because the call was unawaited,
`afterLoadNewGraph` then registered the user's *unchanged* graph under
the dropped file's name, after `beforeLoadNewGraph` had already cleared
`domWidgetStore`. See below.

## The message

The seven types this importer needs — `CheckpointLoaderSimple`,
`CLIPSetLastLayer`, `CLIPTextEncode`, `KSampler`, `EmptyLatentImage`,
`VAEDecode`, `SaveImage` — are all **core nodes**, as are `LoraLoader`
and the hires chain. Their absence does not mean a node pack is missing.
It means the backend did not load, or the install is broken.

So this path deliberately writes nothing to the missing-node panel: no
card, no entry, no placeholder. A type that was never added to the graph
does not belong in a list of nodes missing *from the graph*, and naming
the individual types would read as "install this pack" and send people
looking for something that does not exist.

```
"Could not load the workflow because this ComfyUI installation is missing core nodes.
 Check that the backend started correctly."
```

`importA1111` returns `Promise<'imported' | 'not-a1111' |
'core-nodes-unavailable'>` — three string literals, replacing
`Promise<boolean>`. The boolean could not distinguish "bailed and
already told the user" from "bailed silently", which is how an ordinary
A1111 PNG could vanish with no feedback at all: A1111 omits the
`Negative prompt:` line entirely when the negative prompt is empty.

The `core-nodes-unavailable` return happens **before** the graph is
touched, so a failed import leaves the open workflow intact.
`pnginfo.test.ts` asserts that directly.

## What this deliberately does not do

`pnginfo.ts` is **+8 −4**, with zero re-indentation (`git diff` and `git
diff -w` report the same line count). The nesting in that file is not
pretty and it is not this PR's business. An earlier revision
restructured it; that diff was 759 lines, ~72% of it re-indentation, and
none of it fixed a bug. If it deserves a refactor it deserves a PR where
a reviewer sees only that.

## Verification

6 unit tests across `app.test.ts`, `pnginfo.test.ts` and `ui.test.ts`,
each mutation-proved. typecheck, lint, format, knip clean. Full unit
suite: only pre-existing timeout flakes, confirmed by re-running the
same files at the merge base and getting byte-identical results.

## Related

- Follow-up to #14251 (closed)
- Independent of #14555 and of the narrow submission fix — no ordering
constraint
@comfy-pr-bot comfy-pr-bot added the backport Backporting a PR onto a release candidate label Aug 5, 2026
@comfy-pr-bot
comfy-pr-bot enabled auto-merge (squash) August 5, 2026 02:56
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 5, 2026
@dosubot

dosubot Bot commented Aug 5, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about ComfyUI_frontend Add Dosu to your team

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright: ✅ 1760 passed, 0 failed · 4 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1739 / ❌ 0 / ⚠️ 4 / ⏭️ 5)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 08/05/2026, 02:58:07 AM UTC

Links

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🎨 Storybook: 🚧 Building...

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/scripts/pnginfo.ts 87.50% 1 Missing ⚠️
@@              Coverage Diff              @@
##             cloud/1.48   #14749   +/-   ##
=============================================
  Coverage              ?   69.48%           
=============================================
  Files                 ?     1662           
  Lines                 ?    85960           
  Branches              ?    22975           
=============================================
  Hits                  ?    59731           
  Misses                ?    26120           
  Partials              ?      109           
Flag Coverage Δ
unit 69.48% <95.65%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scripts/app.ts 33.40% <100.00%> (ø)
src/scripts/ui.ts 38.43% <100.00%> (ø)
src/scripts/pnginfo.ts 66.88% <87.50%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@comfy-pr-bot
comfy-pr-bot merged commit 197a948 into cloud/1.48 Aug 5, 2026
75 checks passed
@comfy-pr-bot
comfy-pr-bot deleted the backport-14556-to-cloud-1.48 branch August 5, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Backporting a PR onto a release candidate size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants