Repository navigation
feat: Extension V2 API proposal — NodeHandle/WidgetHandle with ECS bridge - #11251
christian-byrne wants to merge 3 commits into
Conversation
…idge
Model the new extension API in code rather than docs:
- extensionV2.ts: Public types (NodeHandle, WidgetHandle, branded entity IDs,
defineNodeExtension/defineWidgetExtension)
- extensionV2Service.ts: Bridge layer that wraps LGraphNode/IBaseWidget in the
stable NodeHandle/WidgetHandle interfaces, with EffectScope-based lifecycle
management per extension+entity pair
- Three core extensions converted as proof-of-concept:
- previewAny.v2.ts (90 lines prototype patching -> 49 lines clean)
- dynamicPrompts.v2.ts
- imageCrop.v2.ts
This is pseudocode-grade -- it typechecks but is not wired into the app.
The bridge reads from LGraphNode directly; once ADR 0008 ECS World
exists, internals swap to World.getComponent() while NodeHandle stays
identical.
Key decisions modeled:
- Events over signals (node.on('executed', fn) not effect/derived)
- getValue/setValue over .value (widget.getValue() dispatches commands)
- nodeTypes filter over beforeRegisterNodeDef (no prototype patching)
- Automatic scope cleanup on entity removal
🎨 Storybook: ✅ Built — View Storybook |
🎭 Playwright: 🕵🏻 0 passed, 0 failed📊 Browser Reports
|
📝 WalkthroughWalkthroughAdds a new Extension V2 system: typed API surface and runtime bridge that mounts per-node extension scopes and exposes NodeHandle/WidgetHandle APIs, plus three core node extensions implemented against the v2 API (DynamicPrompts.V2, ImageCrop.V2, PreviewAny.V2). Changes
Sequence Diagram(s)sequenceDiagram
participant Legacy as LegacySystem
participant Service as ExtensionV2Service
participant Scope as EffectScope
participant Extension as RegisteredExtension
participant Node as NodeHandle/WidgetHandle
Legacy->>Service: node created / node loaded
Service->>Scope: create or reuse scope for (extension+node)
Service->>Node: wrap ECS entity into NodeHandle/WidgetHandle
Service->>Extension: invoke nodeCreated/loadedGraphNode(handle)
Extension->>Node: query widgets, set handlers, add widgets, set serialize hooks
Node->>Legacy: emit ECS commands (add widget, set size, set value)
Legacy->>Service: node executed / events
Service->>Extension: forward events via handle callbacks
Legacy->>Service: node removed
Service->>Scope: stop & dispose scope, cleanup handlers
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
📦 Bundle Size
⚡ Performance
|
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #11251 +/- ##
=======================================
Coverage ? 43.63%
=======================================
Files ? 1354
Lines ? 69399
Branches ? 19214
=======================================
Hits ? 30279
Misses ? 38521
Partials ? 599
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/extensions/core/previewAny.v2.ts`:
- Around line 18-35: Replace hardcoded user-facing labels for the preview
widgets with i18n lookups: add entries for "Preview", "Markdown", and
"Plaintext" to src/locales/en/main.json, then import/use the composition API
i18n in this module (useI18n) and call t('...') to supply the label strings
where you create the widgets (e.g., markdown.setLabel(...),
plaintext.setLabel(...), and the toggle widget options labelOn/labelOff). Ensure
keys are descriptive (e.g., preview.label, preview.mode.markdown,
preview.mode.plaintext) and update the widget creation to use t('...') instead
of hardcoded literals.
In `@src/services/extensionV2Service.ts`:
- Around line 291-293: The defineWidgetExtension function currently just pushes
to widgetExtensions and silently no-ops; update it to either (A) wire the widget
lifecycle dispatch so registrations are consumed (e.g., call the registry
initialization/dispatch function from the service startup flow and ensure
defineWidgetExtension registers with that dispatcher), or (B) until lifecycle
wiring is implemented, change defineWidgetExtension to throw a clear, actionable
error (e.g., "Widget extensions are not supported yet; wiring missing") so
authors get immediate feedback; reference the defineWidgetExtension function,
the widgetExtensions array, and WidgetExtensionOptions when making the change.
- Around line 76-138: createWidgetHandle currently creates a new WidgetHandle
and listeners record each call (allocating a new WidgetEntityId via nextEntityId
and new listeners), which breaks stable-handle semantics and event delivery;
change createWidgetHandle to cache and return a single WidgetHandle per
IBaseWidget (use a WeakMap<IBaseWidget, WidgetHandle>) so identity and the
listeners set are reused, ensure setValue notifies listeners on that shared
registry, and when wiring the legacy widget.callback in createWidgetHandle
capture the old value before invoking origCallback so the bridged 'change'
handlers receive the pre-callback old value.
- Around line 299-315: dispatchNodeCreated currently runs extension callbacks
without isolation so one extension error aborts the loop; wrap each extension
invocation in its own try/catch so a thrown error from ext.nodeCreated does not
stop other extensions. Specifically, inside the loop over nodeExtensions (where
you call getNodeEntityId, getOrCreateScope, scope.run, createNodeHandle and
ext.nodeCreated) catch errors around the ext.nodeCreated invocation, log or
surface an error that includes ext.name and the node type/comfyClass (and the
entityId if helpful), and then continue to the next extension. Apply the
identical per-extension try/catch pattern to dispatchLoadedGraphNode around
ext.nodeLoaded (and any analogous createNodeHandle/scope.run code) so failures
are isolated per extension.
- Around line 158-177: The bridge advertises NodeHandle.on() events
("connected"/"disconnected") it never emits and also returns unstable
SlotEntityId values from inputs()/outputs(); fix by either fully implementing
LiteGraph connection lifecycle wiring (hook the node's connection/ disconnection
callbacks and dispatch listeners['connected']/listeners['disconnected'], using
the same pattern as node.onRemoved/node.onExecuted/node.onConfigure and calling
disposeScope(extensionName, entityId) where appropriate) or by shrinking the
public contract to remove "connected"/"disconnected" from NodeHandle.on() until
implemented; additionally make inputs() and outputs() return stable SlotEntityId
values by caching/memoizing SlotEntityId per slot (store them on the node or in
a map keyed by extensionName+entityId+slot index/name) so the same ID is
returned across calls and can be correlated in callbacks.
- Around line 92-103: The listed setters (setValue, setHidden, setPosition,
setMode, setProperty, addWidget — and the same patterns around lines 207–253)
currently mutate LiteGraph state directly; change them to use the command
pattern instead: have each setter construct and dispatch a serializable command
object (e.g., via a commandDispatcher/commandBus or an existing executeCommand
API) that describes the mutation (type, target id, payload) so changes are
undoable/replayable/CRDT-safe; if the command bridge isn’t available yet,
replace the direct mutations with explicit stubs that either dispatch a
NoOp/QueuedCommand or throw/log a clear “use-command-pattern” error so extension
authors cannot mutate state imperatively. Ensure the unique function names above
are updated to create/dispatch commands rather than writing to widget.*
directly.
- Line 82: Replace the untyped listeners map and the casted on(...)
implementation with properly typed event maps and overloads: define specific
event-map types (e.g., WidgetEventMap and NodeEventMap) mapping event name
literals to their callback signatures, change listeners from Record<string,
Set<Function>> to something like Partial<Record<keyof WidgetEventMap | keyof
NodeEventMap, Set<...>>> (or separate maps per handle), and implement the on
method overloads on WidgetHandle and NodeHandle to add callbacks into the
correctly-typed Set for that event instead of using as never/as NodeHandle['on']
casts; update all usages (listeners variable, NodeHandle and WidgetHandle on
overloads, and the event dispatch logic around lines mentioned) so emitted
events use the event map types to invoke callbacks with the correct argument
types.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 64eecbf7-5a80-4500-91c5-43b7cb088c8f
📒 Files selected for processing (5)
src/extensions/core/dynamicPrompts.v2.tssrc/extensions/core/imageCrop.v2.tssrc/extensions/core/previewAny.v2.tssrc/services/extensionV2Service.tssrc/types/extensionV2.ts
| const markdown = node.addWidget('MARKDOWN', 'preview_markdown', '', { | ||
| hidden: true, | ||
| readonly: true, | ||
| serialize: false | ||
| }) | ||
| markdown.setLabel('Preview') | ||
|
|
||
| const plaintext = node.addWidget('STRING', 'preview_text', '', { | ||
| multiline: true, | ||
| readonly: true, | ||
| serialize: false | ||
| }) | ||
| plaintext.setLabel('Preview') | ||
|
|
||
| const toggle = node.addWidget('BOOLEAN', 'previewMode', false, { | ||
| labelOn: 'Markdown', | ||
| labelOff: 'Plaintext' | ||
| }) |
There was a problem hiding this comment.
Localize the new widget labels.
'Preview', 'Markdown', and 'Plaintext' are new user-facing strings in a src/**/*.ts module, so hardcoding them here skips vue-i18n and leaves the V2 widget UI untranslated. Please move them to src/locales/en/main.json and read them through the project's i18n API. As per coding guidelines, "Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json" and "Use vue-i18n for ALL user-facing strings".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/extensions/core/previewAny.v2.ts` around lines 18 - 35, Replace hardcoded
user-facing labels for the preview widgets with i18n lookups: add entries for
"Preview", "Markdown", and "Plaintext" to src/locales/en/main.json, then
import/use the composition API i18n in this module (useI18n) and call t('...')
to supply the label strings where you create the widgets (e.g.,
markdown.setLabel(...), plaintext.setLabel(...), and the toggle widget options
labelOn/labelOff). Ensure keys are descriptive (e.g., preview.label,
preview.mode.markdown, preview.mode.plaintext) and update the widget creation to
use t('...') instead of hardcoded literals.
There was a problem hiding this comment.
agreed on the i18n gap for 'Preview'/'Markdown'/'Plaintext', though this file (src/extensions/core/*) is eslint-ignored per eslint.config.ts:77 so the i18n-lint check itself won't catch it — worth fixing anyway since it's user-facing. Same landing blocker as the sibling extensionV2Service.ts findings: I can't commit to this branch without pnpm typecheck passing, and extensionV2Service.ts currently fails typecheck on the pre-existing @/ecs/* phantom imports (intentional per 2f8fe0013b's message). Leaving this one for whoever resolves the @/ecs/* stub question.
There was a problem hiding this comment.
@christian-byrne, thanks for the clarification. The localization finding remains valid, but the @/ecs/* typecheck blocker prevents a safe fix in this draft PR.
Please create a follow-up after the ECS stub question is resolved. If you want, I can open a GitHub issue that tracks both the typecheck prerequisite and the deferred localization in src/extensions/core/previewAny.v2.ts.
✏️ Learnings added
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/extensions/core/previewAny.v2.ts:18-35
Timestamp: 2026-09-02T16:52:29.104Z
Learning: In pull request `#11251`, `src/extensions/core/*` is ESLint-ignored by `eslint.config.ts` Line 77, so its i18n lint rule does not detect user-facing strings. The `src/extensions/core/previewAny.v2.ts` labels still require vue-i18n localization when the Extension V2 typecheck blocker is resolved.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
You are interacting with an AI system.
| ): WidgetHandle { | ||
| const entityId = nextEntityId++ as WidgetEntityId | ||
|
|
||
| const listeners: Record<string, Set<Function>> = {} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n '\bFunction\b|as NodeHandle\[|as WidgetHandle\[|as never' src/services/extensionV2Service.tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 467
🏁 Script executed:
#!/bin/bash
# Get file size and context around the flagged lines
wc -l src/services/extensionV2Service.ts
echo "---"
# Show the full context of listener maps and type definitions
sed -n '70,160p' src/services/extensionV2Service.tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 2447
🏁 Script executed:
#!/bin/bash
# Find NodeHandle and WidgetHandle type definitions
rg -n 'type NodeHandle|interface NodeHandle|type WidgetHandle|interface WidgetHandle' --type tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 187
🏁 Script executed:
#!/bin/bash
# Search for how 'on' method is defined in NodeHandle/WidgetHandle
fd -e ts -e d.ts | xargs grep -l 'NodeHandle\|WidgetHandle' | head -5Repository: Comfy-Org/ComfyUI_frontend
Length of output: 249
🏁 Script executed:
#!/bin/bash
# View the interface definitions for WidgetHandle and NodeHandle
cat -n src/types/extensionV2.ts | sed -n '55,120p'Repository: Comfy-Org/ComfyUI_frontend
Length of output: 2592
🏁 Script executed:
#!/bin/bash
# Check the rest of NodeHandle definition and see more of the createNodeHandle implementation
cat -n src/types/extensionV2.ts | sed -n '118,145p'Repository: Comfy-Org/ComfyUI_frontend
Length of output: 1312
🏁 Script executed:
#!/bin/bash
# Check how the listeners are actually dispatched in createNodeHandle
sed -n '146,280p' src/services/extensionV2Service.ts | cat -nRepository: Comfy-Org/ComfyUI_frontend
Length of output: 4988
Use typed event maps to preserve the callback overload safety in the NodeHandle and WidgetHandle interfaces.
The implementation erases all type information by using Record<string, Set<Function>> plus an untyped on(event: string, fn: Function) method, then casting it as NodeHandle['on'] at line 276. This defeats the purpose of the overloaded interface signatures (lines 73–74 for WidgetHandle, lines 118–128 for NodeHandle), which promise event-specific callback types. At runtime, any callback can be dispatched to any event with mismatched arguments—for example, a listener registered for the 'removed' event (expects () => void) could be called with the output payload from 'executed'.
Define typed event maps for each handle (e.g., Record<'removed' | 'executed' | ..., Set<Callback<EventType>>>) and implement the on overloads properly instead of using as never and as NodeHandle['on'] casts. As per coding guidelines, "Use TypeScript for type safety".
Affected lines: 82, 118, 133, 146, 148, 175, 276.
🧰 Tools
🪛 ESLint
[error] 82-82: The Function type accepts any function-like value.
Prefer explicitly defining any function parameters and return type.
(@typescript-eslint/no-unsafe-function-type)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/extensionV2Service.ts` at line 82, Replace the untyped listeners
map and the casted on(...) implementation with properly typed event maps and
overloads: define specific event-map types (e.g., WidgetEventMap and
NodeEventMap) mapping event name literals to their callback signatures, change
listeners from Record<string, Set<Function>> to something like
Partial<Record<keyof WidgetEventMap | keyof NodeEventMap, Set<...>>> (or
separate maps per handle), and implement the on method overloads on WidgetHandle
and NodeHandle to add callbacks into the correctly-typed Set for that event
instead of using as never/as NodeHandle['on'] casts; update all usages
(listeners variable, NodeHandle and WidgetHandle on overloads, and the event
dispatch logic around lines mentioned) so emitted events use the event map types
to invoke callbacks with the correct argument types.
There was a problem hiding this comment.
the underlying Function-typed on(event: string, fn: Function) is a real @typescript-eslint/no-unsafe-function-type ESLint error today (confirmed live at lines 130 and 255), so that part isn't optional — it'll fail CI regardless of the broader typed-event-map question. The bigger ask (event-specific callback types instead of as never/as NodeHandle['on'] casts) is more of an API-surface decision than a bug fix though: WidgetHandle/NodeHandle in src/types/extensionV2.ts already declare the overloaded, correctly-typed on(...) signatures (lines 73-74, 118-128) — the implementation just doesn't honor them internally. Worth deciding whether the impl gets a real Record<EventName, Set<Callback>> map now (more churn, but type-safe end to end) or whether the untyped internal Function gets narrowed to a safe non-any shape (e.g. (...args: unknown[]) => void) as a smaller interim fix that still satisfies the linter without committing to the full typed-map refactor yet.
There was a problem hiding this comment.
@christian-byrne, agreed. The Function usages are a valid CI-blocking issue and should be fixed in this PR.
The typed event-map refactor is a separate API implementation decision. It is an improvement, but it is not required to resolve the ESLint error.
I will narrow this finding to require removal of Function from the internal listener storage and on(...) implementations. A full typed event-map implementation can remain optional for this prototype.
A direct replacement with (...args: unknown[]) => void needs care. Under function-parameter variance, it may not accept the narrower callbacks declared by the public overloads. The implementation should use a non-Function, non-any internal callback representation that remains compatible with those overloads.
✏️ Learnings added
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:0-0
Timestamp: 2026-09-02T16:52:56.743Z
Learning: In Comfy-Org/ComfyUI_frontend PR `#11251`, `src/services/extensionV2Service.ts` has current `typescript-eslint/no-unsafe-function-type` errors from internal `Function` listener types. Removing `Function` is required for CI. The broader refactor to event-specific typed listener maps is an optional API-surface improvement because `src/types/extensionV2.ts` already declares overloaded, event-specific `NodeHandle.on(...)` and `WidgetHandle.on(...)` signatures.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:17-23
Timestamp: 2026-09-02T16:52:23.983Z
Learning: In PR `#11251`, `src/services/extensionV2Service.ts` is a pseudocode-grade Extension V2 prototype with intentionally unresolved `@/ecs/*` imports. These imports make `pnpm typecheck` fail by design until ECS stubs or implementations exist, which also blocks normal pre-commit validation for changes to this file.
You are interacting with an AI system.
| export function defineWidgetExtension(options: WidgetExtensionOptions): void { | ||
| widgetExtensions.push(options) | ||
| } |
There was a problem hiding this comment.
defineWidgetExtension() currently fails silently.
This only appends to widgetExtensions; nothing ever dispatches that registry. Any extension author who adopts the exported API will get a quiet no-op. Please either wire the widget lifecycle before exposing this, or throw a clear unsupported error for now. As per coding guidelines, "Implement proper error handling" and "Provide user-friendly and actionable error messages".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/extensionV2Service.ts` around lines 291 - 293, The
defineWidgetExtension function currently just pushes to widgetExtensions and
silently no-ops; update it to either (A) wire the widget lifecycle dispatch so
registrations are consumed (e.g., call the registry initialization/dispatch
function from the service startup flow and ensure defineWidgetExtension
registers with that dispatcher), or (B) until lifecycle wiring is implemented,
change defineWidgetExtension to throw a clear, actionable error (e.g., "Widget
extensions are not supported yet; wiring missing") so authors get immediate
feedback; reference the defineWidgetExtension function, the widgetExtensions
array, and WidgetExtensionOptions when making the change.
There was a problem hiding this comment.
confirmed live — defineWidgetExtension() (now at line 296) only pushes to widgetExtensions, and nothing reads that array; startExtensionSystem()/mountExtensionsForNode() only walk nodeExtensions. So this is a real silent no-op for any extension author who calls it, not a stale finding from the earlier revision. Given this is a draft API proposal (per the file header, @/ecs/* doesn't exist yet), might be worth an explicit throw new Error('widget extensions are not wired up yet') for now rather than wiring the full widget lifecycle dispatch as part of this proposal pass — that keeps the no-op from being silent without committing to the widget-mount design before the node-mount design (this PR's actual subject) is settled. Deferring to whoever owns the widget-lifecycle wiring decision on whether that's the right interim shape.
There was a problem hiding this comment.
@christian-byrne, agreed. The explicit error is the correct interim shape for this draft.
defineWidgetExtension() should throw until the widget lifecycle has a defined mount and cleanup design. This prevents unsupported widget extensions from appearing to register successfully. It also avoids coupling this proposal to an unfinished lifecycle implementation.
The finding should remain open until that behavior is added.
✏️ Learnings added
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:295-297
Timestamp: 2026-09-02T16:52:57.719Z
Learning: In Comfy-Org/ComfyUI_frontend PR `#11251`, `src/services/extensionV2Service.ts` exposes `defineWidgetExtension()` before widget lifecycle dispatch exists. `widgetExtensions` is not consumed by `startExtensionSystem()` or `mountExtensionsForNode()`. Until widget lifecycle wiring is designed, `defineWidgetExtension()` should throw an actionable unsupported-feature error rather than silently register an extension.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:17-23
Timestamp: 2026-09-02T16:52:23.983Z
Learning: In PR `#11251`, `src/services/extensionV2Service.ts` is a pseudocode-grade Extension V2 prototype with intentionally unresolved `@/ecs/*` imports. These imports make `pnpm typecheck` fail by design until ECS stubs or implementations exist, which also blocks normal pre-commit validation for changes to this file.
You are interacting with an AI system.
| export function dispatchNodeCreated(node: LGraphNode): void { | ||
| const comfyClass = | ||
| (node.constructor as { comfyClass?: string }).comfyClass ?? '' | ||
|
|
||
| for (const ext of nodeExtensions) { | ||
| // Skip if this extension filters to specific types and this node isn't one | ||
| if (ext.nodeTypes && !ext.nodeTypes.includes(comfyClass)) continue | ||
| if (!ext.nodeCreated) continue | ||
|
|
||
| const entityId = getNodeEntityId(node) | ||
| const scope = getOrCreateScope(ext.name, entityId) | ||
|
|
||
| scope.run(() => { | ||
| const handle = createNodeHandle(node, ext.name) | ||
| ext.nodeCreated!(handle) | ||
| }) | ||
| } |
There was a problem hiding this comment.
Isolate extension callback failures during dispatch.
dispatchNodeCreated() and dispatchLoadedGraphNode() execute arbitrary extension code without a per-extension try/catch, so one thrown error aborts the rest of the loop and prevents unrelated extensions from initializing on that node. Catch per extension, include ext.name and node type in the error, and continue dispatching. As per coding guidelines, "Implement proper error handling" and "Provide user-friendly and actionable error messages".
Also applies to: 321-336
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/extensionV2Service.ts` around lines 299 - 315,
dispatchNodeCreated currently runs extension callbacks without isolation so one
extension error aborts the loop; wrap each extension invocation in its own
try/catch so a thrown error from ext.nodeCreated does not stop other extensions.
Specifically, inside the loop over nodeExtensions (where you call
getNodeEntityId, getOrCreateScope, scope.run, createNodeHandle and
ext.nodeCreated) catch errors around the ext.nodeCreated invocation, log or
surface an error that includes ext.name and the node type/comfyClass (and the
entityId if helpful), and then continue to the next extension. Apply the
identical per-extension try/catch pattern to dispatchLoadedGraphNode around
ext.nodeLoaded (and any analogous createNodeHandle/scope.run code) so failures
are isolated per extension.
There was a problem hiding this comment.
the target functions were renamed in cab3f218e2 — dispatchNodeCreated/dispatchLoadedGraphNode became mountExtensionsForNode(), but the underlying gap is unchanged: the loop at lines 322-337 calls hook(createNodeHandle(nodeId)) for every matching extension with no per-extension try/catch, so one extension throwing aborts mounting for every extension after it on that node. This one reads as a fairly mechanical fix (wrap the hook(...) call, catch, log with ext.name/comfyClass, continue) rather than an open design question — would land it as try { hook(createNodeHandle(nodeId)) } catch (err) { logger.error(...) } inside the loop, but leaving it here rather than pushing since I can't get a clean commit through pnpm typecheck on this file right now (see the reply on the pauseTracking thread for why).
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline src/services/extensionV2Service.ts --items all --type function --match 'mountExtensionsForNode|startExtensionSystem'
rg -n -C 4 '\bmountExtensionsForNode\s*\(' src/services/extensionV2Service.ts
rg -n -C 3 '\breportError\s*\(' src -g '*.ts' | head -n 160Length of output: 1539
🏁 Script executed:
#!/bin/bash
set -u
sed -n '300,360p' src/services/extensionV2Service.ts
echo
echo '--- telemetry module candidates ---'
fd -t f 'reportError\.ts$|telemetry' src 2>/dev/null || true
echo
echo '--- reportError call sites ---'
rg -n -C 3 '\breportError\s*\(' src -g '*.ts' || true
echo
echo '--- reportError imports ---'
rg -n -C 2 "from ['\"]`@/platform/telemetry/reportError`['\"]" src -g '*.ts' || trueLength of output: 2702
@christian-byrne, verified. mountExtensionsForNode() catches only to restore tracking in finally. It does not catch the extension error. Therefore, a thrown hook error still exits the loop and prevents later extensions from mounting.
The finding remains valid. The current source has no reportError() module or call site to reuse. Add a per-extension catch around hook(createNodeHandle(nodeId)), preserve resetTracking() in finally, and report the error with ext.name and comfyClass before continuing.
Thanks for the clarification about the renamed function and the intentional typecheck limitation.
✏️ Learnings added
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:0-0
Timestamp: 2026-09-02T16:53:31.474Z
Learning: In Comfy-Org/ComfyUI_frontend PR `#11251`, the former `dispatchNodeCreated()` and `dispatchLoadedGraphNode()` extension dispatch functions were replaced by `mountExtensionsForNode()` in `src/services/extensionV2Service.ts`. The function selects `loadedGraphNode` or `nodeCreated` and invokes each matching extension hook. `pauseTracking()` and `resetTracking()` currently run in a `try`/`finally`, but there is no per-extension `catch`; one throwing hook aborts mounting of later extensions for the same node.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:17-23
Timestamp: 2026-09-02T16:52:23.983Z
Learning: In PR `#11251`, `src/services/extensionV2Service.ts` is a pseudocode-grade Extension V2 prototype with intentionally unresolved `@/ecs/*` imports. These imports make `pnpm typecheck` fail by design until ECS stubs or implementations exist, which also blocks normal pre-commit validation for changes to this file.
You are interacting with an AI system.
Pretend the ECS world/command layer already exists. Import from @/ecs/world, @/ecs/commands, @/ecs/components, @/ecs/entityIds — these modules don't exist yet and this won't compile. The point: show what the service looks like when it uses World queries and command dispatches directly, with zero LGraphNode bridge code. NodeHandle/WidgetHandle interface unchanged.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/services/extensionV2Service.ts (1)
43-56: Scope cleanup mechanism is missing.The comment states scopes are "Disposed when entity is removed from the World," but there's no
disposeScope()function or World event listener to trigger cleanup. Without this, thescopeRegistryMap will grow unbounded as nodes are created and removed.Consider adding a cleanup function that the framework calls when an entity is removed:
export function disposeScope(extensionName: string, entityId: number): void { const key = `${extensionName}:${entityId}` const scope = scopeRegistry.get(key) if (scope) { scope.stop() scopeRegistry.delete(key) } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/services/extensionV2Service.ts` around lines 43 - 56, The scopeRegistry created for EffectScope instances via getOrCreateScope has no cleanup and will leak when entities are removed; add a disposeScope(extensionName: string, entityId: number) function that computes the same key, retrieves the EffectScope from scopeRegistry, calls scope.stop() (or scope.stop/stop/stop equivalent on EffectScope) and deletes the key, and wire that function into the World/entity removal lifecycle (subscribe the World remove event or call disposeScope from the code path that destroys entities) so scopes are properly stopped and removed from scopeRegistry.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/services/extensionV2Service.ts`:
- Around line 192-217: The lambda parameters in inputs() and outputs() need
explicit types to avoid implicit any: change the map callbacks to declare slotId
as SlotEntityId (e.g. map((slotId: SlotEntityId) => ...)) so TypeScript knows
the type when you call world.getComponent(slotId, SlotIdentity) and construct
the SlotInfo objects; ensure SlotEntityId remains imported and the rest of the
object literal still uses "satisfies SlotInfo" as before.
- Around line 168-177: The inline arrow callbacks in widget() and widgets() use
implicitly typed parameters (`id` and `widgetId`); update them to have explicit
types matching the element type of WidgetContainer.widgetIds (e.g. use the
project's WidgetId type or the array element type via
container.widgetIds[number]) so TypeScript can infer correctly — annotate the
find callback as (id: WidgetId) => ... and the map callback as (widgetId:
WidgetId) => createWidgetHandle(widgetId) (or use (id: typeof
container.widgetIds[number]) / (widgetId: typeof container.widgetIds[number]) if
no WidgetId alias exists).
- Around line 24-26: Remove the unused imports SlotConnection (from
'@/ecs/components') and SlotEntityId (from '@/ecs/entityIds') in
extensionV2Service.ts: update the import lists to omit those symbols so the
named import from '@/ecs/components' and the type import list only include
actually used items, preserving commas/formatting, then run the linter/tsc to
confirm no unused-import errors remain.
---
Nitpick comments:
In `@src/services/extensionV2Service.ts`:
- Around line 43-56: The scopeRegistry created for EffectScope instances via
getOrCreateScope has no cleanup and will leak when entities are removed; add a
disposeScope(extensionName: string, entityId: number) function that computes the
same key, retrieves the EffectScope from scopeRegistry, calls scope.stop() (or
scope.stop/stop/stop equivalent on EffectScope) and deletes the key, and wire
that function into the World/entity removal lifecycle (subscribe the World
remove event or call disposeScope from the code path that destroys entities) so
scopes are properly stopped and removed from scopeRegistry.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d65cde02-2593-4e9e-8246-efdb7ef57c58
📒 Files selected for processing (1)
src/services/extensionV2Service.ts
| SlotConnection | ||
| } from '@/ecs/components' | ||
| import type { NodeEntityId, WidgetEntityId, SlotEntityId } from '@/ecs/entityIds' |
There was a problem hiding this comment.
Remove unused imports.
SlotConnection and SlotEntityId are imported but never used. Remove them to satisfy linting and keep the import surface minimal.
-import {
- Position,
- Dimensions,
- NodeVisual,
- NodeType,
- Execution,
- WidgetValue,
- WidgetIdentity,
- WidgetContainer,
- Connectivity,
- SlotIdentity,
- SlotConnection
-} from '@/ecs/components'
-import type { NodeEntityId, WidgetEntityId, SlotEntityId } from '@/ecs/entityIds'
+import {
+ Position,
+ Dimensions,
+ NodeVisual,
+ NodeType,
+ Execution,
+ WidgetValue,
+ WidgetIdentity,
+ WidgetContainer,
+ Connectivity,
+ SlotIdentity
+} from '@/ecs/components'
+import type { NodeEntityId, WidgetEntityId } from '@/ecs/entityIds'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| SlotConnection | |
| } from '@/ecs/components' | |
| import type { NodeEntityId, WidgetEntityId, SlotEntityId } from '@/ecs/entityIds' | |
| import { | |
| Position, | |
| Dimensions, | |
| NodeVisual, | |
| NodeType, | |
| Execution, | |
| WidgetValue, | |
| WidgetIdentity, | |
| WidgetContainer, | |
| Connectivity, | |
| SlotIdentity | |
| } from '@/ecs/components' | |
| import type { NodeEntityId, WidgetEntityId } from '@/ecs/entityIds' |
🧰 Tools
🪛 ESLint
[error] 24-24: 'SlotConnection' is defined but never used.
(unused-imports/no-unused-imports)
[error] 25-25: Unable to resolve path to module '@/ecs/components'.
(import-x/no-unresolved)
[error] 26-26: 'SlotEntityId' is defined but never used.
(unused-imports/no-unused-imports)
🪛 GitHub Check: collect
[failure] 26-26:
Cannot find module '@/ecs/entityIds' or its corresponding type declarations.
[failure] 26-26:
'SlotEntityId' is declared but never used.
[failure] 25-25:
Cannot find module '@/ecs/components' or its corresponding type declarations.
[failure] 24-24:
'SlotConnection' is declared but its value is never read.
🪛 GitHub Check: scan
[failure] 26-26:
Cannot find module '@/ecs/entityIds' or its corresponding type declarations.
[failure] 26-26:
'SlotEntityId' is declared but never used.
[failure] 25-25:
Cannot find module '@/ecs/components' or its corresponding type declarations.
[failure] 24-24:
'SlotConnection' is declared but its value is never read.
🪛 GitHub Check: validate-fonts
[failure] 26-26:
Cannot find module '@/ecs/entityIds' or its corresponding type declarations.
[failure] 26-26:
'SlotEntityId' is declared but never used.
[failure] 25-25:
Cannot find module '@/ecs/components' or its corresponding type declarations.
[failure] 24-24:
'SlotConnection' is declared but its value is never read.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/extensionV2Service.ts` around lines 24 - 26, Remove the unused
imports SlotConnection (from '@/ecs/components') and SlotEntityId (from
'@/ecs/entityIds') in extensionV2Service.ts: update the import lists to omit
those symbols so the named import from '@/ecs/components' and the type import
list only include actually used items, preserving commas/formatting, then run
the linter/tsc to confirm no unused-import errors remain.
There was a problem hiding this comment.
note this conflicts with the sibling suggestion on the inputs()/outputs() thread (r3083931615), which needs SlotEntityId kept as the explicit lambda parameter type for the slotId implicit-any fix. Removing it here would just reintroduce that error. The two threads should be resolved together: drop only the truly-unused SlotConnection, keep SlotEntityId and give it the explicit annotation the other thread asks for.
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file='src/services/extensionV2Service.ts'
ast-grep outline "$file" --items all --type function --view expanded
printf '\n--- imports and handle methods ---\n'
rg -n -A8 -B3 \
"SlotConnection|SlotEntityId|inputs\s*[:(]|outputs\s*[:(]|slotId" \
"$file"Length of output: 2279
@christian-byrne, confirmed. The current inputs() and outputs() callbacks have untyped slotId parameters on Lines 229 and 242.
The combined fix should remove only SlotConnection and retain SlotEntityId:
conn.inputSlotIds.map((slotId: SlotEntityId) => {conn.outputSlotIds.map((slotId: SlotEntityId) => {This makes SlotEntityId used and resolves the implicit-any issue. The original suggestion to remove SlotEntityId should not be applied independently.
✏️ Learnings added
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:0-0
Timestamp: 2026-09-02T16:53:43.641Z
Learning: In ComfyUI_frontend PR `#11251`, `src/services/extensionV2Service.ts` must retain the `SlotEntityId` type import because `createNodeHandle` uses it to explicitly type the `slotId` callback parameters in both `inputs()` and `outputs()`. Remove `SlotConnection` if it is unused, but do not remove `SlotEntityId` as part of that cleanup.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 15443
File: docs/adr/0008-entity-component-system.md:22-24
Timestamp: 2026-08-20T19:30:30.807Z
Learning: In ComfyUI frontend entity and Pinia store code, use the established identity type for each concern: branded numbers for most entity IDs, number-or-string IDs for nodes, UUID strings for graphs, and composite string keys such as WidgetId for scoped entities. Do not introduce a new ID representation when an established store-specific type exists.
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:17-23
Timestamp: 2026-09-02T16:52:23.983Z
Learning: In PR `#11251`, `src/services/extensionV2Service.ts` is a pseudocode-grade Extension V2 prototype with intentionally unresolved `@/ecs/*` imports. These imports make `pnpm typecheck` fail by design until ECS stubs or implementations exist, which also blocks normal pre-commit validation for changes to this file.
You are interacting with an AI system.
| widget(name: string) { | ||
| const container = world.getComponent(nodeId, WidgetContainer) | ||
| const widgetId = container.widgetIds.find((id) => { | ||
| return world.getComponent(id, WidgetIdentity).name === name | ||
| }) | ||
| return widgetId ? createWidgetHandle(widgetId) : undefined | ||
| }, | ||
| widgets() { | ||
| const container = world.getComponent(nodeId, WidgetContainer) | ||
| return container.widgetIds.map(createWidgetHandle) |
There was a problem hiding this comment.
Add explicit type annotations to lambda parameters.
The lambda parameters id and widgetId have implicit any types, which violates the "Use TypeScript for type safety" guideline and triggers TypeScript errors in CI.
🔧 Proposed fix
widget(name: string) {
const container = world.getComponent(nodeId, WidgetContainer)
- const widgetId = container.widgetIds.find((id) => {
+ const widgetId = container.widgetIds.find((id: WidgetEntityId) => {
return world.getComponent(id, WidgetIdentity).name === name
})
return widgetId ? createWidgetHandle(widgetId) : undefined
},
widgets() {
const container = world.getComponent(nodeId, WidgetContainer)
- return container.widgetIds.map(createWidgetHandle)
+ return container.widgetIds.map((id: WidgetEntityId) => createWidgetHandle(id))
},🧰 Tools
🪛 GitHub Check: collect
[failure] 170-170:
Parameter 'id' implicitly has an 'any' type.
🪛 GitHub Check: scan
[failure] 170-170:
Parameter 'id' implicitly has an 'any' type.
🪛 GitHub Check: validate-fonts
[failure] 170-170:
Parameter 'id' implicitly has an 'any' type.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/extensionV2Service.ts` around lines 168 - 177, The inline arrow
callbacks in widget() and widgets() use implicitly typed parameters (`id` and
`widgetId`); update them to have explicit types matching the element type of
WidgetContainer.widgetIds (e.g. use the project's WidgetId type or the array
element type via container.widgetIds[number]) so TypeScript can infer correctly
— annotate the find callback as (id: WidgetId) => ... and the map callback as
(widgetId: WidgetId) => createWidgetHandle(widgetId) (or use (id: typeof
container.widgetIds[number]) / (widgetId: typeof container.widgetIds[number]) if
no WidgetId alias exists).
There was a problem hiding this comment.
agreed, straightforward fix — annotate id/widgetId as WidgetEntityId in widget()/widgets() (now lines 205/212). Have this and the other minor typing fixes staged locally but can't push a clean commit to this branch right now — extensionV2Service.ts fails pnpm typecheck on the pre-existing @/ecs/* phantom imports (intentional per 2f8fe0013b), which blocks lint-staged's typecheck step for any change to this file. See the reply on the pauseTracking thread for the full blocker.
There was a problem hiding this comment.
@christian-byrne, thanks for the clarification. The intentional @/ecs/* imports explain the typecheck blocker.
The finding remains open until the annotated change is pushed to this pull request. No additional validation is required for this specific change after id and widgetId use WidgetEntityId.
🐇
🧠 Learnings used
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 15443
File: docs/adr/0008-entity-component-system.md:22-24
Timestamp: 2026-08-20T19:30:30.807Z
Learning: In ComfyUI frontend entity and Pinia store code, use the established identity type for each concern: branded numbers for most entity IDs, number-or-string IDs for nodes, UUID strings for graphs, and composite string keys such as WidgetId for scoped entities. Do not introduce a new ID representation when an established store-specific type exists.
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:17-23
Timestamp: 2026-09-02T16:52:23.983Z
Learning: In PR `#11251`, `src/services/extensionV2Service.ts` is a pseudocode-grade Extension V2 prototype with intentionally unresolved `@/ecs/*` imports. These imports make `pnpm typecheck` fail by design until ECS stubs or implementations exist, which also blocks normal pre-commit validation for changes to this file.
You are interacting with an AI system.
| inputs() { | ||
| const conn = world.getComponent(nodeId, Connectivity) | ||
| return conn.inputSlotIds.map((slotId) => { | ||
| const slot = world.getComponent(slotId, SlotIdentity) | ||
| return { | ||
| entityId: slotId, | ||
| name: slot.name, | ||
| type: slot.type, | ||
| direction: 'input' as const, | ||
| nodeEntityId: nodeId | ||
| } satisfies SlotInfo | ||
| }) | ||
| }, | ||
| outputs() { | ||
| const conn = world.getComponent(nodeId, Connectivity) | ||
| return conn.outputSlotIds.map((slotId) => { | ||
| const slot = world.getComponent(slotId, SlotIdentity) | ||
| return { | ||
| entityId: slotId, | ||
| name: slot.name, | ||
| type: slot.type, | ||
| direction: 'output' as const, | ||
| nodeEntityId: nodeId | ||
| } satisfies SlotInfo | ||
| }) | ||
| }, |
There was a problem hiding this comment.
Add explicit type annotations to slot lambda parameters.
The slotId parameters have implicit any types, causing TypeScript errors.
🔧 Proposed fix
inputs() {
const conn = world.getComponent(nodeId, Connectivity)
- return conn.inputSlotIds.map((slotId) => {
+ return conn.inputSlotIds.map((slotId: SlotEntityId) => {
const slot = world.getComponent(slotId, SlotIdentity)
return {
entityId: slotId,
name: slot.name,
type: slot.type,
direction: 'input' as const,
nodeEntityId: nodeId
} satisfies SlotInfo
})
},
outputs() {
const conn = world.getComponent(nodeId, Connectivity)
- return conn.outputSlotIds.map((slotId) => {
+ return conn.outputSlotIds.map((slotId: SlotEntityId) => {
const slot = world.getComponent(slotId, SlotIdentity)
return {
entityId: slotId,
name: slot.name,
type: slot.type,
direction: 'output' as const,
nodeEntityId: nodeId
} satisfies SlotInfo
})
},Note: This fix requires keeping SlotEntityId in the imports (contradicting the earlier suggestion to remove it). Keep the import if you apply this fix.
🧰 Tools
🪛 GitHub Check: collect
[failure] 207-207:
Parameter 'slotId' implicitly has an 'any' type.
[failure] 194-194:
Parameter 'slotId' implicitly has an 'any' type.
🪛 GitHub Check: scan
[failure] 207-207:
Parameter 'slotId' implicitly has an 'any' type.
[failure] 194-194:
Parameter 'slotId' implicitly has an 'any' type.
🪛 GitHub Check: validate-fonts
[failure] 207-207:
Parameter 'slotId' implicitly has an 'any' type.
[failure] 194-194:
Parameter 'slotId' implicitly has an 'any' type.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/extensionV2Service.ts` around lines 192 - 217, The lambda
parameters in inputs() and outputs() need explicit types to avoid implicit any:
change the map callbacks to declare slotId as SlotEntityId (e.g. map((slotId:
SlotEntityId) => ...)) so TypeScript knows the type when you call
world.getComponent(slotId, SlotIdentity) and construct the SlotInfo objects;
ensure SlotEntityId remains imported and the rest of the object literal still
uses "satisfies SlotInfo" as before.
There was a problem hiding this comment.
keeping SlotEntityId per this suggestion's own note — it conflicts with the sibling unused-imports thread (r3083931606) which suggested dropping it. Resolving both together: drop SlotConnection (genuinely unused), keep SlotEntityId, annotate the slotId lambda params here.
There was a problem hiding this comment.
@christian-byrne, this resolution is correct. Keep SlotEntityId for the slotId annotations. Remove SlotConnection because it is unused. The sibling unused-import finding should no longer apply to SlotEntityId.
✏️ Learnings added
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:227-252
Timestamp: 2026-09-02T16:53:15.883Z
Learning: In `src/services/extensionV2Service.ts`, `SlotEntityId` is required to type the `slotId` parameters in the `inputs()` and `outputs()` map callbacks. `SlotConnection` is unused and should be removed from the ECS component imports.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
You are interacting with an AI system.
Key decisions modeled
Not included (future)
|
… pattern - Replace imperative dispatchNodeCreated/dispatchLoadedGraphNode with startExtensionSystem() — a single watcher on world.queryAll(NodeType) - Extensions mount/unmount as reactive consequence of World state changes - Add pauseTracking/resetTracking around hook execution (matches Vue's setupStatefulComponent to prevent accidental dependency tracking) - Use LoadedFromWorkflow tag component to select nodeCreated vs loadedGraphNode hook - flush: 'post' ensures extensions mount after DOM updates
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/services/extensionV2Service.ts (1)
64-75: Consider usingNodeEntityIdinstead ofnumberfor type safety.The
entityIdparameter is typed asnumber, but it's always called withNodeEntityId. Using the specific type would improve type safety and self-documentation.Optional improvement
function getOrCreateScope( extensionName: string, - entityId: number + entityId: NodeEntityId ): EffectScope {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/services/extensionV2Service.ts` around lines 64 - 75, The getOrCreateScope function currently types entityId as number but callers pass NodeEntityId; change the entityId parameter type from number to NodeEntityId (update the signature of getOrCreateScope(extensionName: string, entityId: NodeEntityId): EffectScope) and update any related local references/usages in this file to match the NodeEntityId type so the registry key generation and scopeRegistry interactions remain intact; keep the function name getOrCreateScope and the key template `${extensionName}:${entityId}` unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/services/extensionV2Service.ts`:
- Around line 17-23: The build fails because pauseTracking and resetTracking are
not exported from 'vue'; update the imports in extensionV2Service to stop
importing pauseTracking/resetTracking from 'vue' and either (preferred) import
those two directly from '@vue/reactivity' alongside
EffectScope/onScopeDispose/watch (e.g., import { pauseTracking, resetTracking }
from '@vue/reactivity'), or remove the tracking calls and replace with a
non-reactivity pattern (e.g., run hook logic outside of Vue tracking) if you
want to avoid using internal APIs; ensure all references to
pauseTracking/resetTracking in functions like the extension hook wrapper are
adjusted to use the new import or refactored alternative.
---
Nitpick comments:
In `@src/services/extensionV2Service.ts`:
- Around line 64-75: The getOrCreateScope function currently types entityId as
number but callers pass NodeEntityId; change the entityId parameter type from
number to NodeEntityId (update the signature of getOrCreateScope(extensionName:
string, entityId: NodeEntityId): EffectScope) and update any related local
references/usages in this file to match the NodeEntityId type so the registry
key generation and scopeRegistry interactions remain intact; keep the function
name getOrCreateScope and the key template `${extensionName}:${entityId}`
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 79ac75fb-e9a6-44d1-8950-c7696d1c3c5e
📒 Files selected for processing (1)
src/services/extensionV2Service.ts
| import { | ||
| EffectScope, | ||
| onScopeDispose, | ||
| pauseTracking, | ||
| resetTracking, | ||
| watch | ||
| } from 'vue' |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Does Vue 3 export pauseTracking and resetTracking from the main vue package?
💡 Result:
No, Vue 3 does not export pauseTracking and resetTracking from the main 'vue' package. These are internal functions in the @vue/reactivity package used by Vue's core (e.g., in warning.ts and lifecycle hooks via injectHook), but they are not part of the public Reactivity API documented on vuejs.org. Official docs list core exports like ref, reactive, computed, watchEffect, effectScope, etc., but not pauseTracking or resetTracking. A 2025 PR (#13072) to expose them was closed without merging, as the author noted "pauseTracking can't resolve it". Early examples import them from '@vue/reactivity', confirming they are internal, not public main package exports.
Citations:
- 1: https://github.com/vuejs/core/blob/main/packages/runtime-core/src/warning.ts
- 2: https://github.com/vuejs/core/blob/main/packages/runtime-core/src/index.ts
- 3: https://github.com/vuejs/core/blob/main/packages/reactivity/src/effect.ts
- 4: feat(runtime-core): expose pauseTracking and resetTracking vuejs/core#13072
- 5: https://vuejs.org/api/reactivity-advanced
- 6: https://vuejs.org/api/reactivity-core
pauseTracking and resetTracking are not public Vue exports — CI fails.
These functions are internal @vue/reactivity APIs not exported from the main vue package. The pipeline confirms: TS2305: Module 'vue' has no exported member 'pauseTracking'.
Options to fix:
- Import directly from
@vue/reactivity(exposes internal dependency) - Use a different pattern to prevent accidental dependency tracking (e.g., wrap hook execution without Vue tracking primitives)
- Accept that extension hooks may create reactive dependencies and document the behavior
Option 1: Import from `@vue/reactivity`
import {
EffectScope,
onScopeDispose,
- pauseTracking,
- resetTracking,
watch
} from 'vue'
+import { pauseTracking, resetTracking } from '@vue/reactivity'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { | |
| EffectScope, | |
| onScopeDispose, | |
| pauseTracking, | |
| resetTracking, | |
| watch | |
| } from 'vue' | |
| import { | |
| EffectScope, | |
| onScopeDispose, | |
| watch | |
| } from 'vue' | |
| import { pauseTracking, resetTracking } from '@vue/reactivity' | |
| import type { | |
| NodeExtensionV2, | |
| WidgetExtensionV2, | |
| WidgetExtensionOptions | |
| } from '@/types/extensionV2' | |
| import { | |
| Position, | |
| Dimensions, | |
| NodeVisual, | |
| NodeType, | |
| Execution, | |
| WidgetValue, | |
| WidgetIdentity, | |
| WidgetContainer, | |
| Connectivity, | |
| SlotIdentity | |
| } from '@/ecs/components' | |
| import type { NodeEntityId, WidgetEntityId } from '@/ecs/entityIds' |
🧰 Tools
🪛 GitHub Actions: CI: Dist Telemetry Scan
[error] 20-20: Typecheck failed (vue-tsc / TypeScript). TS2305: Module 'vue' has no exported member 'pauseTracking'.
🪛 GitHub Actions: CI: OSS Assets Validation
[error] 20-20: TypeScript (vue-tsc) failed: TS2305 Module 'vue' has no exported member 'pauseTracking'.
🪛 GitHub Actions: CI: Size Data
[error] 20-20: TypeScript typecheck failed (vue-tsc). TS2305: Module 'vue' has no exported member 'pauseTracking'.
🪛 GitHub Check: collect
[failure] 21-21:
Module '"vue"' has no exported member 'resetTracking'.
[failure] 20-20:
Module '"vue"' has no exported member 'pauseTracking'.
🪛 GitHub Check: scan
[failure] 21-21:
Module '"vue"' has no exported member 'resetTracking'.
[failure] 20-20:
Module '"vue"' has no exported member 'pauseTracking'.
🪛 GitHub Check: setup
[failure] 21-21:
Module '"vue"' has no exported member 'resetTracking'.
[failure] 20-20:
Module '"vue"' has no exported member 'pauseTracking'.
🪛 GitHub Check: validate-fonts
[failure] 21-21:
Module '"vue"' has no exported member 'resetTracking'.
[failure] 20-20:
Module '"vue"' has no exported member 'pauseTracking'.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/extensionV2Service.ts` around lines 17 - 23, The build fails
because pauseTracking and resetTracking are not exported from 'vue'; update the
imports in extensionV2Service to stop importing pauseTracking/resetTracking from
'vue' and either (preferred) import those two directly from '@vue/reactivity'
alongside EffectScope/onScopeDispose/watch (e.g., import { pauseTracking,
resetTracking } from '@vue/reactivity'), or remove the tracking calls and
replace with a non-reactivity pattern (e.g., run hook logic outside of Vue
tracking) if you want to avoid using internal APIs; ensure all references to
pauseTracking/resetTracking in functions like the extension hook wrapper are
adjusted to use the new import or refactored alternative.
There was a problem hiding this comment.
confirmed, this is a real bug — pauseTracking/resetTracking aren't exported from vue's public surface, only from @vue/reactivity internally. the fix itself is a one-line import swap (import { pauseTracking, resetTracking } from '@vue/reactivity'), but @vue/reactivity isn't a direct dependency here — pnpm's strict node_modules won't resolve it phantom-style, so it needs adding to package.json pinned to the same 3.5.13 the vue catalog entry resolves to.
I have that fix (plus the package.json/lockfile change) ready locally but can't land it as a commit: this file already fails pnpm typecheck on the pre-existing @/ecs/* imports (per the 2f8fe0013b commit message, those modules don't exist yet on purpose — this is illustrating the target shape, not compiling code), so lint-staged's pnpm typecheck step blocks any commit to this file regardless of what changes. Since --no-verify isn't an option here, this fix is stashed at act-fe-11251 wip on the branch worktree rather than pushed — happy to push it once the @/ecs/* stub question is resolved (either real stub modules land, or the pre-commit gate gets a scoped carve-out for this proposal file the way src/extensions/core/* already has one in eslint.config.ts).
There was a problem hiding this comment.
@christian-byrne, thanks for the detailed confirmation.
The import defect is valid. The required fix is to import pauseTracking and resetTracking from @vue/reactivity and add @vue/reactivity@3.5.13 as a direct dependency.
The review thread must remain open until the change is present in the pull request branch. The existing intentional @/ecs/* typecheck failures prevent normal commits to this proposal file. Resolving that stub or scoped-gate decision will also unblock this correction.
✏️ Learnings added
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 11251
File: src/services/extensionV2Service.ts:17-23
Timestamp: 2026-09-02T16:52:19.217Z
Learning: In PR `#11251`, `src/services/extensionV2Service.ts` is a pseudocode-grade Extension V2 prototype with intentionally unresolved `@/ecs/*` imports. These imports make `pnpm typecheck` fail by design until ECS stubs or implementations exist, which also blocks normal pre-commit validation for changes to this file.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
You are interacting with an AI system.
Adds src/platform/nodeApi — the published surface custom nodes are migrating onto, replacing prototype patching and the unpublished globals they reach today. Handles are closed proxies over graph, node, slot and widget state, so reads can become store queries and writes can become commands without the call sites changing. Served to packs as /comfy/api/v1.js. The host integration is the minimum needed for the surface to exist: the node-move bridge, widget registration, prompt serialization and the litegraph changes the handles depend on. src/types/extensionV2.ts is Christian's extension contract from #11251, kept verbatim so both efforts converge on one shape. Nothing imports it yet, so it and the served v1.js are declared in knip's ignore list alongside the reason. The two generator scripts are the API's own codegen — apiSurface.test.ts re-derives the member list from source rather than trusting the checked-in copy, so the list cannot drift silently.
Standardises on the naming in Christian's Extension V2 API proposal (#11251) so both efforts use one name for one thing. The served module becomes /comfy/api/v2.js and the harness writes its converted tree to v2/. Name only. forMajor and the capability versions still read 1.x: that is genuinely version 1 of this contract, and V2 refers to the extension system generation, which is a different axis. Bumping the contract version to match a name would tell packs there was a 1.x of this surface, and there never was. Anthropic's /v1/messages path in convert.mjs and the unrelated node-def-v1.json schema are deliberately untouched.
Adopts src/types/extensionV2.ts from PR #11251 verbatim and reshapes our widget handle to match it, so the two efforts converge on one surface instead of shipping two incompatible ones. Properties become accessors — getValue and setValue, isHidden and setHidden, getOptions and setOption, setLabel — and the type field is widgetType, since node handles keep their own type. Their proposal predates the current ECS work by a wide margin, so the interface is what is taken here; the implementation behind it stays ours, which runs and is covered by tests. The conversion skill is updated to emit the same shapes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Standardises on the naming in Christian's Extension V2 API proposal (#11251) so both efforts use one name for one thing. The served module becomes /comfy/api/v2.js and the harness writes its converted tree to v2/. Name only. forMajor and the capability versions still read 1.x: that is genuinely version 1 of this contract, and V2 refers to the extension system generation, which is a different axis. Bumping the contract version to match a name would tell packs there was a 1.x of this surface, and there never was. Anthropic's /v1/messages path in convert.mjs and the unrelated node-def-v1.json schema are deliberately untouched.
Adopts src/types/extensionV2.ts from PR #11251 verbatim and reshapes our widget handle to match it, so the two efforts converge on one surface instead of shipping two incompatible ones. Properties become accessors — getValue and setValue, isHidden and setHidden, getOptions and setOption, setLabel — and the type field is widgetType, since node handles keep their own type. Their proposal predates the current ECS work by a wide margin, so the interface is what is taken here; the implementation behind it stays ours, which runs and is covered by tests. The conversion skill is updated to emit the same shapes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Standardises on the naming in Christian's Extension V2 API proposal (#11251) so both efforts use one name for one thing. The served module becomes /comfy/api/v2.js and the harness writes its converted tree to v2/. Name only. forMajor and the capability versions still read 1.x: that is genuinely version 1 of this contract, and V2 refers to the extension system generation, which is a different axis. Bumping the contract version to match a name would tell packs there was a 1.x of this surface, and there never was. Anthropic's /v1/messages path in convert.mjs and the unrelated node-def-v1.json schema are deliberately untouched.
|
Seven review fixes are committed locally. Push is blocked by the existing draft-proposal baseline: Knip rejects all five unwired proposal files, and typecheck still lacks four unimplemented ECS modules. No hook bypass used. Full context for agent readersImplemented as one local commit per actionable thread: localized PreviewAny labels, typed event callback maps, explicit unsupported-widget-extension failure, isolated node-extension mount failures, typed widget and slot callbacks, and removal of unavailable Vue tracking APIs. Verification under Node 25:
A normal push to |
|
Rebase is clean, but branch update is blocked.
Full context for agent readersRebased Validation:
The row required preserving the intended proposal diff, so changing the pseudocode API or bypassing the pre-push hook would exceed the rebase-only scope. |
|
Superseded by benjcooley's #16691 ("feat(nodeApi): publish the custom-node API"), which implements a Full context for agent readersThis PR was an intentionally-unwired pseudocode proposal for a NodeHandle/WidgetHandle-based Extension V2 API with an ECS bridge. Prior lane evidence (comment) found the rebased branch rebases cleanly but cannot pass current required gates ( Author verified: |
pseudocode-grade proof-of-concept.
Related
┆Issue is synchronized with this Notion page by Unito