Skip to content

Added workflow connectors#9027

Open
JPPhoto wants to merge 8 commits intoinvoke-ai:mainfrom
JPPhoto:workflow-connectors
Open

Added workflow connectors#9027
JPPhoto wants to merge 8 commits intoinvoke-ai:mainfrom
JPPhoto:workflow-connectors

Conversation

@JPPhoto
Copy link
Copy Markdown
Collaborator

@JPPhoto JPPhoto commented Apr 7, 2026

Summary

Adds persisted editor-only workflow connectors to the node editor.

This is a frontend feature/fix that introduces a lightweight connector node for visual edge routing, with editor persistence, connector-aware validation/type propagation, and frontend flattening before execution so runtime never sees connector nodes or edges. It also adds workflow UI support for creating/removing connectors, improves connector deletion splice-through behavior, and allows unresolved connectors to accept compatible downstream targets so target-first wiring works correctly.

Also included:

  • non-DOM test coverage for connector topology, reducer behavior, validation, candidate resolution, graph flattening, and workflow validation
  • cleanup of the connector deletion path to use the real generic node-removal flow
  • a small package.json script update to Vitest's worker settings (--maxWorkers=50%) for build/test scripts

Related Issues / Discussions

QA Instructions

So much to do:

  1. Open the Workflow Editor and confirm workflows still render after reload.
  2. Right-click empty workflow canvas and confirm Add Connector appears.
  3. Add a connector, move/select it, and drag connections from/to it.
  4. For fun: double-click an existing edge and confirm a connector is inserted.
  5. Verify target-first wiring:
    • connect a compatible target field to an unresolved connector
    • then connect a compatible upstream source and confirm it is accepted
    • try an incompatible upstream source and confirm it is rejected
  6. Verify deletion splice-through:
    • 1 -> 1 connector delete reconnects source to target
    • 1 -> N reconnects all valid downstream targets
    • 1 -> 0 removes the connector without creating edges
    • invalid splice-through cases disable Delete Connector
  7. Save/reload a workflow with connectors and confirm they persist.
  8. Execute the workflow and confirm connectors do not appear in the runtime graph/execution views.

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@JPPhoto JPPhoto added the frontend PRs that change frontend files label Apr 7, 2026
@github-actions github-actions bot added the frontend-deps PRs that change frontend dependencies label Apr 7, 2026
@Pfannkuchensack Pfannkuchensack self-assigned this Apr 7, 2026
@lstein
Copy link
Copy Markdown
Collaborator

lstein commented Apr 7, 2026

What would be really neat is to be able to minimize the portions of the graph that are on either side of the connector, converting them into "black boxes". Later, the same UI could be used to define subroutine-like things.

@JPPhoto JPPhoto force-pushed the workflow-connectors branch from 49e6aba to 0dd9e8e Compare April 7, 2026 11:53
@JPPhoto
Copy link
Copy Markdown
Collaborator Author

JPPhoto commented Apr 7, 2026

What would be really neat is to be able to minimize the portions of the graph that are on either side of the connector, converting them into "black boxes". Later, the same UI could be used to define subroutine-like things.

Since this would essentially collapse all inputs, I could see it working for visual clarity but hard to use for subroutines. Though as you know, subroutines are on my personal radar.

@JPPhoto JPPhoto force-pushed the workflow-connectors branch 5 times, most recently from b2af633 to 0621051 Compare April 10, 2026 01:47
Copy link
Copy Markdown
Collaborator

@Pfannkuchensack Pfannkuchensack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The things from package.json and vite.config.mts are right ?

@JPPhoto
Copy link
Copy Markdown
Collaborator Author

JPPhoto commented Apr 10, 2026

@Pfannkuchensack I believe all of your issues were addressed.

  1. On invokeai/frontend/web/src/features/nodes/components/flow/Flow.tsx:
    The window-level context menu interception was too broad and could suppress other context menus inside the workflow surface. I changed it so the workflow menu only activates for connector targets and the React Flow pane, instead of swallowing every contextmenu event inside the wrapper.

  2. On invokeai/frontend/web/src/features/nodes/components/flow/Flow.tsx:
    I removed the ref-driven render dependency and switched the workflow menu to reactive state. I also memoized connector splice validation so getConnectorDeletionSpliceConnections() is no longer recomputed from the render path on every open-menu render.

  3. On invokeai/frontend/web/src/features/nodes/store/util/connectorTopology.ts:
    I cleaned up the repeated lookup logic by hoisting the connector input edge id and output edge id set outside the loop and using clearer membership checks.

  4. On invokeai/frontend/web/package.json and invokeai/frontend/web/vite.config.mts:
    Those changes were accidentally committed but we should definitely consider them as they speed testing time considerably!

All tests pass.

@JPPhoto JPPhoto requested a review from Pfannkuchensack April 10, 2026 17:51
Copy link
Copy Markdown
Collaborator

@Pfannkuchensack Pfannkuchensack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works good.

@JPPhoto JPPhoto force-pushed the workflow-connectors branch from ce64060 to 7bfeb11 Compare April 12, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files frontend-deps PRs that change frontend dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants