Remove failed last queued seed override

This commit is contained in:
ukr8b3g-cmyk
2026-08-25 18:53:17 +09:00
parent 8316576cab
commit b8ab766eb3
10 changed files with 33 additions and 329 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
- Added `H3 Continuum Conditioning Bridge V3.5`, exposing one complete Core-compatible MODEL and CONDITIONING object per Continuum physical group without flattening CONDITIONING entries.
- Added optional standalone Reference Audio conditioning to Sampler V3.5. Its two Python-defined sockets remain permanently present; the frontend no longer adds/removes them or serializes a visibility-only widget, preserving workflow widget alignment on save/reload.
- Added Last Queued Seed Reuse for the V3.5 sampler, restoring the seed used by the previous queue when switching from ComfyUI Randomize to Fixed while respecting manual seed edits and normal cache behavior.
- Removed the experimental Last Queued Seed override and restored standard ComfyUI `control after generate` behavior for the V3.5 sampler.
- Renamed the displayed video-guide inputs to `Video Guide Frames` and `Video Guide Size` to distinguish a video loader's IMAGE frame batch from still Reference Images. Backend input keys and saved-workflow links are unchanged.
- GPU-accepted Conditioning Bridge generation, Reference Audio/Image retention, and the V3.5 Second Pass/Hi-Res paths while preserving physical-group, Terminal Merge, Run Storage, and audio contracts.
+5 -7
View File
@@ -2,7 +2,7 @@ dca65fb1393e67f59c6f81f9411e3e745eb8f1097e9a2adf7ffc6f4e3901ca9f __init__.py
4f6feeb2f63a9285b0e76fb2e2618058c7d7c279af1632e1a6ccabcc9ec9a45a .github/workflows/tests.yml
0a2f69d4cec89d440f5d5aa1ec68a7c9a741382d313f80dcddf96d13f70b3e68 .gitignore
a9abe27341cb35cf7cee932a0fe4c20966b498c8fb6496c94c079d145a4eab6c AGENTS.md
cc910f1df2a46b4329c8ec6d3727cf6315f45a08c87dcc394909a4840ee7d752 CHANGELOG.md
e2615b31bf86d7cb338e4e0e22f789fc40dfbafc71c27b4637fbc14ef2ec99d5 CHANGELOG.md
e97e47c7585e81d9ec5fd32c0ca0b64699fd4610cd03e9d6575a91c30a10ca4e compatibility.py
4d62508f900af9f93ec320afb900c27cc9a300d1e0c0a94714258498c5ede5fc conditioning.py
71e3df269e226b1ecad597f9831c2a10b2215c8a3783652e9e9f536e99ce46c9 constants.py
@@ -69,12 +69,12 @@ d3e213005670e94dee33a240349a4d245cf9a3b6602099f11ed30cf5a32e2c21 media.py
ef705a476e3f5bbd05559e7a0e7d3dfb9275badef0f8f65fb1a36ce27fbcb537 model_patch.py
420f00c8193d527017720b26d6f7011d69c8f68a157b21c0102246cc98ad3a13 nodes.py
5c4f885c754813bc4500376335c33f0b1b97f25bc738ec8b0e8b12b4b6d78935 PACKAGE_INFO_JA.txt
6faf89d8271fdacd8a3a1e5ac8716d0a5b13749002dceac560d9d716edd4c320 PACKAGE_VALIDATION.txt
15e55d9bcc22607a7322d5b817da4db0476b4c2ecc256bf613b96442a1e23bfe PACKAGE_VALIDATION.txt
b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py
4015160058bc975f4ec85f59d41a6b57e95163090328e129df6b74738743cdad pyproject.toml
94fdc2d545b2d4077a4d70229fd22ba3ccac21d49d1097d2873f76d04e9a3c7a pytest.ini
265c40707715b8e98b367d3e027b3666ec3496972878e7019ee12a7b157fe8b5 README_JA.md
a4e45c198d2418595580f78c8f97d910ddc0b0d93725a49da6380b33439682eb README.md
d3404ebed5e2fbb2979bf04b32ce3b66a6a27dba6d3b59cc37997facc9b7480d README_JA.md
44108437546c406509228e04ac48b0440079f1e082c10f1ef0c7ee9489a94161 README.md
5d89c366b4f076fa73a2695557e0af749bf95df1dad0d55dbb2fe5b1c2519ad7 reference_audio.py
8f1744dc99f1a3a222b7d6e986f6dac1edcc0abbbe8b61a1d2606b1ca3569b3d reference_video.py
2995924fcb7bac27b548b01187d8276d2ab103c6f43416cf85400de3846c6297 reference.py
@@ -117,7 +117,6 @@ eb5b27f8f0d79529c56ef344a5601703642c3cba5388c9768116223e2ed58a36 tests/test_v3_
72719bcd6686d84f518d80751e3754b875d34c2aa72e2183dfa05ac9158a9eb0 tests/test_v34_driving_audio.py
5003c5f5ce1a4b4c77deb47011431e4a15fe0cecaeb6d689e0d0878567c42f5a tests/test_v351_reference_audio.py
63d18643701c7d8be7b45046e6dc76616565572180afa06b7582600bd6c32431 tests/test_v351_reference_audio_ui.py
9cf7dfa6cceba0efb95b4900aacc1ddfbec86c0e1645209bbf4c7908337138da tests/test_v351_last_queued_seed_frontend.py
cf1ca6342a89e4cb02b398b32edbe91b6c1353535383e9f51d459466305a0114 tests/test_v35_conditioning_bridge.py
8b75c23dccfd1ac302596187f2fbbd1c9b71fddcb5e666aa4f9eedfd8b5b4b93 tests/test_v35_compact_ui_frontend.py
b7267778fd1e77bd12d7c6e71c200fd0a4367cd8ae3276823ddeba16e015cfa6 tests/test_v35_context_sampler.py
@@ -166,6 +165,5 @@ da5edf3b4392c41e12ef73a0cd21799be42a327b18bd5a6989447b75163dcab1 v3/second_pass
4178dcfa442abdb06ce276e05bd7bcbaa6da28469ba5e57d3da3c663de4e4a9d v3/video_seam_v35.py
2f07ace1462644f0bee553827b3571535de4d0c2d9ef847bd9e0ca73a4eed5cb v3/video_seam.py
e981f75faff574b8e9ab3e9be8b68559e3e7a22f6220d3d073e7769f5fc0dc74 version.py
dac5dc14e432956c44e11cc672c3a7a050375e0fdae2f2b7a738da10ad23f837 web/last_queued_seed.js
daec067cc9508c170a54b8e721c850e052fac314d7aa6b3da96228d100132325 web/project_id.js
96b2f9aa1d20677433c46d225b8da26ab5379e4f0419e6d5e091a5c821898bb3 web/project_id.js
0cf8d49bcb71b30437dc893f6218dc4cfb1cd244b647e4fbc2861dea2271a33a web/reference_audio_ui.js
+3 -4
View File
@@ -1,6 +1,6 @@
ComfyUI-H3-Continuum V3.5.1 package validation
Status: V3.5.1 release. Stable V3.5 paths, Conditioning Bridge, and Reference Audio are validated. Last Queued Seed Reuse has automated frontend validation; real UI/cache acceptance remains pending. Integrated Hi-Res Fix remains Experimental.
Status: V3.5.1 release. Stable V3.5 paths, Conditioning Bridge, and Reference Audio are validated. Seed widgets use standard ComfyUI behavior. Integrated Hi-Res Fix remains Experimental.
Required automated checks:
- python -m compileall -q .
@@ -11,7 +11,6 @@ Validated runtime paths include:
- V3.5 refine-context contract and Advanced Second Pass Bridge
- Conditioning Bridge MODEL / CONDITIONING alignment per physical group without CONDITIONING-entry flattening
- Permanent Python-defined Reference Audio sockets, workflow save/reload widget alignment, and conditioning retention
- Last Queued Seed Reuse frontend contract, including manual seed edits and unchanged normal cache eligibility; real UI/cache acceptance remains pending
- 1x5 T2VA, 3x5 T2VA, and 3x5 FL2VA Long Terminal Merge Second Pass GPU acceptance
- First-pass audio LATENT object passthrough through Second Pass
- H3 Continuum Assemble + Seam V3.5 RAM / Disk-backed output equivalence
@@ -31,8 +30,8 @@ Validated runtime paths include:
- Audio Seam Auto
- Video Seam Auto guarded transient and micro-flash correction
Latest verified automated result: 452 passed.
Latest verified automated result: 450 passed.
Hi-Res Fix and Auto 2 remain experimental. Last Queued Seed Reuse real UI/cache acceptance remains pending. Main 3x5 2x is not accepted on the tested RTX 5060 Ti 16 GiB because the terminal 77T Second Pass group exceeded VRAM; longer Reference/Hybrid acceptance remains pending.
Hi-Res Fix and Auto 2 remain experimental. Main 3x5 2x is not accepted on the tested RTX 5060 Ti 16 GiB because the terminal 77T Second Pass group exceeded VRAM; longer Reference/Hybrid acceptance remains pending.
Detailed evidence: docs/VALIDATION_RESULTS.md
+6 -8
View File
@@ -43,20 +43,18 @@ Updated: 2026-08-25
- The pre-hotfix V3.5.1 release baseline was `450 passed`. Hotfix validation is `452 passed` with explicit workflow save/reload widget-alignment coverage and only the known `pynvml` FutureWarning. JavaScript syntax and `git diff --check` pass. The two frontend files are synchronized to ComfyUI_W by SHA-256; live save/reload acceptance remains pending.
- The public LBH/Conditioning Bridge connection example is `examples/workflows/MiniMax_H3_Continuum_V351_LBH_Conditioning_Bridge.json`; its README chart is `docs/images/v351-lbh-conditioning-bridge-flow.svg`. It is a separate example and does not replace or modify the recommended V3.5 template.
## V3.5.1 Last Queued Seed reuse frontend validation (2026-08-24)
## V3.5.1 standard ComfyUI Seed behavior (2026-08-25)
- The fix is limited to `H3 Continuum Sampler V3.5` frontend state. It does not change V3.4, backend Sampling, Second Pass, Terminal Merge, Assembly, Seam, Run Storage, Node IDs, display names, or public sockets.
- Per-node session-only state is `last_queued_seed`, `auto_updated_seed`, `previous_control_mode`, and `auto_update_pending`. Nothing is serialized into Workflow JSON or carried across a browser/ComfyUI restart.
- `beforeQueuePrompt` records the actual `base_seed` submitted for the V3.5 sampler. After Generate records only the automatic Randomize update. A `Randomize -> Fixed` transition restores the prior queued seed only while the displayed value still equals the recorded automatic update; an intervening manual Seed edit cancels restoration and remains authoritative.
- Restoring the Seed only makes the First Pass inputs eligible for normal ComfyUI cache reuse. If the cache is absent or evicted, First Pass regenerates normally with the same Seed. Run Storage seed contracts remain strict and unchanged.
- The implementation is isolated in `web/last_queued_seed.js` and integrated through the existing `web/project_id.js` extension. JavaScript syntax and focused frontend behavior validation are `5 passed`; full source pytest is `445 passed`. The two Production frontend files match ComfyUI_W by SHA-256, whose runtime verifier and existing compact-UI regression pass. Real UI/cache acceptance remains pending.
- The experimental Last Queued Seed frontend override was withdrawn after repeated real-browser failures. Static callback and simulated-event tests did not reproduce the active ComfyUI Frontend lifecycle reliably.
- `H3 Continuum Sampler V3.5` now uses the same native `control after generate` behavior as ComfyUI Core. Continuum does not wrap seed callbacks, intercept Randomize/Fixed transitions, monitor widgets, or rewrite submitted seed values.
- This removal is limited to the Last Queued Seed experiment. V3.4/V3.5 node schemas, Reference Audio UI, compact UI settings, Sampling, Second Pass, Terminal Merge, Assembly, Seam, Run Storage, and all other frontend behavior remain unchanged.
- Focused unaffected-UI validation is `8 passed`; full source pytest is `450 passed` with only the known `pynvml` FutureWarning.
## V3.5.1 Hi-Res Fix Core canvas alignment (2026-08-24)
- A real `576x576`, `scale_by=1.2` run exposed an invalid `43x43` H3 video/conditioning latent. Core MiniMax H3 patchifies spatial latents in `2x2` blocks and exposes pixel dimensions in 32-pixel steps, so the odd latent failed in Core with `24 * 43 * 43 = 44376` elements.
- Manual Hi-Res Fix targets now use ComfyUI Core's `CANVAS_MULTIPLE` and preserve-or-enlarge each axis on that grid. The failing case resolves to `704x704` / `44x44`; a `1024x576` source at `1.2x` resolves to `1216x704` / `76x44`. The Pixel/VAE, conditioning adaptation, and Second Pass paths remain unchanged.
- Focused Hi-Res/Second Pass validation is `48 passed`; full source pytest is `448 passed`. `v3/hires_fix_nodes.py` is synchronized to ComfyUI_W by SHA-256, and runtime registration/native PackedLayout/Fixed 3x5 verification passes. GPU acceptance after a ComfyUI process restart remains pending.
- The same attempt did not validate Last Queued Seed cache reuse: the second prompt was queued at `21:24:38` before the first prompt completed at `21:26:02`, and the log shows another First Pass `20/20`. Retry only after the first prompt has completely finished.
## V3.5 recommended template workflow (2026-08-24)
@@ -349,7 +347,7 @@ Static checks do not replace a real GPU generation. Record workflow, prompt, med
## V3.5.1 public-state cleanup (2026-08-25)
- Project instructions now identify V3.5.1 as the current public baseline while retaining V3.4 node IDs, public contracts, and saved-workflow compatibility.
- Last Queued Seed Reuse is classified as automated frontend-validated; real UI/cache acceptance remains pending. Package validation no longer implies completed real UI/cache acceptance.
- The later real-browser acceptance superseded the earlier simulated Last Queued Seed result; that experiment is withdrawn and standard ComfyUI Seed behavior is restored.
- GitHub Issues #9, #10, and #11 received implementation guidance and are closed as completed. Issue #11 was closed after the conditional-UI/internal-resize README clarification reached public `main`.
## GitHub Actions dependency/stub repair (2026-08-25)
+1 -2
View File
@@ -12,11 +12,10 @@ Long-form MiniMax H3 video generation for ComfyUI with Continuum-aware Second Pa
## What's new in V3.5.1
V3.5.1 completes three focused additions without changing the V3.4 Sampling, Conditioning, Terminal Merge, Assembly, Seam, or Run Storage contracts:
V3.5.1 completes two focused additions without changing the V3.4 Sampling, Conditioning, Terminal Merge, Assembly, Seam, or Run Storage contracts:
1. **Optional Reference Audio** — native H3 audio conditioning that does not replace the generated final audio. Both sockets remain permanently visible to preserve workflow save/reload compatibility.
2. **Conditioning Bridge V3.5** — exposes one complete Core-compatible `MODEL` and one complete `CONDITIONING` object per Continuum physical group for an external sampler workflow.
3. **Last queued seed reuse** — when ComfyUI changes a randomized seed after generation, switching the Sampler back to Fixed restores the seed used by the last queued run when it is still safe to do so. Existing ComfyUI cache behavior is not overridden.
### Reference inputs at a glance
+2 -3
View File
@@ -1,16 +1,15 @@
# ComfyUI-H3-Continuum 3.5.1
**V3.5.1正式版:** V3.4互換を維持し、Reference Audio、Conditioning Bridge、Last Queued Seed Reuseを追加します。V3.4のNode IDとbackend socket keyは保存済みワークフロー互換のため意図的に残しており、表示名を変更しても既存V3.4/V3.5ワークフローの接続は維持されます。
**V3.5.1正式版:** V3.4互換を維持し、Reference AudioとConditioning Bridgeを追加します。V3.4のNode IDとbackend socket keyは保存済みワークフロー互換のため意図的に残しており、表示名を変更しても既存V3.4/V3.5ワークフローの接続は維持されます。
MiniMax H3を複数チャンクで連続生成し、直前チャンク末尾の**映像latent / 音声latentを直接**次チャンクへ継承するComfyUIカスタムノードです。チャンク間でVideo/Audio VAEのDecode→Encodeは行いません。
## V3.5.1の追加機能
V3.5.1では、V3.4のSampling、Conditioning、Terminal Merge、Assembly、Seam、Run Storage契約を変更せず、次の3点を追加します。
V3.5.1では、V3.4のSampling、Conditioning、Terminal Merge、Assembly、Seam、Run Storage契約を変更せず、次の2点を追加します。
1. **Reference Audio(任意)**: 生成音声を置換しない、H3 nativeの音声conditioningです。Workflowの保存・再読込互換を守るため、2つのsocketは常時表示します。
2. **Conditioning Bridge V3.5**: Continuumのphysical groupごとに、完全なCore互換`MODEL`と`CONDITIONING`を外部Samplerへ公開します。
3. **Last Queued Seed Reuse**: Randomize生成後にComfyUIが自動更新したseedからFixedへ戻した場合、安全に判定できるときだけ直前Queueで実際に使ったseedを復元します。ComfyUI cache自体は操作しません。
### Reference系入力の違い
+15
View File
@@ -442,3 +442,18 @@ D:\Codex\_snapshots\ComfyUI-H3-Continuum\pre-rollback-after-00038-fail-20260821_
- Added a short English-only optional tip for `--disable-pinned-memory` near the measured memory section. It records the local RTX 5060 Ti 16 GB / RAM 64 GB `0.4 MP, 2 x 5s` result (`5m 23s`, approximately 6.1 GB sampler RSS and 8.6 GB after assembly) without presenting the flag as a default, universal crash fix, or guarantee against Shared GPU Memory use.
- Pre-change snapshot: `pre-readme-pinned-memory-tip-source-accepted-20260825_031002_500` (477 files), excluding `.git` and the known ACL-inaccessible `.pytest_cache`.
## 2026-08-25 - Last Queued Seed promptQueued observer candidate
- Replaced the unsuccessful widget callback, `afterQueued`, and `onWidgetChanged` wrapping approach instead of stacking another mechanism on top. `beforeQueuePrompt` now stages the V3.5 Randomize seed, the official `promptQueued` event accepts it after a successful queue, and a pending-only 50 ms observer reads current `node.widgets` until it restores the accepted seed on `Fixed` or cancels on a manual seed change.
- Queue validation failures cannot update `last_queued_seed`; a later single-queue attempt replaces any unaccepted candidate. Restoration changes the visible widget value directly and never mutates the API prompt behind the UI.
- Accepted exact-file snapshots are `pre-last-seed-observer-source-files-20260825_175117` (4 files), `pre-last-seed-observer-runtime-files-20260825_175117` (2 files), `pre-last-seed-observer-docs-20260825_175652` (2 files), and `pre-last-seed-observer-runtime-manifest-20260825_175724` (1 file). The standard full snapshot attempt stopped only on the known ACL-inaccessible `.pytest_cache` before any edit.
- Focused frontend/compact-UI validation is `9 passed`; full source pytest is `453 passed` with only the known `pynvml` FutureWarning. JavaScript syntax passes, and `web/last_queued_seed.js` plus `web/project_id.js` match ComfyUI_W by SHA-256. Live UI transition and First Pass cache reuse remain pending; commit/push were not performed.
## 2026-08-25 - Last Queued Seed experiment withdrawn
- Real-browser Randomize-to-Fixed pairs repeatedly submitted different base seeds, including `00043` (`432308459616145`, Randomize) and `00044` (`238985343135586`, Fixed). Each file's Workflow/UI seed matched its submitted Prompt seed, proving that the restoration itself failed rather than metadata being stale.
- Removed only the Last Queued Seed frontend integration, its dedicated module, and its simulated regression. `H3 Continuum Sampler V3.5` again delegates Seed and `control after generate` entirely to ComfyUI. Reference Audio UI, compact UI settings, and all unrelated Production paths are unchanged.
- GitHub review found a valid alternative pattern in rgthree's dedicated Seed node: it removes the native control, finalizes the Prompt/Workflow seed immediately before queueing, and exposes an explicit `Use Last Queued Seed` button. That design is materially different from transparently intercepting an existing Sampler's Randomize-to-Fixed transition and was not added to Continuum.
- Accepted exact-file snapshots are `pre-remove-last-queued-seed-source-files-20260825_184039` (10 files) and `pre-remove-last-queued-seed-runtime-files-20260825_184039` (4 files). The standard snapshot attempt stopped only on the known ACL-inaccessible `.pytest_cache` before any edit.
- Focused compact/reference-audio/release validation is `8 passed`; full source pytest is `450 passed` with only the known `pynvml` FutureWarning. JavaScript syntax and runtime verification pass; the seed-only removal is synchronized to ComfyUI_W. Commit/push were still pending at this checkpoint.
@@ -1,159 +0,0 @@
from __future__ import annotations
import shutil
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
PROJECT_ID_JS = ROOT / "web" / "project_id.js"
SEED_REUSE_JS = ROOT / "web" / "last_queued_seed.js"
def test_v35_only_wires_last_queued_seed_reuse_into_prompt_capture():
source = PROJECT_ID_JS.read_text(encoding="utf-8")
assert 'const V35_NODE_CLASS = "H3ContinuumSamplerV35";' in source
assert "if (isV35)" in source
assert "configureLastQueuedSeedReuse(node);" in source
assert "if (node.comfyClass === V35_NODE_CLASS)" in source
assert "captureLastQueuedSeed(node, apiNode?.inputs?.base_seed);" in source
def test_last_queued_seed_state_is_session_only_and_uses_required_fields():
source = SEED_REUSE_JS.read_text(encoding="utf-8")
for field in (
"last_queued_seed",
"auto_updated_seed",
"previous_control_mode",
"auto_update_pending",
):
assert field in source
assert "localStorage" not in source
assert "sessionStorage" not in source
assert "widgets_values" not in source
def test_last_queued_seed_behavior_with_real_javascript_module(tmp_path):
node = shutil.which("node")
assert node is not None, "Node.js is required for frontend behavior validation"
module_path = tmp_path / "last_queued_seed.mjs"
module_path.write_text(SEED_REUSE_JS.read_text(encoding="utf-8"), encoding="utf-8")
harness_path = tmp_path / "seed_reuse_harness.mjs"
harness_path.write_text(
r'''
import assert from "node:assert/strict";
import {
captureLastQueuedSeed,
configureLastQueuedSeedReuse,
} from "./last_queued_seed.mjs";
function makeNode({ seed = 101, mode = "randomize", nextSeeds = [], runAfter = true } = {}) {
const remaining = [...nextSeeds];
const seedWidget = {
name: "base_seed",
value: seed,
callback(value) {
this.value = value;
},
};
const controlWidget = {
name: "control_after_generate",
value: mode,
callback(value) {
this.value = value;
},
afterQueued() {
if (runAfter && this.value === "randomize" && remaining.length) {
const next = remaining.shift();
seedWidget.value = next;
seedWidget.callback(next);
}
},
};
seedWidget.linkedWidgets = [controlWidget];
const node = { widgets: [seedWidget, controlWidget] };
assert.equal(configureLastQueuedSeedReuse(node), true);
return { node, seedWidget, controlWidget };
}
function setSeed(seedWidget, value) {
seedWidget.value = value;
seedWidget.callback(value);
}
function setMode(controlWidget, value) {
controlWidget.value = value;
controlWidget.callback(value);
}
{
const { node, seedWidget, controlWidget } = makeNode({ nextSeeds: [202] });
assert.equal(captureLastQueuedSeed(node, 101), true);
controlWidget.afterQueued();
assert.equal(seedWidget.value, 202);
setMode(controlWidget, "fixed");
assert.equal(seedWidget.value, 101);
}
{
const { node, seedWidget, controlWidget } = makeNode({ nextSeeds: [202] });
captureLastQueuedSeed(node, 101);
controlWidget.afterQueued();
setSeed(seedWidget, 303);
setMode(controlWidget, "fixed");
assert.equal(seedWidget.value, 303);
}
{
const { node, seedWidget, controlWidget } = makeNode({ nextSeeds: [202, 303] });
captureLastQueuedSeed(node, 101);
controlWidget.afterQueued();
assert.equal(seedWidget.value, 202);
captureLastQueuedSeed(node, 202);
controlWidget.afterQueued();
assert.equal(seedWidget.value, 303);
setMode(controlWidget, "fixed");
assert.equal(seedWidget.value, 202);
}
{
const { node, seedWidget, controlWidget } = makeNode({ runAfter: false });
captureLastQueuedSeed(node, 101);
controlWidget.afterQueued();
setMode(controlWidget, "fixed");
assert.equal(seedWidget.value, 101);
}
{
const { node, seedWidget, controlWidget } = makeNode({ mode: "fixed", nextSeeds: [202] });
captureLastQueuedSeed(node, 101);
controlWidget.afterQueued();
assert.equal(seedWidget.value, 101);
setSeed(seedWidget, 404);
assert.equal(seedWidget.value, 404);
}
{
const { node, seedWidget, controlWidget } = makeNode({ nextSeeds: [202] });
captureLastQueuedSeed(node, 101);
controlWidget.afterQueued();
assert.equal(seedWidget.value, 202);
assert.equal(captureLastQueuedSeed(node, ["12", 0]), false);
setMode(controlWidget, "fixed");
assert.equal(seedWidget.value, 202);
}
''',
encoding="utf-8",
)
result = subprocess.run(
[node, str(harness_path)],
cwd=tmp_path,
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 0, result.stdout + result.stderr
-137
View File
@@ -1,137 +0,0 @@
const CONFIGURATION = Symbol("h3ContinuumLastQueuedSeedConfiguration");
function normalizeControlMode(value) {
if (value === true) return "randomize";
if (value === false) return "fixed";
return String(value ?? "").trim().toLowerCase();
}
function sameSeed(left, right) {
if (left == null || right == null) return false;
return String(left) === String(right);
}
function clearAutomaticUpdate(state) {
state.auto_updated_seed = undefined;
state.auto_update_pending = false;
}
function findSeedWidgets(node) {
const seedWidget = node.widgets?.find((widget) => widget.name === "base_seed");
const controlWidget = seedWidget?.linkedWidgets?.find(
(widget) => widget.name === "control_after_generate",
) ?? node.widgets?.find((widget) => widget.name === "control_after_generate");
return { seedWidget, controlWidget };
}
export function configureLastQueuedSeedReuse(node) {
const { seedWidget, controlWidget } = findSeedWidgets(node);
if (!seedWidget || !controlWidget) {
return false;
}
const existing = node[CONFIGURATION];
if (existing?.seedWidget === seedWidget && existing?.controlWidget === controlWidget) {
return true;
}
const state = {
last_queued_seed: undefined,
auto_updated_seed: undefined,
previous_control_mode: normalizeControlMode(controlWidget.value),
auto_update_pending: false,
};
let applyingAutomaticUpdate = false;
let restoringQueuedSeed = false;
const previousSeedCallback = seedWidget.callback;
seedWidget.callback = function(value, ...args) {
const result = previousSeedCallback?.call(this, value, ...args);
if (
!applyingAutomaticUpdate
&& !restoringQueuedSeed
&& state.auto_update_pending
&& !sameSeed(value, state.auto_updated_seed)
) {
clearAutomaticUpdate(state);
}
return result;
};
const previousControlCallback = controlWidget.callback;
controlWidget.callback = function(value, ...args) {
const priorMode = state.previous_control_mode;
const result = previousControlCallback?.call(this, value, ...args);
const nextMode = normalizeControlMode(value ?? controlWidget.value);
if (priorMode === "randomize" && nextMode === "fixed") {
if (
state.auto_update_pending
&& sameSeed(seedWidget.value, state.auto_updated_seed)
&& state.last_queued_seed != null
) {
restoringQueuedSeed = true;
try {
seedWidget.value = state.last_queued_seed;
seedWidget.callback?.(state.last_queued_seed);
} finally {
restoringQueuedSeed = false;
}
}
clearAutomaticUpdate(state);
} else if (nextMode !== "randomize") {
clearAutomaticUpdate(state);
}
state.previous_control_mode = nextMode;
return result;
};
const previousAfterQueued = controlWidget.afterQueued;
controlWidget.afterQueued = function(...args) {
const before = seedWidget.value;
applyingAutomaticUpdate = true;
let result;
try {
result = previousAfterQueued?.apply(this, args);
} finally {
applyingAutomaticUpdate = false;
}
const after = seedWidget.value;
const mode = normalizeControlMode(controlWidget.value);
state.previous_control_mode = mode;
if (
mode === "randomize"
&& state.last_queued_seed != null
&& sameSeed(before, state.last_queued_seed)
&& !sameSeed(after, before)
) {
state.auto_updated_seed = after;
state.auto_update_pending = true;
}
return result;
};
node[CONFIGURATION] = { seedWidget, controlWidget, state };
return true;
}
export function captureLastQueuedSeed(node, queuedSeed) {
if (!configureLastQueuedSeedReuse(node)) {
return false;
}
const configuration = node[CONFIGURATION];
const { controlWidget, state } = configuration;
if (queuedSeed == null || Array.isArray(queuedSeed)) {
state.last_queued_seed = undefined;
state.previous_control_mode = normalizeControlMode(controlWidget.value);
clearAutomaticUpdate(state);
return false;
}
state.last_queued_seed = queuedSeed;
state.previous_control_mode = normalizeControlMode(controlWidget.value);
clearAutomaticUpdate(state);
return true;
}
-8
View File
@@ -1,8 +1,4 @@
import { app } from "../../scripts/app.js";
import {
captureLastQueuedSeed,
configureLastQueuedSeedReuse,
} from "./last_queued_seed.js";
import { normalizeReferenceAudioLabels } from "./reference_audio_ui.js";
const PRODUCTION_NODE_CLASS = "H3ContinuumSamplerProduction";
@@ -244,7 +240,6 @@ function configureNode(node) {
}
applyRuntimeSettings(node);
if (isV35) {
configureLastQueuedSeedReuse(node);
normalizeReferenceAudioLabels(node);
}
hidePersistentWidget(findWidget(node, "diagnostics"));
@@ -315,9 +310,6 @@ app.registerExtension({
for (const node of app.graph?._nodes || []) {
const projectWidget = configureNode(node);
const apiNode = prompt.output?.[String(node.id)];
if (node.comfyClass === V35_NODE_CLASS) {
captureLastQueuedSeed(node, apiNode?.inputs?.base_seed);
}
if (apiNode?.inputs) {
if (
node.comfyClass === PRODUCTION_NODE_CLASS