Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

docs(execution): document direct fan-in ownership

JPPhoto18ce6b82a293
diff --git a/docs/src/content/docs/contributing/loop-nodes.md b/docs/src/content/docs/contributing/loop-nodes.md
index eea78366fb..32ce693a69 100644
--- a/docs/src/content/docs/contributing/loop-nodes.md
+++ b/docs/src/content/docs/contributing/loop-nodes.md
@@ -111,8 +111,10 @@ explicit empty close. A direct `Iterate.item` consumer waits for the canonical s
its ordered values; a missing stream falls back to materialized results for legacy snapshots. The exact fresh four-node
`literal collection source -> Iterate -> one ordinary body -> Collect` shape and any number of ordinary downstream
consumers from `Collect.collection` use a private graph-state planner for prepared-copy expansion, iteration paths,
-and the empty-stream barrier. Fan-in, nested or input-driven iterators, and mixed control flow remain on the
-compatibility materializer for those responsibilities.
+and the empty-stream barrier. The exact fresh two-source/two-`Iterate`/shared-`Collect.item` fan-in shape also uses
+the planner for independent stream expansion, closure gating, and deterministic source-ordered hydration. Fan-in
+beyond that shape, nested or input-driven iterators, and mixed control flow remain on the compatibility materializer
+for those responsibilities.
Focused compatibility coverage now proves empty, nested, fan-in, partial/rehydrated, failed, canceled, and retried
Iterate/Collect sessions. This is evidence for the current adapters; it does not remove materialization or queue
ownership. Direct `Iterate`/`Collect`-only graphs and the exact bounded nested shape now use the generic scheduler
diff --git a/invokeai/app/services/shared/README.md b/invokeai/app/services/shared/README.md
index 17caa30a0b..58a8e8fa5e 100644
--- a/invokeai/app/services/shared/README.md
+++ b/invokeai/app/services/shared/README.md
@@ -23,8 +23,10 @@ completion mirrors each Iterate result into that ledger before releasing `Collec
`literal collection source -> Iterate -> one ordinary body -> Collect`, plus any number of ordinary downstream
consumers from `Collect.collection`, is planned by a private graph-state planner, which owns its prepared-copy
expansion, iteration paths, downstream admission, and explicit empty-stream barrier without calling the legacy
-materializer. The planner excludes fan-in, nested or input-driven iterators, and all mixed control flow;
-those shapes retain materializer copy expansion, grouping, and empty-source handling on the legacy compatibility route.
+materializer. The exact fresh two-source/two-`Iterate`/shared-`Collect.item` fan-in shape also uses the planner for
+two independent stream expansions, closure gating, and deterministic source-ordered hydration. Fan-in beyond that
+shape, nested or input-driven iterators, and all mixed control flow retain materializer copy expansion, grouping, and
+empty-source handling on the legacy compatibility route.
A fresh graph with exactly one static, non-empty `For`/`ForReturn` pair and ordinary body nodes also uses the generic
adapter. It projects readiness and invokes the graph-state continuation boundary, which selects the next iteration or
finalizes the aggregate without exposing a successor node ID to the generic scheduler. The materializer still owns
@@ -159,8 +161,9 @@ nested-`For` shape and the canonical outer-`For`/bounded-`Iterate`/`Collect` sha
one ordinary preparation node from `For.item` into `Iterate.collection`, one ordinary body node into `Collect.item`,
the `Collect.collection` output into the linked `ForReturn`, and one final outer-output consumer. Each outer iteration,
including an empty inner collection, remains isolated by its frame path. `Iterate` also records non-empty item streams through the generic effect ledger;
-the materializer remains authoritative for expansion, iteration paths, collector grouping, and
-empty-source compatibility handling. Direct `Collect.item` consumers now use the closed stream ledger when available;
+the materializer remains authoritative for fallback expansion, iteration paths, collector grouping, and
+empty-source compatibility handling. The exact fresh four-node body shape and exact two-stream fan-in shape use
+the private planner for those responsibilities. Direct `Collect.item` consumers now use the closed stream ledger when available;
the full Iterate/Collect compatibility matrix covers empty, nested, fan-in, partial rehydration, failure, cancellation,
and retry behavior. This evidence does not remove the materializer or queue adapters.
@@ -253,8 +256,9 @@ Activation effects are excluded from data-stream handling. `IterateInvocation` i
control-flow invocation on this seam: each non-empty prepared copy emits one ordered `item` effect with its iteration
index, and the final copy emits one `close_stream` effect. Direct Iterate/Collect-only graphs now run through the
generic scheduler adapter; its completion maps these results/effects to the existing frame-scoped iteration-stream
-identity, so legacy output mirroring is idempotent. The exact fresh four-node source/Iterate/body/Collect shape and
-any number of ordinary downstream consumers use the private planner described above; fallback shapes still let the
+identity, so legacy output mirroring is idempotent. The exact fresh four-node source/Iterate/body/Collect shape,
+its ordinary downstream consumers, and the exact two-stream fan-in shape use the private planner described above;
+fallback shapes still let the
materializer create
prepared copies, derive iteration paths, group collector inputs, and record the explicit close for an empty source.
For a direct `Iterate.item` edge, the scheduler defers `CollectInvocation` while its canonical stream is open, and
@@ -302,8 +306,8 @@ frame-scoped continuation effects and generic readiness/continuation
projection.
Direct `Iterate`/`Collect`-only graphs use the generic scheduler adapter for
readiness and completion. The exact fresh four-node source/Iterate/body/Collect
-shape and any number of ordinary downstream-consumer extensions use the private planner for expansion and
-empty-stream closure; workflow-call
+shape, its ordinary downstream-consumer extensions, and the exact two-stream
+fan-in shape use the private planner for expansion and empty-stream closure; workflow-call
invocations, unsupported loop shapes, and mixed control-flow graphs remain on
compatibility paths. `ForInvocation` and
`ForReturnInvocation` now declare one validated, frame-scoped `continuation`
@@ -571,9 +575,9 @@ In normal execution, all runtime expansion occurs in `execution_graph` with trac
- A non-empty `IterateInvocation` emits one `item` effect per prepared copy,
with a contiguous sequence beginning at zero, and closes its canonical
source/parent-path stream on the final copy. Exact output mirroring is
- idempotent. The private planner closes an empty stream for the exact fresh
- source/Iterate/body/Collect shape; fallback shapes retain materializer
- compatibility ownership.
+ idempotent. The private planner closes empty streams for the exact fresh
+ source/Iterate/body/Collect and two-stream fan-in shapes; fallback shapes
+ retain materializer compatibility ownership.
- Collectors wait for available direct Iterate streams to close, then aggregate
their ledger values in stream order and may also merge incoming `collection`
inputs during runtime hydration. A missing ledger remains a legacy snapshot