Skip to content

Add chained collect node#8933

Open
JPPhoto wants to merge 2 commits intoinvoke-ai:mainfrom
JPPhoto:chained-collect-node
Open

Add chained collect node#8933
JPPhoto wants to merge 2 commits intoinvoke-ai:mainfrom
JPPhoto:chained-collect-node

Conversation

@JPPhoto
Copy link
Collaborator

@JPPhoto JPPhoto commented Feb 28, 2026

Summary

Feature + fix: enhanced the built-in collect node to support chaining via collect.collection while preserving existing multi-collect.item behavior.

Why:

  • Enable native Collect -> Collect workflows (similar to @skunkworxdark's collection_tools) without breaking existing graphs.
  • Keep collector type safety intact across chained and mixed connection order scenarios.
  • Align frontend connection validation with backend graph validation.

How:

  • Backend (invokeai/app/services/shared/graph.py):
    • collect updated to version="1.1.0".
    • Exposed collection as a real connection input.
    • Kept multi-input behavior for item, single-input behavior for collection.
    • Updated collect input preparation to merge upstream collections + local items.
    • Strengthened collector type resolution for:
      • chained collectors,
      • Any-only collector inputs,
      • union collection annotations containing list branches (T | list[T] | None).
  • Frontend:
    • Unhid collect.collection in schema parsing.
    • Updated collect type inference utility to resolve type through collection chains.
    • Updated node util test fixture for collect input typing.
  • Also fixed Ruff lint in graph_bench.py (list(map(...)) change).

Related Issues / Discussions

https://discord.com/channels/1020123559063990373/1130288930319761428/1477387080966471802

QA Instructions

Backend:

  1. Run:
    • pytest -q tests/test_node_graph.py -k "collector or iterate_accepts_collection or iterate_validates_collection_inputs_against_iterator_outputs"
  2. Confirm collector-chain and type mismatch tests pass, including:
    • late-added upstream mismatch rejection,
    • Any-only collector -> iterate acceptance,
    • union collection input mismatch rejection.

Frontend:

  1. Run:
    • cd invokeai/frontend/web && pnpm run lint:tsc
    • cd invokeai/frontend/web && node_modules/.bin/vitest run src/features/nodes/store/util/getCollectItemType.test.ts src/features/nodes/store/util/validateConnection.test.ts
  2. Confirm no TS errors and tests pass.

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)

@github-actions github-actions bot added python PRs that change python files services PRs that change app services frontend PRs that change frontend files python-tests PRs that change python tests labels Feb 28, 2026
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 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.

1 participant