Skip to content

Feature: Add the ability to call a saved workflow from another#9093

Open
JPPhoto wants to merge 157 commits intoinvoke-ai:mainfrom
JPPhoto:call-saved-workflows
Open

Feature: Add the ability to call a saved workflow from another#9093
JPPhoto wants to merge 157 commits intoinvoke-ai:mainfrom
JPPhoto:call-saved-workflows

Conversation

@JPPhoto
Copy link
Copy Markdown
Collaborator

@JPPhoto JPPhoto commented Apr 29, 2026

Summary

This PR adds engine-native call_saved_workflow support. A parent workflow can select a saved workflow, bind values or connections to its exposed fields, suspend at the call node, execute the selected workflow as first-class child queue item(s), capture explicit named return values, and resume the parent workflow.

The implementation includes backend call-boundary execution, parent/child queue relationship metadata, access validation, dynamic input binding, bounded nested calls, strict child failure propagation, root-oriented retry behavior, child-row cancel/delete semantics, compatibility reporting, and named workflow returns via workflow_return_value, workflow_return, and workflow_return_get.

Related Issues / Discussions

This has been discussed many times on Discord.

QA Instructions

New tests in:

  • tests/app/invocations/test_call_saved_workflows.py
  • tests/app/services/test_workflow_call_batch.py
  • tests/app/services/test_workflow_call_batch_runtime.py
  • tests/app/services/test_workflow_call_compatibility.py
  • tests/app/services/test_workflow_call_runtime.py
  • tests/app/services/test_workflow_graph_builder.py
  • tests/app/services/workflow_call_test_utils.py

Manual return-value test plan (note that this PR includes a database migration!):

  1. Create a child workflow with integer, workflow_return_value, collect, and workflow_return.
  2. Connect integer.value to workflow_return_value.value.
  3. Set workflow_return_value.key to result.
  4. Connect workflow_return_value.value to collect.item.
  5. Connect collect.collection to workflow_return.values.
  6. Save the child workflow.
  7. Create a parent workflow with call_saved_workflow, workflow_return_get, and a downstream node such as add.
  8. Select the saved child workflow in call_saved_workflow.
  9. Connect call_saved_workflow.values to workflow_return_get.values.
  10. Set workflow_return_get.key to result.
  11. Connect workflow_return_get.value to add.a.
  12. Set add.b to a literal value.
  13. Run the parent workflow and confirm add.value equals the returned child value plus add.b.

For batch behavior, replace the child integer with integer_batch connected to integer.value, then return the integer.value through the same workflow_return_value path. The parent should receive result as a list of returned values.

Merge Plan

This branch includes a queue/session migration for workflow-call relationship metadata. Recheck migration ordering against other in-flight migrations before final merge.

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)

Copilot AI and others added 30 commits March 5, 2026 20:09
* Add per-user workflow isolation: migration 28, service updates, router ownership checks, is_public endpoint, schema regeneration, frontend UI

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

* feat: add shared workflow checkbox to Details panel, auto-tag, gate edit/delete, fix tests

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
…mode (invoke-ai#116)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
… mode (#120)

* Disable Save when editing another user's shared workflow in multiuser mode

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
…-board filter, archive

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
…image, etc.)

Previously, images in shared boards owned by another user could not be
dragged at all — the draggable setup was completely skipped in
GalleryImage.tsx when canWriteImages was false. This blocked ALL drop
targets including the viewer, reference image pane, and canvas.

Now images are always draggable. The board-move restriction is enforced
in the dnd target isValid functions instead:
- addImageToBoardDndTarget: rejects moves from shared boards the user
  doesn't own (unless admin or board is public)
- removeImageFromBoardDndTarget: same check

Other drop targets (viewer, reference images, canvas, comparison, etc.)
remain fully functional for shared board images.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…-allow-shared-boards' into copilot/enhancement-allow-shared-boards
Stacked on top of origin PR invoke-ai#9018 (shared/private workflows and boards) for multiuser workflow visibility semantics.
@github-actions github-actions Bot added api python PRs that change python files invocations PRs that change invocations services PRs that change app services frontend PRs that change frontend files python-tests PRs that change python tests docs PRs that change docs labels Apr 29, 2026
@JPPhoto JPPhoto marked this pull request as draft April 29, 2026 17:25
@JPPhoto JPPhoto marked this pull request as ready for review April 29, 2026 17:42
@JPPhoto JPPhoto marked this pull request as draft April 29, 2026 18:21
@JPPhoto JPPhoto added the backend PRs that change backend files label Apr 30, 2026
@JPPhoto JPPhoto marked this pull request as ready for review April 30, 2026 02:05
@JPPhoto JPPhoto force-pushed the call-saved-workflows branch from 7152bff to 11d3eb7 Compare April 30, 2026 02:26
@lstein
Copy link
Copy Markdown
Collaborator

lstein commented Apr 30, 2026

Should this be tagged for 6.13?

@JPPhoto
Copy link
Copy Markdown
Collaborator Author

JPPhoto commented Apr 30, 2026

Should this be tagged for 6.13?

In an ideal world, with enough reviewers, sure. But realistically, the number of reviewers should be >1 and it should hit main just after 6.13 is released. This is a massive structural change and it should be in 6.14.

…ches/204380-1777639603/31cb653f40eceef89f75012837b2fcce2fafe2c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api backend PRs that change backend files docs PRs that change docs frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests services PRs that change app services

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants