diff --git a/CHANGELOG.md b/CHANGELOG.md index e13ee9f..2ecd97e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +- Make Second Pass tiled-upscale schedule precedence explicit: a connected + dedicated upscale SIGMAS socket wins, followed by the existing main SIGMAS + socket, while the other tiled controls use their node widgets when their + sockets are not connected. The status report now identifies the sigma source. - Add the DUMAS H3 Sequence Prompt Builder with clip tabs, local timeline slots, and one canonical absolute Timeline prompt output. - Refine its UI around the CSGlide shot-timeline pattern: one multiline shot diff --git a/WORKLOG.md b/WORKLOG.md index 2f37f26..78956be 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -1,5 +1,15 @@ # Public development log +## 2026-10-19 — Second Pass tiled sigma precedence + +- Fix `H3ContinuumSecondPassV35` so the tiled path actually forwards the + connected SIGMAS schedule instead of silently rebuilding it from the node's + `upscale_steps` value. +- Give a dedicated `upscale_sigmas` connection priority over the main SIGMAS + connection, preserve widget fallback behavior for the other tiled controls, + and report the selected sigma source for diagnosis. +- Add focused node-level regression coverage for both sigma precedence cases. + ## 2026-10-15 — CSGlide-style timeline controls - Match CSGlide's shot-timeline interaction: one prompt editor per clip, diff --git a/tests/test_v35_second_pass_sampling.py b/tests/test_v35_second_pass_sampling.py index e78a792..89478f7 100644 --- a/tests/test_v35_second_pass_sampling.py +++ b/tests/test_v35_second_pass_sampling.py @@ -543,6 +543,99 @@ def test_second_pass_node_forwards_optional_refine_context_and_video_vae(monkeyp assert captured["refine_schedule"] is schedule +def test_tiled_second_pass_prefers_connected_sigma_socket_over_node_steps(monkeypatch): + captured = {} + + class FakeNative: + pass + + class FakeNoise: + pass + + class FakeSampler: + def get_sampler(self, name): + return f"sampler:{name}" + + class FakeScheduler: + pass + + def fake_run(**kwargs): + captured.update(kwargs) + return ([], [], {"plan": True}, "status") + + monkeypatch.setattr( + "ComfyUI_H3_Continuum_Join.v3.second_pass_nodes.run_second_pass_groups", + fake_run, + ) + monkeypatch.setattr( + "ComfyUI_H3_Continuum_Join.v3.second_pass_nodes._native_node", + lambda name: { + "MMH3UltimateUpscale": FakeNative, + "RandomNoise": FakeNoise, + "KSamplerSelect": FakeSampler, + "BasicScheduler": FakeScheduler, + }[name], + ) + socket_sigmas = object() + result = H3ContinuumSecondPassV35().refine( + ["model"], ["clip"], ["sampler"], [socket_sigmas], + [], [], [{"second_pass_contract": {}}], [7], + tiled_upscale=[True], latent_upscale_param=["upscale"], + spatial_split_param=["spatial"], upscale_steps=[3], + upscale_denoise=[0.2], upscale_cfg=[1.0], upscale_noise_seed=[11], + ) + + assert result[0] == [] + config = captured["tiled_upscale_config"] + assert config["sigmas"] is socket_sigmas + assert config["sigma_source"] == "sigmas_socket" + + +def test_tiled_second_pass_prefers_dedicated_sigma_socket(monkeypatch): + captured = {} + + class FakeNative: + pass + + class FakeNoise: + pass + + class FakeSampler: + def get_sampler(self, name): + return name + + class FakeScheduler: + pass + + monkeypatch.setattr( + "ComfyUI_H3_Continuum_Join.v3.second_pass_nodes.run_second_pass_groups", + lambda **kwargs: captured.update(kwargs) or ([], [], {}, ""), + ) + monkeypatch.setattr( + "ComfyUI_H3_Continuum_Join.v3.second_pass_nodes._native_node", + lambda name: { + "MMH3UltimateUpscale": FakeNative, + "RandomNoise": FakeNoise, + "KSamplerSelect": FakeSampler, + "BasicScheduler": FakeScheduler, + }[name], + ) + main_sigmas = object() + tiled_sigmas = object() + H3ContinuumSecondPassV35().refine( + ["model"], ["clip"], ["sampler"], [main_sigmas], + [], [], [{"second_pass_contract": {}}], [7], + tiled_upscale=[True], latent_upscale_param=["upscale"], + spatial_split_param=["spatial"], upscale_sigmas=[tiled_sigmas], + upscale_steps=[3], upscale_denoise=[0.2], upscale_cfg=[1.0], + upscale_noise_seed=[11], + ) + + config = captured["tiled_upscale_config"] + assert config["sigmas"] is tiled_sigmas + assert config["sigma_source"] == "upscale_sigmas_socket" + + def test_second_pass_node_is_registered_and_not_deprecated(): node_class = NODE_CLASS_MAPPINGS["H3ContinuumSecondPassV35"] assert node_class is H3ContinuumSecondPassV35 diff --git a/v3/second_pass.py b/v3/second_pass.py index dcea669..a4a10d8 100644 --- a/v3/second_pass.py +++ b/v3/second_pass.py @@ -610,6 +610,11 @@ def run_second_pass_groups( f"sampling_passes=1, tiled_upscale={tiled_upscale_config is not None}, " "temporary_audio_discarded=true" ) + if tiled_upscale_config is not None: + group_report_lines.append( + "tiled sigma source=" + f"{tiled_upscale_config.get('sigma_source', 'node_steps_fallback')}" + ) if adaptation_stats is not None: group_report_lines.append( "group " diff --git a/v3/second_pass_nodes.py b/v3/second_pass_nodes.py index dd84d39..b2478be 100644 --- a/v3/second_pass_nodes.py +++ b/v3/second_pass_nodes.py @@ -50,6 +50,14 @@ def _single_list_input(name: str, value: Any) -> Any: return value[0] +def _optional_single_list_input(name: str, value: Any) -> Any: + """Unwrap an optional INPUT_IS_LIST value without losing an absent socket.""" + + if value is None: + return None + return _single_list_input(name, value) + + def _sampler_options(): try: import comfy.samplers @@ -76,7 +84,10 @@ class H3ContinuumSecondPassV35: "Connect the optional Continuum refine context to preserve the physical group's " "First/Last/Reference conditioning. " "SIGMAS controls the low-denoise refine schedule; audio output is preserved " - "bit-exact from the first pass." + "bit-exact from the first pass. In tiled-upscale mode, connected " + "upscale-specific sockets take priority; the main SIGMAS socket is the " + "fallback external schedule. The other optional tiled sockets fall back " + "to their node widgets when they are not connected." ) @classmethod @@ -206,9 +217,20 @@ class H3ContinuumSecondPassV35: None if upscale_negative is None else _single_list_input("upscale_negative", upscale_negative) ), - "sigmas": ( - None if upscale_sigmas is None - else _single_list_input("upscale_sigmas", upscale_sigmas) + # A dedicated tiled schedule wins. The main SIGMAS socket is + # the backwards-compatible external fallback used by existing + # DUMAS workflows. + "sigmas": _optional_single_list_input( + "upscale_sigmas", upscale_sigmas + ) + if upscale_sigmas is not None + else _optional_single_list_input("sigmas", sigmas), + "sigma_source": ( + "upscale_sigmas_socket" + if upscale_sigmas is not None + else "sigmas_socket" + if sigmas is not None + else "node_steps_fallback" ), } return run_second_pass_groups(