Comfy-Org / Comfy-Org/ComfyUI_frontend
Re-lift surfacedNodeErrors when graph becomes ready (mid-load node_errors batches)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
In `src/stores/executionErrorStore.ts`, the `surfacedNodeErrors` computed lifts `lastNodeErrors` to subgraph boundaries via `liftNodeErrorsToBoundary(app.rootGraph, lastNodeErrors.value)`, but only when `app.isGraphReady` is true, and its only reactive dependency is `lastNodeErrors`. `app.isGraphReady` is a plain (non-reactive) getter, and graph topology itself is non-reactive.
If a `node_errors` batch (e.g. from a WebSocket message, possibly a cloud WS reconnect replay) arrives while the graph is mid-load — i.e. during the `loadGraphData` await window, after `clean()` has emptied the graph but before `configure()` has rebuilt it — the computed evaluates eagerly (driven by the `flush: 'post'` flag-sync watcher in `useNodeErrorFlagSync`), finds `app.isGraphReady` false at that instant, and falls back to the raw un-lifted `lastNodeErrors`. Because the computed's cache key is only `lastNodeErrors`, it is never re-evaluated once graph configuration completes, so that batch's errors remain permanently un-lifted (pre-PR interior attribution) for the lifetime of that error state.
This "fails open" safely — no crash, and clearing behavior (`clearSimpleNodeErrors`, `clearSlotErrorsWithRangeCheck`) stays consistent because it keys off the raw `lastNodeErrors` record rather than the lifted view. However, boundary-linked interior errors delivered in that window will surface on the interior node instead of the subgraph host, which is the exact case this PR (#13542) is meant to fix.
## Affected area
- `src/stores/executionErrorStore.ts` — `surfacedNodeErrors` computed (uses `liftNodeErrorsToBoundary` from `src/core/graph/subgraph/liftNodeErrorsToBoundary.ts`)
- `src/composables/graph/useNodeErrorFlagSync.ts` — consumes `surfacedNodeErrors` via a `flush: 'post'` watcher
## Suggested fix direction
Add a reactive graph-ready/graph-version signal to the `surfacedNodeErrors` computed's dependencies (or trigger a re-lift when the graph transitions to ready), so that a `node_errors` batch received before the graph finished loading gets re-lifted once `app.isGraphReady` becomes true / graph configuration completes, instead of being cached un-lifted indefinitely.
## Acceptance criteria
- A `node_errors` batch that arrives while `app.isGraphReady` is false does not permanently skip boundary lifting.
- `surfacedNodeErrors` re-computes and correctly lifts boundary-linked interior errors once the graph becomes ready after such a batch.
- No regression to existing lift/clear behavior once the graph is stable.
## References
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13542
- Discussion: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13542#discussion_r3564186610
- Requested by: @jaeone94
Contributor guide
Assessment
This issue has not been assessed yet.