Repository navigation
feat(nodes): propagate conditioning prompt and text encoder metadata (Stage 2) - #10172
skunkworxdark wants to merge 14 commits into
Conversation
Initial Check-in & Status Update (
|
eabd7ab to
578968a
Compare
Rebase & Sync Update (
|
578968a to
05cf76f
Compare
Rebase & Sync Update (
|
05cf76f to
c5cefae
Compare
Rebase & Sync Update (
|
c5cefae to
088f416
Compare
Rebase & Upstream Sync UpdateBranch Audit & Integration Summary:
Test Gates:
|
088f416 to
33e2891
Compare
3e7f33f to
b8fb814
Compare
Review Parity & Defensive Audit Fixes UpdateBranch Audit Fixes Summary:
Test Gates:
|
Stage 2 Update: Centralized Metadata Label Registry (
|
81df465 to
085295b
Compare
Rebase & Sync Update (
|
Registry Completeness & Type-Safety Update (
|
|
Rebased Stage 2 ( Rebase Summary
Local Verification (
|
5ee9a62 to
b8b6d1c
Compare
|
Rebased Stage 2 ( Rebase Summary
Local Verification (
|
b8b6d1c to
1ddb7c8
Compare
|
Rebased Stage 2 ( Rebase Summary
Local Verification (
|
f322e7b to
b54e65e
Compare
|
Synced
|
…data upstream Add optional metadata fields to conditioning classes and populate them across 18 text encoder invocations. Preserve provenance in conditioning modifiers using model_copy and extract in denoise invocations. Support multi-prompt collection extraction and document modifier provenance guidelines.
…gistry Register Stage 2-exclusive component_source key (QwenImageConditioningField.component_source) in CORE_METADATA_REGISTRY, regenerate API contracts, and add Stage 2 coverage in test_core_metadata.py.
…age 1 Add Stage 1 Wan LoRA target and low_noise_weight fields to canonical LoRAMetadataField in fields.py, remove duplicate definition in metadata.py while preserving re-export, regenerate API contracts, and restore extract_conditioning_metadata() documentation in media-metadata.mdx.
b54e65e to
9d5592c
Compare
…ows, and preserve single masked region
|
Synced
|
…etadata # Conflicts: # docs/src/content/docs/development/Architecture/media-metadata.mdx # invokeai/frontend/api/schema.ts
|
Stage 2 is ready for review on PR 10172 (head Handover Summary (Since Prior Sync Update)
Verification
|
…etadata # Conflicts: # invokeai/app/invocations/ideogram4/ideogram4_denoise.py # invokeai/app/invocations/qwen_image/qwen_image_denoise.py # invokeai/app/invocations/sd3/sd3_denoise.py # invokeai/app/invocations/z_image/z_image_denoise.py # invokeai/frontend/api/openapi.json
Summary
In Stage 1 (#10083), native metadata building and emission was unified across all 19 image and video denoise invocations for generation-level parameters (dimensions, steps, CFG/guidance, scheduler, seeds, main model, VAE, transformer LoRAs, and ControlNets/adapters). However, prompts, standalone text encoders, encoder-specific LoRAs, and conditioning modifiers still required manual metadata wiring or wrapper nodes because conditioning edges carried only raw tensor names.
Stage 2 extends metadata propagation upstream along the conditioning edge (
*ConditioningField), enabling text encoders, modifier nodes, and denoisers to propagate provenance automatically without extra graph wiring or breaking existing workflows:prompt,style_prompt,loras, standalone text encoders, and modifier flags) withdefault=Noneacross all 16*ConditioningFieldclasses ininvokeai/app/invocations/fields.py.*ConditioningFieldwithprompt, standalone text encoder models (t5_encoder,clip_embed_model,clip_l_model,clip_g_model,mistral_encoder,qwen3_encoder,qwen3_vl_encoder, etc.), and text-encoder LoRAs.Krea2ConditioningRebalanceInvocation,Krea2SeedVarianceInvocation,ZImageSeedVarianceEnhancerInvocation, andConditioningInvocation(masking) now use non-mutatingself.conditioning.model_copy(update={...}), ensuring that upstream prompt, model, and LoRA provenance flows unbroken through arbitrarily chained modifiers.extract_conditioning_metadata): Implemented ininvokeai/app/invocations/metadata.pyand integrated into_build_metadata()across all 19 base denoise invocations:positive_conditioningsetspositive_prompt;negative_conditioningsetsnegative_prompt.loras.rebalance_*(Krea-2),seed_variance_*(Krea-2 and Z-Image), and layout/caption metadata (flux3_caption,ideogram4_caption,moss_image_layout_prompt).positive_style_promptandnegative_style_prompt.Collectnode into denoise), unmasked non-empty prompts (mask is None) are joined with", "intopositive_prompt(and analogously fornegative_prompt), keeping single-string UI consumers and gallery recall complete while preventing masked regional prompts from leaking into the global prompt. When every conditioning in a collection is masked, all non-empty prompts are joined with", "as a complete summary fallback while keeping each region separate.positive_prompts: list[str](andnegative_prompts: list[str]), avoiding ambiguous delimiter parsing and preserving exact raw prompt strings.denoise_latents): Downstream SDXL refiner passes remap.styleconditioning text torefiner_positive_style_prompt/refiner_negative_style_promptand preserve the base pass'sdenoising_start,denoising_end,positive_prompt,negative_prompt,positive_style_prompt, andnegative_style_prompt.regionsis emitted only for conditionings carrying a regionalmask(mask is not None), keeping unmasked global prompts out ofregionswhilepositive_promptspreserves every collected prompt, and Gallery Image Details (previewMetadata.ts) displays both CanvaspositivePromptand backendpositive_promptregion entries.positive_prompts,negative_prompts,refiner_positive_style_prompt, andrefiner_negative_style_prompttoCORE_LABELSandCORE_LABELS_STRINGinmetadata_constants.py, enabling workflows to extract them cleanly viaMetadataToStringCollectionInvocation/MetadataToStringInvocation.metadata_constants.py): Consolidated 9 duplicate hand-maintained label sets and literals into a single, type-safeCORE_METADATA_REGISTRYusingMetadataType(str, Enum). Eliminates label drift across modules, guarantees* CUSTOM LABEL *as index 0 for UI dropdown defaults, and automatically derives all UI dropdown literals (CORE_LABELS*) and runtime model unwrapping sets (CORE_MODEL_LABELS).docs/src/content/docs/development/Guides/creating-nodes.mdxillustrating themodel_copy(update={...})pattern for third-party custom node developers.docs/src/content/docs/development/Architecture/media-metadata.mdxto reflect automatic conditioning metadata extraction and the newpositive_prompts/negative_promptsand style prompt schema fields.docs/src/content/docs/Users Guide/08.Workflows/editor-reference.mdxexplaining Denoise-to-Decode metadata wiring, multi-prompt collections, and workflow metadata recovery viaMetadata to StringandMetadata to String Collection.Architectural Roadmap: 3-Stage Metadata Unification
This PR is Stage 2 of the three-stage initiative:
Related Issues / Discussions
QA Instructions
Automated Verification
uv run --no-sync pytest tests/app/invocations/test_conditioning_metadata.py tests/app/invocations/test_denoise_metadata.py tests/app/invocations/test_core_metadata.py(98 passed)uv run --no-sync pytest -n 8 -m "not ffmpeg" tests/app/invocations/ tests/backend/architectures/ tests/app/services/workflow_records/test_default_workflows_registry.py(4,782 passed, 3 skipped)CORE_METADATA_REGISTRYparity audited (46/46modified invocations bumped,0unbumped,0version regressions,138registry keys OK)uv tool run --offline ruff@0.11.2 check .&format --check .(passed,2,760files clean)@invoke-ai/api-contracts:pnpm format:openapi,pnpm typegen,pnpm lint,pnpm test(2/2passed)invokeai/frontend/webv2):pnpm lint:code(oxfmt,oxlint,lint:tsc),pnpm architecture:check(8 files, 83 passed), and recall/preview Vitest suites (5 files, 997 tests passed)c1356815b5): 30 passed, 3 skipped, 0 failedLive In-App Scenarios Verified (10/10 PASS)
flux_text_encoderprompts combined viaCollectintoflux_denoise(joinedpositive_prompt, rawpositive_prompts, noregions, standalonet5_encoder&clip_embed_model).krea2_conditioning_rebalance->krea2_seed_variance->krea2_denoise(krea2_rebalance_*,krea2_seed_variance_*,qwen3_vl_encoder).z_image_text_encoder->z_image_seed_variance_enhancer->z_image_denoise(z_image_seed_variance_*,qwen3_encoder).sdxl_compel_prompt-> basedenoise_latents->sdxl_refiner_compel_prompt-> refinerdenoise_latents(preserves base prompts,positive_style_prompt/negative_style_prompt, anddenoising_start/denoising_end; recordsrefiner_*includingrefiner_positive_style_prompt/refiner_negative_style_prompt).positive_promptsviametadata_to_string_collection.compelpositive/negative polarity andclip_skippropagation intodenoise_latents.wan_text_encoder->wan_video_denoise->wan_l2v(wan_t5_encoder_model,wan_transformer_low_noise, high/low experttargetLoRAs).flux3_layout_prompt->flux3_text_encoder->flux3_denoise(qwen3_vl_encoder, layout caption prompt).flux_lora_loaderdeduplicated across CLIP/T5/transformer; overlapping masked regions rendered cleanly underRegionsin Gallery Image Details alongside unmasked globalpositive_prompt.compel->conditioningprimitive ->denoise_latentswithlora_loaderdedup, upstreammetadata_item_linked(component_source) passthrough, andmetadata_to_stringrecovery.Review
positive_prompts/negative_promptscollection tracking alongside joined unmasked/all-masked summary strings, masked-onlyregionsemission + Image Details camelCase/snake_case display parity, SDXL refinerrefiner_*_style_promptremapping without clobbering base prompts or denoising bounds, safe LoRA deduplication, defensive handling of partial/mocked inputs across unit tests, and full backward compatibility on legacy/custom conditioning edges.4,782pytest +997frontend recall/preview tests). No regressions observed.Compatibility / Rollout
*ConditioningFielddefault toNone. Existing saved workflows, custom nodes, and cached graph executions run without modification or errors.ConditioningField(conditioning_name=...)) continue to instantiate cleanly. If a custom node does not usemodel_copy, downstream denoise nodes gracefully skip prompt metadata without failing.positive_promptandnegative_promptidentically to existing behavior; multi-prompt workflows exposepositive_promptsandnegative_promptsas collections.Checklist
What's Newcopy (if doing a release after this PR)