Repository navigation
fix(images): display resolved inputs and preserve source graphs - #10035
wunianze666-netizen wants to merge 9 commits into
Conversation
Save prepared execution nodes so image graph inputs and node IDs match the run. Keep source-graph fallback and workflow metadata unchanged.
Cover persisted graph inputs and node identity through a fresh PNG reader, alongside non-null workflow retention.
JPPhoto
left a comment
There was a problem hiding this comment.
Please fix:
invokeai/app/services/shared/invocation_context.py:327-328. This also applies to nestedIterateworkflows. With N outer items, M inner items, and one saved image per innermost item, the runtime graph can contain O(N*M) node copies; embedding that graph in all N*M images can produce O((N*M)^2) total graph metadata. Likelihood: plausible for large nested batches. Test: no looped image-save size test. Fix: measure nested loops and store a compact per-image record of resolved inputs.
Record active inputs and ordinary ancestors without sibling batch expansion. Cover nested Iterate metadata growth and legacy PNG readers.
|
Addressed in 70edbae, with the CI fixture follow-up ec18c74. The saved Graph JSON now records the active invocation and ordinary upstream resolved inputs, using indexed input edges. Traversal stops at control/collection boundaries, so it does not copy sibling iterations or future nodes. A separate regression retains upstream Measured through real nested Iterate execution, image-save calls, PNG files and a fresh reader:
Each revised image in those fixed-width fixtures contains 313 graph bytes; this is JSON payload measurement, not a generation-speed or universal size-bound claim. The original nested case fails the new compact-record contract before the fix. Final focused selection:13 passed. Related service/storage/metadata/Graph plus native import checks:199 passed,11 existing Windows directory-fsync skips,6 deprecation warnings. Ruff0.11.2/checkformat/diff and normal commit hooks passed. No GPU/full-model or browser-replay validation is claimed. CI follow-up: macOS found one child-workflow metadata test still supplying an untyped MagicMock invocation. I reproduced the same failure locally and replaced only that fixture with a real BlankImageInvocation; all parent/project, workflow-byte and single-lookup assertions are unchanged. Targeted red1fail -> green1pass; the complete queue metadata module35pass,4deprecationwarnings. Production/docs/image-test files remain byte-identical to70edbae991. The previous70 CI failure is retained as history; the new head has a fresh CI run. |
Keep the child-workflow PNG inheritance fixture on the BaseInvocation contract without changing its assertions.
JPPhoto
left a comment
There was a problem hiding this comment.
Please fix:
invokeai/app/services/shared/invocation_context.py:327-329. For graph-only images usingIterate,If, orCollect, the compact record omits those boundary nodes.executeLoadMediaWorkflow()still converts the graph into an editable workflow, so loading such an image opens a partial graph without its original loop or control structure. Likelihood: supported whenworkflowis null. Recovery: only if the original graph is available elsewhere. Fix: preserve the source graph for this fallback and store resolved inputs separately. Test: no graph-only restore test; PR CI passes on the pinned head.
Keep graph-only workflow restoration complete and persist a separate compact PNG input record. Cover control boundaries through real image services and retain user metadata and workflow JSON.
|
Addressed review5681837512 in 6a2a8ef.
Four new graph-only cases (Iterate, both If branches, Collect) fail source-graph equality on the unchanged ec18c74 production code, then pass through real temporary SQLite/ImageService, PNG files and a fresh reader after the fix. A legacy-call control also passes. The broader selection passes242 tests, with11 existing Windows directory-fsync skips and6 deprecation warnings. Ruff0.11.2/checkformat/diff and normal commit hooks passed. Counting both persisted graph fields, the nested2x3/4x6 fixtures total9,072/37,680 bytes; the earlier expanded-runtime snapshots totaled38,145/525,036. Source literal collections grow, so this is a fixture JSON-byte comparison, not a universal linear-size or speed/memory claim. The diagnostic chunk is readable through PNG Image.info; existing workflow/graph API and upload re-encoding contracts are unchanged. Browser/editor interaction and GPU/full-model validation were not run. Fresh CI is running on the new head. |
JPPhoto
left a comment
There was a problem hiding this comment.
Other findings/issues:
invokeai/app/services/shared/invocation_context.py:328-343: Graph-only images keep source defaults ininvokeai_graph; resolved values go only intoinvokeai_resolved_inputs. The workflow API returnsinvokeai_graph(invokeai/app/api/routers/images.py:395-398), which the Graph tab displays (invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewMetadataPanel.tsx:117-122). Normal Generate images therefore still show default Noise seeds and math values, so issue #6708 remains open in practice. Effect: users cannot inspect actual run inputs in the app. Likelihood: normal graph-only Generate. Recovery: manually read the PNG chunk; no in-app path. Test: current coverage checks resolved values only inImage.infowhile asserting the returned graph is the source graph (tests/app/services/images/test_images_default.py:226-235); add API/UI coverage for displaying resolved values while preserving source-graph loading.
Expose compact PNG input records through the workflow response and prefer them for preview. Retain source graphs for workflow loading and compatible fallbacks for older media.
|
Addressed review5687267454 in a41ed4b, based on the maintainer's1c6d5e5 merge. The existing image Native red evidence:8 backend failures on unchanged1c6 production;1 actual Graph-display mismatch plus85 passing Chromium controls on the unchanged panel. The corrected candidate passes396 related backend tests (11 Windows directory-fsync skips,8 deprecation warnings),86 Chromium browser tests,76 related units,92 architecture checks, API generator tests, frontend lint/types and the production build. Generated OpenAPI/types add only the optional property, and the actual legacy type-only consumer compiles old/new/null payloads. Focused backend tests overlap the396 total. The backend tests use real PNG storage, temporary SQLite/ImageService and FastAPI TestClient, including read-access/maintenance guards, record subfolders and legacy compatibility. The browser tests exercise Graph inspection and the real source-graph workflow conversion. A separate interactive Windows/full-app visual check was not completed; no GPU/full-model or full-repository validation is claimed. Build chunk/import/timing warnings are retained. Fresh CI has started on the new head. |
JPPhoto
left a comment
There was a problem hiding this comment.
Findings/issues:
invokeai/app/services/image_files/image_files_disk.py:695-700: Re-uploading a generated PNG dropsinvokeai_resolved_inputs. Image extraction still reads only metadata, workflow, and graph, and the upload route passes only those fields toimages.create(invokeai/app/api/routers/images.py:180-203). The imported image's Graph tab then falls back to source defaults. Effect: issue #6708 recurs for re-ingested copies. Likelihood: supported cross-instance upload. Recovery: the original PNG retains the field, but app upload does not. Test: add an upload round-trip test that checksresolved_inputsin the workflow response. The PR documents the unchanged upload contract; this limitation leaves re-ingested copies without the fix.
Summary
Generated images now expose their resolved per-image inputs in the app's Graph tab: a run using Noise seed18 or a connected math input17 shows those values rather than source defaults0. The workflow response returns a separate optional
resolved_inputsrecord;graphand authoredworkflowremain the restoration inputs, preserving loop and control structure when loading an image as an editable workflow.PNG persistence retains the complete source Graph plus a compact, indexed record of the active invocation and ordinary ancestors. The compact record stops at control/collection boundaries, avoiding full expanded-runtime graph copies per image. Older images or older responses without diagnostics fall back to their source graph; video preview behavior is unchanged.
Related Issues / Discussions
Closes #6708.
QA Instructions
1c6d5e5head:8 focused failures before production changes. Persisted PNG/service/HTTP regressions now verify resolved seed18/math17, exact source/workflow retention, old files, record subfolders, read access, maintenance and missing-file behavior.check,format --checkandgit diff --checkpass.Retained nested-PNG measurements count both persisted graph fields:2x3 images total9,072 UTF-8 JSON bytes;4x6 images total37,680. The earlier expanded-runtime samples total38,145/525,036 bytes. These measurements are from the preceding persistence revision; this change exposes those records rather than introducing a new performance benchmark. Literal source collections and retained list inputs may still be large.
The actual Chromium component interactions passed. A screenshot was inspected, but a separate interactive desktop/full-app validation was not completed. No physical GPU/full-model generation, full-repository typecheck or docs build is claimed.
Review
The Graph tab now consumes the persisted resolved record through the same guarded image workflow API. Loading a workflow continues to consume the complete source graph or authored workflow, rather than the diagnostic projection. The record retains runtime IDs and ordinary upstream seeds/math inputs; it is not a full execution trace or a universal size bound.
AI assistance was used for implementation, tests and analysis.
Compatibility / Rollout
The workflow response adds optional nullable
resolved_inputs; existinggraphandworkflowcontents are unchanged. Old PNGs return null and old responses may omit the property. The shared video response uses the null default. No database migration, dependency or lockfile changes are needed. User generation metadata is not repurposed. File copies preserve the diagnostic PNG chunk; upload re-encoding still follows its existing three-channel extraction contract. Missing source data in previously compact-only files cannot be recovered by this change.Checklist
What's Newcopy (if doing a release after this PR)Need help on this PR? Tag
@codesmith-botwith what you need.