Enforce core-aligned nonblocking validation

This commit is contained in:
ukr8b3g-cmyk
2026-08-19 23:40:57 +09:00
parent 548d9647f6
commit f76beb1319
4 changed files with 39 additions and 28 deletions
+4 -2
View File
@@ -4,11 +4,12 @@
Native MiniMax H3 audio/video continuation for ComfyUI. V1 supplies manual Join/Finish nodes; V2 integrates N chunks over the same continuation core. Native MiniMax H3 audio/video continuation for ComfyUI. V1 supplies manual Join/Finish nodes; V2 integrates N chunks over the same continuation core.
## Non-negotiable rules ## Non-negotiable rules
- Follow ComfyUI Core behavior for user-facing validation. Do not add Continuum-only input restrictions or compatibility stops without documenting and obtaining approval for the exception. - Follow ComfyUI Core behavior for user-facing validation. Continuum-only prompt restrictions, model allowlists, compatibility gates, and policy-based execution stops are prohibited.
- Do not implement a new user-facing hard stop. If execution is structurally impossible or continuing risks corrupting stored data, document the exact broken internal contract and obtain explicit approval before changing the stop.
- Prompt content must never block execution. Empty, malformed, incomplete, or unknown prompt syntax falls back to a Fixed prompt and is passed through as entered. Valid Timeline/List/JSON syntax is still parsed normally. - Prompt content must never block execution. Empty, malformed, incomplete, or unknown prompt syntax falls back to a Fixed prompt and is passed through as entered. Valid Timeline/List/JSON syntax is still parsed normally.
- Keep warnings diagnostic-only unless execution cannot continue safely. Hard stops are limited to corrupt internal contracts such as invalid latent/layout topology, incompatible Assembly Plan data, broken stored revision schema/hash, unusable required payloads, or decode formats that cannot be assembled. - Keep warnings diagnostic-only unless execution cannot continue safely. Hard stops are limited to corrupt internal contracts such as invalid latent/layout topology, incompatible Assembly Plan data, broken stored revision schema/hash, unusable required payloads, or decode formats that cannot be assembled.
- Unknown upstream nodes, models, wrappers, or merged models must not be rejected solely because they are unknown. - Unknown upstream nodes, models, wrappers, or merged models must not be rejected solely because they are unknown.
- Keep legacy `strict_compatibility` inputs loadable for old workflows, but they must not enable Continuum-only blocking behavior. - Keep legacy `strict_compatibility` inputs loadable for old workflows, but ignore their value. They must never enable blocking behavior.
- Before code changes, create a snapshot of the active local runtime. Preserve the current compact V3.4 UI unless the user explicitly approves a UI change. - Before code changes, create a snapshot of the active local runtime. Preserve the current compact V3.4 UI unless the user explicitly approves a UI change.
- Runtime tests must record the workflow, prompt, media inputs, model/LoRA/sampler/step settings, dimensions, chunk count/duration, elapsed time, and observed result. Inspect embedded workflow metadata when present. - Runtime tests must record the workflow, prompt, media inputs, model/LoRA/sampler/step settings, dimensions, chunk count/duration, elapsed time, and observed result. Inspect embedded workflow metadata when present.
- Do not globally replace `PackedLayout`, `MiniMaxH3.extra_conds`, or other ComfyUI classes. - Do not globally replace `PackedLayout`, `MiniMaxH3.extra_conds`, or other ComfyUI classes.
@@ -39,5 +40,6 @@ GPU checks must cover Sage only, Sage+Sol, Sage+Spectrum, and Sage+Sol+Spectrum
- Source repository: `D:\Codex\_git_push_work\ComfyUI-H3-Continuum` - Source repository: `D:\Codex\_git_push_work\ComfyUI-H3-Continuum`
- Active ComfyUI runtime: `D:\StabilityMatrix\Data\Packages\ComfyUI_WAN\custom_nodes\ComfyUI-H3-Continuum` - Active ComfyUI runtime: `D:\StabilityMatrix\Data\Packages\ComfyUI_WAN\custom_nodes\ComfyUI-H3-Continuum`
- Reuse the repository's existing pytest configuration and helper scripts instead of rediscovering paths on every task. - Reuse the repository's existing pytest configuration and helper scripts instead of rediscovering paths on every task.
- Read this file before each task. Record durable project decisions, paths, commands, failure causes, and validation methods here so later work reuses them instead of restarting from zero.
- GitHub authentication for this repository is already configured. Do not request a new login or token unless an actual authentication command fails. - GitHub authentication for this repository is already configured. Do not request a new login or token unless an actual authentication command fails.
- Commit and push only when the user explicitly requests publication. - Commit and push only when the user explicitly requests publication.
+13 -8
View File
@@ -721,7 +721,7 @@ class H3ContinuumSampler:
if prompt_overrides is not None and not isinstance(prompt_overrides, dict): if prompt_overrides is not None and not isinstance(prompt_overrides, dict):
raise TypeError("prompt_overrides must be an H3_CONTINUUM_CLIP_OVERRIDES pack") raise TypeError("prompt_overrides must be an H3_CONTINUUM_CLIP_OVERRIDES pack")
if advanced is not None and not isinstance(advanced, dict): if advanced is not None and not isinstance(advanced, dict):
raise TypeError("advanced must be an H3_CONTINUUM_ADVANCED pack") advanced = None
advanced_values = { advanced_values = {
"audio_continuity": True, "audio_continuity": True,
@@ -739,6 +739,7 @@ class H3ContinuumSampler:
} }
if advanced: if advanced:
advanced_values.update(advanced) advanced_values.update(advanced)
advanced_values["strict_compatibility"] = False
clip_prompt_inputs = {} clip_prompt_inputs = {}
if prompt_overrides: if prompt_overrides:
@@ -746,12 +747,16 @@ class H3ContinuumSampler:
type(prompt_overrides.get("schema_version")) is not int type(prompt_overrides.get("schema_version")) is not int
or prompt_overrides.get("schema_version") != SPARSE_OVERRIDE_SCHEMA_VERSION or prompt_overrides.get("schema_version") != SPARSE_OVERRIDE_SCHEMA_VERSION
): ):
raise ValueError("unsupported H3_CONTINUUM_CLIP_OVERRIDES schema") prompt_overrides = None
sparse_overrides = validate_sparse_prompt_overrides( if prompt_overrides is not None:
prompt_overrides.get("overrides"), chunks=int(chunks) try:
) sparse_overrides = validate_sparse_prompt_overrides(
for index, prompt in sparse_overrides.items(): prompt_overrides.get("overrides"), chunks=int(chunks)
clip_prompt_inputs[f"clip_{index}_prompt"] = prompt )
except (TypeError, ValueError):
sparse_overrides = {}
for index, prompt in sparse_overrides.items():
clip_prompt_inputs[f"clip_{index}_prompt"] = prompt
images, audio, last_state, session, report = H3ContinuumSamplerV2().run( images, audio, last_state, session, report = H3ContinuumSamplerV2().run(
model=model, model=model,
@@ -773,7 +778,7 @@ class H3ContinuumSampler:
diagnostics=advanced_values["diagnostics"], diagnostics=advanced_values["diagnostics"],
reroll_from_chunk=advanced_values["reroll_from_chunk"], reroll_from_chunk=advanced_values["reroll_from_chunk"],
reroll_nonce=advanced_values["reroll_nonce"], reroll_nonce=advanced_values["reroll_nonce"],
strict_compatibility=advanced_values["strict_compatibility"], strict_compatibility=False,
debug=advanced_values["debug"], debug=advanced_values["debug"],
seam_correction=seam_correction, seam_correction=seam_correction,
first_frame=first_frame, first_frame=first_frame,
+4 -3
View File
@@ -110,14 +110,15 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si
decode_estimate_gib=0.0; available_ram_gib=None decode_estimate_gib=0.0; available_ram_gib=None
if not latent_only: decode_estimate_gib,available_ram_gib=_check_decode_memory_budget(width=width,height=height,chunks=chunks,chunk_seconds=chunk_seconds) if not latent_only: decode_estimate_gib,available_ram_gib=_check_decode_memory_budget(width=width,height=height,chunks=chunks,chunk_seconds=chunk_seconds)
issues=check_comfy_h3_runtime() issues=check_comfy_h3_runtime()
if issues and strict_compatibility: raise SequenceRuntimeError("H3 runtime is incompatible: "+"; ".join(issues)) strict_compatibility=False
if issues: LOG.warning("H3 runtime compatibility notes: %s","; ".join(issues))
assets=prepare_identity_assets(video_vae,width=width,height=height,first_frame=first_frame,last_frame=last_frame,encode_latents=False) assets=prepare_identity_assets(video_vae,width=width,height=height,first_frame=first_frame,last_frame=last_frame,encode_latents=False)
visual_identity_hash=reference_assets.combined_hash if reference_assets is not None else assets.identity_hash visual_identity_hash=reference_assets.combined_hash if reference_assets is not None else assets.identity_hash
sequence_identity_hash=combine_reference_audio_identity(visual_identity_hash,reference_audio_source) sequence_identity_hash=combine_reference_audio_identity(visual_identity_hash,reference_audio_source)
sequence_identity_hash=combine_timeline_video_identity(sequence_identity_hash,timeline_video_source) sequence_identity_hash=combine_timeline_video_identity(sequence_identity_hash,timeline_video_source)
current_model_fingerprint=model_fingerprint(model,extra_wrapper_keys=("h3_continuum_join.apply_model.v1",)) current_model_fingerprint=model_fingerprint(model,extra_wrapper_keys=("h3_continuum_join.apply_model.v1",))
if storage_controller is not None: if storage_controller is not None:
stored_session=storage_controller.prepare(model=model,model_fingerprint_value=current_model_fingerprint,clip=clip,video_vae=video_vae,sampler=sampler,sigmas=sigmas,prompt_plan=plan,width=width,height=height,chunk_seconds=chunk_seconds,continuity=continuity,audio_continuity=audio_continuity,base_seed=base_seed,reroll_from_chunk=reroll_from_chunk,reroll_nonce=reroll_nonce,first_frame_hash=assets.first_frame_hash,last_frame_hash=assets.last_frame_hash,identity_hash=sequence_identity_hash,strict_compatibility=strict_compatibility,existing_session=session,reference_contract=reference_assets.contract if reference_assets is not None else None,conditioning_mode=conditioning_mode,reference_audio_contract=reference_audio_source.contract if reference_audio_source is not None else None,reference_audio_vae=reference_audio_vae,timeline_video_contract=timeline_video_source.contract if timeline_video_source is not None else None) stored_session=storage_controller.prepare(model=model,model_fingerprint_value=current_model_fingerprint,clip=clip,video_vae=video_vae,sampler=sampler,sigmas=sigmas,prompt_plan=plan,width=width,height=height,chunk_seconds=chunk_seconds,continuity=continuity,audio_continuity=audio_continuity,base_seed=base_seed,reroll_from_chunk=reroll_from_chunk,reroll_nonce=reroll_nonce,first_frame_hash=assets.first_frame_hash,last_frame_hash=assets.last_frame_hash,identity_hash=sequence_identity_hash,strict_compatibility=False,existing_session=session,reference_contract=reference_assets.contract if reference_assets is not None else None,conditioning_mode=conditioning_mode,reference_audio_contract=reference_audio_source.contract if reference_audio_source is not None else None,reference_audio_vae=reference_audio_vae,timeline_video_contract=timeline_video_source.contract if timeline_video_source is not None else None)
reroll_nonce=storage_controller.effective_reroll_nonce reroll_nonce=storage_controller.effective_reroll_nonce
if stored_session is not None: session=stored_session if stored_session is not None: session=stored_session
accelerators=accelerator_summary(model) accelerators=accelerator_summary(model)
@@ -171,7 +172,7 @@ def run_sequence(*,model:Any,clip:Any,video_vae:Any,audio_vae:Any,sampler:Any,si
video_context,audio_context,grid_offset=select_context(previous_state,context_frames,include_audio=bool(audio_continuity)); context_before=context_fingerprint(video_context,audio_context) video_context,audio_context,grid_offset=select_context(previous_state,context_frames,include_audio=bool(audio_continuity)); context_before=context_fingerprint(video_context,audio_context)
conditioning=prepare_conditioning(base_conditioning,video_context=video_context,audio_context=audio_context,audio_grid_offset=grid_offset,context_frames=context_frames,new_frame_count=shape.total_frames,first_frame_policy=POLICY_REPLACE,preserve_last_frame=True) conditioning=prepare_conditioning(base_conditioning,video_context=video_context,audio_context=audio_context,audio_grid_offset=grid_offset,context_frames=context_frames,new_frame_count=shape.total_frames,first_frame_policy=POLICY_REPLACE,preserve_last_frame=True)
clip_index=int(previous_state["clip_index"])+1; chunk_plan=make_plan(continuation=True,clip_index=clip_index,total_frames=shape.total_frames,trim_frames=context_frames,width=width,height=height,context_frames=context_frames,state_capacity_frames=largest_context_capacity(shape.net_new_frames),requested_extend_seconds=chunk_seconds,debug=debug) clip_index=int(previous_state["clip_index"])+1; chunk_plan=make_plan(continuation=True,clip_index=clip_index,total_frames=shape.total_frames,trim_frames=context_frames,width=width,height=height,context_frames=context_frames,state_capacity_frames=largest_context_capacity(shape.net_new_frames),requested_extend_seconds=chunk_seconds,debug=debug)
chunk_model=clone_model_for_chunk(model,strict=bool(strict_compatibility),debug=bool(debug),chunk_index=clip_index,context_frames=context_frames if previous_state is not None else None) chunk_model=clone_model_for_chunk(model,strict=False,debug=bool(debug),chunk_index=clip_index,context_frames=context_frames if previous_state is not None else None)
sampled=sample_chunk(model=chunk_model,conditioning=conditioning,latent=latent,sampler=sampler,sigmas=sigmas,seed=seed,enable_preview=bool(enable_preview)) sampled=sample_chunk(model=chunk_model,conditioning=conditioning,latent=latent,sampler=sampler,sigmas=sigmas,seed=seed,enable_preview=bool(enable_preview))
if context_before is not None and video_context is not None: assert_context_unchanged(video_context,audio_context,context_before) if context_before is not None and video_context is not None: assert_context_unchanged(video_context,audio_context,context_before)
entry=make_chunk_entry(latent=sampled,plan=chunk_plan,prompt=prompt,prompt_hash=prompt_hash_value,seed=seed,context_frames=context_frames,motion_score=motion_score,reused=False); previous_state=entry_to_state(entry); entries.append(entry) entry=make_chunk_entry(latent=sampled,plan=chunk_plan,prompt=prompt,prompt_hash=prompt_hash_value,seed=seed,context_frames=context_frames,motion_score=motion_score,reused=False); previous_state=entry_to_state(entry); entries.append(entry)
+18 -15
View File
@@ -84,7 +84,7 @@ class H3ContinuumAdvancedV3:
"step": 1, "step": 1,
}, },
), ),
"strict_compatibility": ("BOOLEAN", {"default": True}), "strict_compatibility": ("BOOLEAN", {"default": False}),
"debug": ("BOOLEAN", {"default": False}), "debug": ("BOOLEAN", {"default": False}),
"show_preview": ("BOOLEAN", {"default": True}), "show_preview": ("BOOLEAN", {"default": True}),
}, },
@@ -121,7 +121,7 @@ class H3ContinuumAdvancedV3:
"diagnostics": diagnostics, "diagnostics": diagnostics,
"reroll_from_chunk": int(reroll_from_chunk), "reroll_from_chunk": int(reroll_from_chunk),
"reroll_nonce": int(reroll_nonce), "reroll_nonce": int(reroll_nonce),
"strict_compatibility": bool(strict_compatibility), "strict_compatibility": False,
"debug": bool(debug), "debug": bool(debug),
"show_preview": bool(show_preview), "show_preview": bool(show_preview),
"last_frame": last_frame, "last_frame": last_frame,
@@ -255,18 +255,16 @@ class H3ContinuumSamplerV3:
timeline_video_source=None, timeline_video_source=None,
): ):
if prompt_overrides is not None and not isinstance(prompt_overrides, dict): if prompt_overrides is not None and not isinstance(prompt_overrides, dict):
raise TypeError( prompt_overrides = None
"prompt_overrides must be an H3_CONTINUUM_CLIP_OVERRIDES pack"
)
if advanced is not None and not isinstance(advanced, dict): if advanced is not None and not isinstance(advanced, dict):
raise TypeError("advanced must be an H3_CONTINUUM_ADVANCED_V3 pack") advanced = None
advanced_values = { advanced_values = {
"audio_continuity": True, "audio_continuity": True,
"diagnostics": DIAGNOSTICS_OPTIONS[0], "diagnostics": DIAGNOSTICS_OPTIONS[0],
"reroll_from_chunk": 0, "reroll_from_chunk": 0,
"reroll_nonce": 0, "reroll_nonce": 0,
"strict_compatibility": True, "strict_compatibility": False,
"debug": False, "debug": False,
"show_preview": True, "show_preview": True,
"last_frame": None, "last_frame": None,
@@ -276,6 +274,7 @@ class H3ContinuumSamplerV3:
} }
if advanced: if advanced:
advanced_values.update(advanced) advanced_values.update(advanced)
advanced_values["strict_compatibility"] = False
clip_prompt_inputs = {} clip_prompt_inputs = {}
if prompt_overrides: if prompt_overrides:
@@ -284,12 +283,16 @@ class H3ContinuumSamplerV3:
or prompt_overrides.get("schema_version") or prompt_overrides.get("schema_version")
!= SPARSE_OVERRIDE_SCHEMA_VERSION != SPARSE_OVERRIDE_SCHEMA_VERSION
): ):
raise ValueError("unsupported H3_CONTINUUM_CLIP_OVERRIDES schema") prompt_overrides = None
sparse_overrides = validate_sparse_prompt_overrides( if prompt_overrides is not None:
prompt_overrides.get("overrides"), chunks=int(chunks) try:
) sparse_overrides = validate_sparse_prompt_overrides(
for index, prompt in sparse_overrides.items(): prompt_overrides.get("overrides"), chunks=int(chunks)
clip_prompt_inputs[f"clip_{index}_prompt"] = prompt )
except (TypeError, ValueError):
sparse_overrides = {}
for index, prompt in sparse_overrides.items():
clip_prompt_inputs[f"clip_{index}_prompt"] = prompt
entries, last_state, session, report = H3ContinuumSamplerV2().run( entries, last_state, session, report = H3ContinuumSamplerV2().run(
model=model, model=model,
@@ -311,7 +314,7 @@ class H3ContinuumSamplerV3:
diagnostics=advanced_values["diagnostics"], diagnostics=advanced_values["diagnostics"],
reroll_from_chunk=advanced_values["reroll_from_chunk"], reroll_from_chunk=advanced_values["reroll_from_chunk"],
reroll_nonce=advanced_values["reroll_nonce"], reroll_nonce=advanced_values["reroll_nonce"],
strict_compatibility=advanced_values["strict_compatibility"], strict_compatibility=False,
debug=advanced_values["debug"], debug=advanced_values["debug"],
seam_correction=SEAM_CORRECTION_OFF, seam_correction=SEAM_CORRECTION_OFF,
first_frame=first_frame, first_frame=first_frame,
@@ -673,7 +676,7 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3):
"diagnostics": diagnostics, "diagnostics": diagnostics,
"reroll_from_chunk": regenerate_from, "reroll_from_chunk": regenerate_from,
"reroll_nonce": int(reroll_nonce), "reroll_nonce": int(reroll_nonce),
"strict_compatibility": bool(strict_compatibility), "strict_compatibility": False,
"debug": bool(debug), "debug": bool(debug),
"show_preview": bool(show_preview), "show_preview": bool(show_preview),
"last_frame": last_frame, "last_frame": last_frame,