Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughDetects when a widget's value is driven by an external link (including subgraph-promoted inputs), prevents applying control widgets in those cases, omits controlWidget for linked slots in the Vue renderer, and adds unit and browser tests verifying control_after_generate behavior across direct and subgraph scenarios. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI (Widget)
participant Node as Node
participant Graph as Graph
participant Subgraph as SubgraphNode
UI->>Node: render request → ask if control applies
Node->>Graph: inspect input links for targetWidget
Graph-->>Node: link info (none | direct | from SubgraphInput)
alt link originates from SubgraphInput
Node->>Subgraph: map link to promoted input / check parent links
Subgraph-->>Node: external linkage present? (yes|no)
end
Node-->>UI: isControlExternallyDriven = true|false
alt externally driven
UI-->>UI: set controlWidget = undefined (omit control)
else not externally driven
UI-->>UI: attach controlWidget (apply control_after_generate)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎭 Playwright: ⏳ Running... |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@browser_tests/tests/subgraphControlAfterGenerate.spec.ts`:
- Around line 50-53: The current guard uses test.skip when setup is falsy which
masks failures; replace the test.skip(...) branches with an immediate test
failure by throwing an Error (e.g., throw new Error('Could not create Int
nodes') ) or calling the test runner's fail mechanism so the test fails fast;
update both occurrences that check the setup variable (the blocks using "if
(!setup) { test.skip(...)" ) to throw an Error with a clear message instead of
skipping.
- Around line 39-43: The test currently finds controlWidget via
targetWidget?.linkedWidgets?.find(...) and silently skips configuration if it's
missing; update the test to assert that controlWidget exists before mutating it
(e.g., throw or use your test framework's expect) so the test fails if the
'control_after_generate' linked widget isn't present; apply the same presence
assertion and configuration for the other occurrence around the code referenced
at lines 111-115. Ensure you reference the variables controlWidget,
targetWidget, linkedWidgets and the widget name 'control_after_generate' when
adding the assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8758c4a1-5bca-4a2b-847f-5e936520eef0
📒 Files selected for processing (4)
browser_tests/tests/subgraphControlAfterGenerate.spec.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/scripts/widgets.test.tssrc/scripts/widgets.ts
f8038f5 to
97c74e6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/scripts/widgets.ts (1)
82-82: Import the canonical subgraph-input constant instead of redefining-10.LiteGraph already has an authoritative
SUBGRAPH_INPUT_ID; duplicating the raw value here makes this check drift-prone if that constant ever changes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/scripts/widgets.ts` at line 82, Remove the locally redefined constant "const SUBGRAPH_INPUT_ID = -10" and instead import the canonical SUBGRAPH_INPUT_ID from the LiteGraph library where it is exported, then update any uses to reference the imported symbol; this ensures you rely on the authoritative constant (replace the local definition with an import of SUBGRAPH_INPUT_ID and keep usages 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 `@browser_tests/tests/subgraphControlAfterGenerate.spec.ts`:
- Around line 9-87: Add a new test that reproduces the promoted-subgraph
regression by creating a promoted subgraph input, ensuring the
control_after_generate widget is present when unlinked, then linking an external
Int node to that promoted input and asserting the promoted input's
control_after_generate disappears (no control widget or controlConfigured
becomes false), then disconnect the link, run the promoted input's
widget.afterQueued (or call applyWidgetControl indirectly by awaiting
comfyPage.nextFrame and invoking widget.afterQueued), and assert the
control_after_generate reappears; use the same helpers/symbols from the file
(window.app!.canvas.graph!, LiteGraph.createNode, node.connect/disconnect,
widget.linkedWidgets, widget.afterQueued, comfyPage.nextFrame) and mirror the
existing test structure for setup, value checks, and assertions.
---
Nitpick comments:
In `@src/scripts/widgets.ts`:
- Line 82: Remove the locally redefined constant "const SUBGRAPH_INPUT_ID = -10"
and instead import the canonical SUBGRAPH_INPUT_ID from the LiteGraph library
where it is exported, then update any uses to reference the imported symbol;
this ensures you rely on the authoritative constant (replace the local
definition with an import of SUBGRAPH_INPUT_ID and keep usages unchanged).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 52abc167-734a-4086-8e92-611ceaa202d9
📒 Files selected for processing (5)
browser_tests/tests/subgraphControlAfterGenerate.spec.tsknip.config.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/scripts/widgets.test.tssrc/scripts/widgets.ts
✅ Files skipped from review due to trivial changes (1)
- src/scripts/widgets.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/extensions/vueNodes/components/NodeWidgets.vue
e8b2bee to
8d5ac09
Compare
|
@coderabbitai review |
8d5ac09 to
b7770a1
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
b7770a1 to
3d9d123
Compare
|
@coderabbitai review |
7b89585 to
31cadfc
Compare
28222a4 to
1adfb6d
Compare
When an external node is connected to a SubgraphNode input, the promoted widget's control_after_generate combo should not be active since the external node owns the value. The interior node's control widget was being exposed via linkedWidgets delegation regardless of connection state. Fixes Comfy-Org#10218
Hide the control widget UI (NodeWidgets.vue) and skip its execution (isControlExternallyDriven in widgets.ts) when the widget's input has an active link. For subgraph interior nodes, traces the link chain through SubgraphInput to the SubgraphNode to detect external links. Fixes Comfy-Org#10218
…enerate Exercises the subgraph boundary path in isControlExternallyDriven() by converting a KSampler to a subgraph, linking an external Int node to the promoted seed input, and verifying control_after_generate is suppressed while linked and resumes after disconnect.
The rebase conflict resolution incorrectly took the pre-extraction version. Restored main's refactored version which delegates to useProcessedWidgets composable.
1adfb6d to
231c19a
Compare
There was a problem hiding this comment.
Verdict: request changes. The new definition-wide ownership check freezes an unlinked sibling instance, and the promoted browser fixture does not create the seed boundary it asserts.
- [P1] I reproduced the shared-definition regression through the production widget callback collector. A linked host stops an unlinked sibling's incrementing seed. Removing only the new guard makes the same check pass.
- [P1] I traced the promoted browser arrangement to a missing seed input. It fails its external-link precondition before reaching the intended regression assertions.
The inline comments also cover nested ownership, the unimplemented presentation policy, test placement and discriminating cases, type/lookup simplifications, the lint failure, and the individual comment deletions.
Findings without an inline location
- [P2] I found superseding ownership work in #15972, reviewed at its current head. Its
widgetControlSystemcollects link-fed host WidgetIds and skips those targets, and its nested-promotion tests advance only the authoritative outer host while preserving inner/source values. It removes the per-control callbacks this PR guards. Please coordinate the suppression and useful regressions there rather than preserve a second definition-wide control policy. I read its production and test patches; I did not execute a combined branch or prove a combined-build failure.
Existing feedback, independently checked
- Confirmed: the canonical-constant finding remains open.
constants.tsexportsSUBGRAPH_INPUT_ID, andSubgraphInputNodeuses it for the origin ID. The new local-10declaration duplicates that contract. I would import the canonical constant rather than keep the copy. - Confirmed in part: the promoted-boundary test request now has a third case, but the conversion creates inputs from existing boundary links, not the unlinked seed widget. The new inline fixture finding explains why that case does not yet exercise the requested boundary.
- Addressed: the control-existence request now has a
controlConfiguredassertion in all three cases. I agree with the author's response. - Addressed: the fail-instead-of-skip request now fails null setup before its narrowing return. I found no remaining skip and agree with the author's response.
Verification and limits
I reviewed this head against the actual PR base and installed this branch's frozen-lockfile dependencies.
pnpm dlx node@24 node_modules/vitest/vitest.mjs run src/scripts/widgets.test.tspassed all four tests.- Focused real-graph probes under Node 24 produced three failures and one passing lifecycle control. The nested linked seed changed from 42 to 43; the unlinked sibling stayed at 42; the linked promoted view still returned
control_after_generate. Repeated connect/disconnect/reconnect behavior passed for one root-level instance. - The shared-instance probe passed when an in-memory transform removed only the new execution guard. That isolates the newly introduced freeze; it is not a claim that a full base build was tested.
pnpm exec playwright test --list subgraphControlAfterGeneratediscovered three tests. I did not start a backend or execute browser tests in this review round. The seed-fixture failure is source-traced; visible rendering is traced from the real getter throughgetControlWidgettoWidgetInputNumber, not browser-captured.- Scoped ESLint failed the browser fixture import. It ignores
src/scripts, so I do not count that as a source lint pass. Default oxlint reported no issues on the one nonignored file; forcing coverage of the ignored source files could not loadeslint-plugin-playwright, including under Node 24. Source lint remains unverified. Fallow is not available in this checkout. - The saved CI snapshot contained successful Socket checks, a skipped backport check, and a successful CodeRabbit status. It contained no successful required typecheck, lint, or regression-test result for this head. I did not trigger CI.
Coverage and consolidation
I ran standard-depth correctness, maintainability, and tests lanes over the entire three-file diff. All applicable standard specialist lenses ran, including history/regression analysis, real-consumer ownership probes, no-comments, type discipline, test-value/mocking analysis, Playwright structure/flakiness checks, and the requested Playwright-writing conventions. No lane or changed file was skipped. The comment inventory contains 21 blocks; each has its own deletion suggestion.
The REST overlap snapshot inspected all open PR file lists for the original contract set. I checked the relevant policy changes in #15972, #23187, #11364, #18448, #10227, and #10232, and the remaining matched hunks for conflicting behavior. Only #15972 supplied a confirmed superseding control policy. A supplemental scan for additional rendering/execution dependencies exhausted the ordinary GitHub quota before completing, so that expanded overlap check is incomplete. REST does not expose review-thread resolution state; I assessed every saved review comment instead of assuming resolved threads were absent.
I combined duplicate alias findings, the visibility-test gap with the presentation finding, the nested-test gap with the nested ownership defect, and raw browser-value accessor duplication with moving hook checks down to Vitest. I retained the separate wrong-slot and before-generation falsifiers. I rejected new comments about missing control preconditions and skipping because the current source contradicts those claims, as detailed above. No owner-authored feedback required a skill-gap report.
| const seedInputIndex = sgNode.inputs?.findIndex( | ||
| (inp: { name: string }) => inp.name === 'seed' | ||
| ) |
There was a problem hiding this comment.
[P1] Build a seed boundary before connecting the external Int
I traced this conversion against the default workflow. The KSampler's seed is an unlinked widget, while conversion builds subgraph inputs from existing boundary links. Auto-promoting that widget does not create a seed boundary input or an interior SubgraphInput → seed link. This lookup therefore returns -1, the connection below is skipped, and hasExternalLink fails before any suppression assertion runs. This is source-traced, not a browser-run result.
Please replace this arrangement with a minimal workflow asset containing the real interior boundary link and corresponding host input. Keep the hard setup assertions. This requires a JSON asset and spec changes, so I cannot supply a self-contained inline replacement.
| for (const parentNode of rootGraph._nodes) { | ||
| if ( | ||
| parentNode.isSubgraphNode?.() && | ||
| parentNode.subgraph === graph | ||
| ) { | ||
| const sgNodeInput = parentNode.inputs?.[i] | ||
| if (sgNodeInput?.link != null) return true |
There was a problem hiding this comment.
[P1] Keep control ownership specific to the current subgraph instance
I reproduced a regression with two instances of the same subgraph definition: one input is linked and the other is unlinked with increment selected. executeWidgetsCallback(collectAllNodes(rootGraph), 'afterQueued', {}) now leaves the unlinked host's value at 42. Removing only this new guard in memory makes that same check pass. This scan returns true as soon as any host is linked, so an unrelated sibling disables local control too.
Please resolve ownership and update the authoritative value for the current host/path, and retain a regression with one linked and one unlinked instance. Replacing the condition with an all-hosts check would still mix the two instances. I cannot give a self-contained suggestion because the callback/execution context and the host-owned value update span files.
| @@ -0,0 +1,299 @@ | |||
| import { expect } from '@playwright/test' | |||
|
|
|||
| import { comfyPageFixture as test } from '../fixtures/ComfyPage' | |||
There was a problem hiding this comment.
[P2] Use the required E2E fixture alias
The scoped ESLint run fails here with no-restricted-imports: browser tests must use the @e2e/ alias.
| import { comfyPageFixture as test } from '../fixtures/ComfyPage' | |
| import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage' |
| await comfyPage.page.evaluate((id) => { | ||
| const node = window.app!.canvas.graph!.getNodeById(id) | ||
| for (const widget of node?.widgets ?? []) { | ||
| widget.afterQueued?.({}) | ||
| } | ||
| }, setup.targetId) |
There was a problem hiding this comment.
[P2] Move hook-only execution checks to the existing Vitest suite
These browser cases invoke afterQueued themselves, so they exercise neither queue dispatch nor control rendering. The same real graph objects and control constructors can prove linked suppression and disconnect restoration in widgets.test.ts. The current four unit cases only test classification and stay green if the new execution guard is deleted. Three frontend boots and an extra workflow load do not add browser-specific evidence here.
Move the direct and promoted hook outcomes to Vitest, delete the two hook-only browser cases, and keep one real promoted hide/disconnect/show UI composition. That also removes the four raw root-widget readers duplicating NodeReference.getWidget / NodeWidgetReference.getValue; use those accessors if a root-value read remains in the UI case. This relocation spans test files and needs real fixture construction, so I cannot provide a self-contained line substitution.
| resetSubgraphFixtureState() | ||
| }) | ||
|
|
||
| describe('isControlExternallyDriven', () => { |
There was a problem hiding this comment.
[P2] Include one before-generation composition check in the hook coverage
All new execution assertions call afterQueued. Moving the guard into only that hook would pass them while allowing linked seeds to change for Comfy.WidgetControlMode='before'. The four classifier tests do not construct either execution hook.
When moving the real hook outcomes into this suite, add one before-mode row. Invoke the initial before hook to pass its intentional first-generation skip, then verify a later linked call leaves the value unchanged and disconnect restores incrementing. No topology × mode cross-product is needed. The real setting/control fixture and the browser-to-unit relocation span files, so this needs more than an inline substitution.
| // Check if the link originates from a SubgraphInputNode | ||
| const link = graph._links?.get(input.link) ?? graph.links?.[input.link] | ||
| if (!link || link.origin_id !== SUBGRAPH_INPUT_ID) { | ||
| // Regular node with a direct external link — externally driven |
There was a problem hiding this comment.
[P3] Nit: Remove this redundant comment
I would delete this narration. The comment repeats the function result for the branch. The repository asks for this information in names and executable behavior rather than parallel prose.
| // Regular node with a direct external link — externally driven |
| // Interior node linked to SubgraphInput — check whether the | ||
| // SubgraphNode's corresponding input has an external link. |
There was a problem hiding this comment.
[P3] Nit: Remove this redundant comment
I would delete this narration. The block narrates the following Subgraph input and parent input lookup. The repository asks for this information in names and executable behavior rather than parallel prose.
| // Interior node linked to SubgraphInput — check whether the | |
| // SubgraphNode's corresponding input has an external link. |
| // Interior node linked to SubgraphInput — check whether the | ||
| // SubgraphNode's corresponding input has an external link. | ||
| if (!graph.isRootGraph && 'inputs' in graph) { | ||
| // graph is a Subgraph; find SubgraphInput slot index from link |
There was a problem hiding this comment.
[P3] Nit: Remove this redundant comment
I would delete this narration. The comment says graph is a Subgraph while the next line casts a hand-declared shape. The repository asks for this information in names and executable behavior rather than parallel prose.
| // graph is a Subgraph; find SubgraphInput slot index from link |
| for (let i = 0; i < subgraphInputs.length; i++) { | ||
| const sgInput = subgraphInputs[i] | ||
| if (sgInput.linkIds?.includes(link.id)) { | ||
| // Found the SubgraphInput slot — check parent SubgraphNode instances |
There was a problem hiding this comment.
[P3] Nit: Remove this redundant comment
I would delete this narration. The comment repeats the membership condition and following parent loop. The repository asks for this information in names and executable behavior rather than parallel prose.
| // Found the SubgraphInput slot — check parent SubgraphNode instances |
| // Skip when the widget's value is driven by an external link. | ||
| // For regular nodes: input has a non-subgraph link. | ||
| // For subgraph interior nodes: trace up to the SubgraphNode and | ||
| // check if its corresponding input has an external link. |
There was a problem hiding this comment.
[P3] Nit: Remove this redundant comment
I would delete this narration. Four lines repeat what the named isControlExternallyDriven guard encapsulates. The repository asks for this information in names and executable behavior rather than parallel prose.
| // Skip when the widget's value is driven by an external link. | |
| // For regular nodes: input has a non-subgraph link. | |
| // For subgraph interior nodes: trace up to the SubgraphNode and | |
| // check if its corresponding input has an external link. |

Summary
control_after_generatecombo widget on the promoted viewProblem
Promoted subgraph widgets (Int, seed, float) expose the interior node's
control_after_generatewidget regardless of connection state. When an external node drives the input, the user sees two independent controls — one on the external node and one on the promoted widget — with potentially conflicting modes (e.g. external is "fixed" but promoted shows "randomize").Solution
Override
linkedWidgetsonPromotedWidgetViewto returnundefinedwhen the corresponding SubgraphNode input has an active link. This hides the control combo from the promoted widget when the value is externally driven.Video of Fix
Screen.Recording.2026-03-17.at.4.15.30.PM.mov
Test plan
Unit test:
linkedWidgets is suppressed when input has an external linkManual: connect Int node to subgraph input, verify control widget disappears from promoted view
Manual: disconnect Int node, verify control widget reappears
Fixes Promoted subgraph widget doesn't mirror control_after_generate from source #10218
┆Issue is synchronized with this Notion page by Unito