From 20be744b3fc80a110f88609422beb249f894cb49 Mon Sep 17 00:00:00 2001 From: ukr8b3g-cmyk Date: Tue, 8 Sep 2026 16:48:31 +0900 Subject: [PATCH] fix(ui): stabilize V3.8 review and render history --- MANIFEST.sha256 | 12 +- PROJECT_STATE.md | 30 +++ REGISTRY_MANIFEST.sha256 | 4 +- WORKLOG.md | 29 +++ tests/test_v38_completed_review_ui.py | 151 ++++++++++++- tests/test_v38_public_surface_cleanup.py | 3 + tests/test_v38_review_run_storage.py | 64 +++++- tests/test_v38_review_ui.py | 51 +++-- web/project_id.js | 260 +++++++++++++++++++---- 9 files changed, 537 insertions(+), 67 deletions(-) diff --git a/MANIFEST.sha256 b/MANIFEST.sha256 index 3741839..59e38de 100644 --- a/MANIFEST.sha256 +++ b/MANIFEST.sha256 @@ -87,7 +87,7 @@ b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py 96f98d727b72d6aefd431061572e187c303365a3e5b4d20cbb2bcf030aa30112 pyproject.toml 94fdc2d545b2d4077a4d70229fd22ba3ccac21d49d1097d2873f76d04e9a3c7a pytest.ini 88aa955161d04d14ebd8d90d6cb6c6206097160a671eb4d1bfe9b3e76ebc6c13 README_JA.md -8641e14015cd4a955f4d334e45c2af1920de1985cf11a70c0cff424289be0bdf README.md +1f8a6e1a4441ac2fd7a07ddbdfea923ed1da9f3100db49dca729e141de92f4af README.md 44127adcfa30ee84bff9cd4b2d0c695355209550e76982d374122008728aa5bc reference_audio.py 5cb9bfd6810d3a93a637451980a4cc5c1436e5b84cfd1c7a111cd192e876351b reference_video.py 131bdfbb7a7173c9e7826859c0e648bfb69bd18bf20fa5528c0e18a63f888b26 reference.py @@ -172,8 +172,8 @@ cff84ae0562ba5fc48f3608ecaa433e74c0af9b689d7dca94ec8c3c4e9dc232f tests/test_v38 ee4dd8f6eb8114706b2625b4471b041a0ea66198f9f825c63e913c896ed87530 tests/test_v38_branch_provenance.py 72a0e3cb334049b66dd36f52c826931067c242fa63557933fd667138b38d6e8d tests/test_v38_review_control.py 83301839f08d275f5648d7782b6d96795e14b1ce79d722e83e57190fe52fb4aa tests/test_v38_review_execution_cap.py -836b8264065886b929b098d26c3137e8e5f6fc1dbcfb91d53d0511be584b121e tests/test_v38_review_run_storage.py -02cad8b184ad056c4f50fa7e651f904d72e25ae60ea8ce53038a8859d99ec373 tests/test_v38_review_ui.py +2fec519540e18c55682884647db9fa1c90902da7be3d62261f2801a5c5724a96 tests/test_v38_review_run_storage.py +b228d1a596ade2c3b3495fdf97177e798cec4be774d6ff02d5c6294e09140866 tests/test_v38_review_ui.py 75697036f361a9b8ea74f69b15e408670f686c8c0e8a6c1d48fe059cc837d12a tests/test_v38_selective_second_pass_node.py 8026a241301dfc4de518649305458a538ef17a0b1567b113877a2af377738528 tests/test_v38_temporal_window_refine.py 0dbe8a5f71c92f3523942343b40787104c8b96781461ba3ba82934a6bdbe5834 THIRD_PARTY_NOTICES.md @@ -241,12 +241,12 @@ c2883272b05a9a9146b5c6cf614ddae8a3e6893cd910902023aae61360195289 web/easy_bypas 9db0aa94f634578a962d5db49e5c70356040a59df968e3a2e531b327a623081f web/easy_load_image.js 873efcbd15c2d9fa10c9d5fc51a796ad3a18c0c6acceecf499c4b956aa845c6c web/easy_load_video.js 0c68d13a1f8beb7431a32b471f8b0612c42fcc4bf72dd97611a025d158008662 web/easy_v38.js -14fd162ba18c7302c9f2bf49b62daf324ed0e1a349d1c42d064c67a28e2e5c38 web/project_id.js +549a8150bc926bf142758b1610e3730547d6abcfbcddb0b37ed8baaaf86b38cb web/project_id.js be0b8d39e5343680ebea815c3a4fb6ce7a32e065f30e43e013040a40f702cef3 .comfyignore 1d2838cc47694609289ea15132872ad48e1b6c8274da4b7bf188dd3ebf066121 docs/V38_RELEASE_AND_MIGRATION.md -7a75ba760008ab0e58b164ebc628b5f1db7a8704e0bde5406d62ea0de2244f7b tests/test_v38_public_surface_cleanup.py +69d0e95d4d8ed8414e9bfb9bbbcb6183efa6d27f27cc8c6dd2f84c9cc5ce3439 tests/test_v38_public_surface_cleanup.py 0cf8d49bcb71b30437dc893f6218dc4cfb1cd244b647e4fbc2861dea2271a33a web/reference_audio_ui.js -445c2792a1f768aead69bcac334204d588a19072162421e4831d8df1f93af912 REGISTRY_MANIFEST.sha256 +88a9426baa14dc99ecd643cdf58e46e780672d86088b2897aa66952c56b3c126 REGISTRY_MANIFEST.sha256 717577efdec5e61600504b77bc2a099ef022c4fe2333e936c3310c7182d8f2a0 docs/V38_OPEN_INTEGRATION_CONTRACT.md 623d528a02b6712cba28c374ba3ad979bc84e2ac5318640692589a04ba6ab15f tests/test_v38_open_integration_contract.py 0bc369ee428b8a5bc8e370a81fbab427262a1fdb7805a78c442c91698d65efba tools/__init__.py diff --git a/PROJECT_STATE.md b/PROJECT_STATE.md index fa3eaad..1874299 100644 --- a/PROJECT_STATE.md +++ b/PROJECT_STATE.md @@ -1,5 +1,19 @@ # Project State +## Review boundary repair — CPU validated, live 3x5 pending (2026-09-08) + +- The latest actual Review Queue did not generate Chunk 1: backend history proved it reused all three saved chunks and returned the prior `complete` revision. The previous mode-selection presentation repair therefore did not satisfy the user's acceptance condition and is superseded by this entry. +- Source now treats an explicit Full Video -> Review Each Chunk selection as a new non-destructive review series. Before Queue it refreshes canonical Run Storage state; when saved `review_ready` or `complete` history exists, only the queued payload receives `Regenerate From = Chunk 1`, automatic nonce, and no Take selection. The visible settings and saved Takes remain unchanged. The first actual Sampler result releases setup mode and loads its canonical review state; later Continue queues inherit that new branch and advance one physical group at a time. +- Exact CPU contracts cover `3 x 5s`: fresh Chunk 1 -> review, Continue -> Chunk 2 review, Continue -> Chunk 3 complete. The real frontend lifecycle and backend branch/nonce resolver pass. Focused Review/UI suite `123` PASS and full CPU suite `1156/1156` PASS in `50.69s`; Registry/source declarations, JavaScript syntax and `git diff --check` pass. Evidence: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v38-review-boundary-20260908`. +- Fixed H3情報チェック returned `PASS / local runtime deploy OK`; its nonblocking queued-identity note was applied by binding setup release to the exact setup token and Run name. Installed ComfyUI_W still has the superseded frontend SHA `d84877206cc1142dbfe7fce3f7e9c1b6edb8a22cae5ab117a1407f9435f6dea7`; validated source SHA is `fe5e00020b9e942ec2e27286576aca69fb3add3f18afeea8edcfd28f6183cd91`. Runtime deployment, browser refresh and actual GPU `3 x 5s` Chunk1/2/3 screen acceptance remain pending. No workflow, Production/Sampling backend, saved Take, commit, push, tag or release change. + +## Local Review mode-selection repair (2026-09-08) + +- Deployed locally after H3情報チェック returned PASS / local deployment OK (report-only review). Source, installed web/project_id.js and live8188 HTTP200 payload SHA all equal d84877206cc1142dbfe7fce3f7e9c1b6edb8a22cae5ab117a1407f9435f6dea7. Runtime snapshot verified1 file. Browser hard-refresh and user-visible check remain; no browser reload, GPU, backend restart or publication performed. This supersedes deployment-pending wording below. +- User-reported Full Video -> Review Each Chunk opened an old complete revision before generation. Reproduced with the real frontend harness (red.xml); mode selection now retains setup and the normal readiness summary without showing Retry/Restart. Existing Return to Review explicitly opens the saved result. Saved progress remains reusable; selecting Review does not mean starting a new Run. +- Presentation token is transient, not serialized or a backend identity. A matching queued generation's new review revision releases it; same-revision history reads, delayed initial history before Queue, a previously queued result, or another Run's result do not take focus. Hidden old Retry/Finish is normalized to ordinary Continue at Queue while manual boundaries remain intact. Reload recovery, review completion, saved takes, Python and workflow bytes remain unchanged. +- Focused90 PASS; final full1155 PASS in48.44s, CPU-only. Initial full had one old UI fixture failure: it injected a ready revision without Queue; fixture now models queued completion and keeps its prior expectations. Evidence: D:/Codex/_test_results/ComfyUI-H3-Continuum/v38-mode-settings-20260908. Completion report sent to fixed H3情報チェック; local deployment/readback pending that review. No commit/push/GPU or backend restart authorized/performed. + ## Review UI hotfix — validated for user-authorized main publication (2026-09-08) - User explicitly authorized a hotfix commit/push to existing origin/main for the confirmed Xarfai Review restart UI mismatch. Scope is frontend only: withdraw stale review actions after settings edits, preserve manual regeneration boundaries, add a non-destructive one-shot Start again from Chunk 1 button. Saved takes, sampler/transport/Audio/schema/workflow files and installed runtime remain unchanged. @@ -1729,3 +1743,19 @@ Static checks do not replace a real GPU generation. Record workflow, prompt, med - The tested seed did not reproduce Issue #13 sharpness ratchet: Laplacian decreased A `54.803→41.359` and B `54.803→40.399`. B showed greater saturation and skin-highlight growth and its 8-second PCM edge exceeded the pre-set A-relative screen on both channels. Visual/audio human review remains recommended, but there is no evidence here to replace Standard with Compatibility. - Current launch direction: keep Standard/Masked AV as default; do not promote Compatibility from this result; retain R6-A as Experimental/Default OFF pending active-gain multi-seed or reporter-exact validation. Issue #13 is not Solved. Production/runtime/public schema remain unchanged; no commit, push, tag or release was performed. - Evidence and report: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v38-continuation-regression-final-gate-20260907\FINAL_ABC_REPORT_JA.md`. + +## V3.8 Review Each Chunk live 3 x 5s acceptance PASS (2026-09-08) + +- The remaining real-screen acceptance is now **PASS** on the user-managed `127.0.0.6:8188` backend. A single 3 x 5-second Review Each Chunk run advanced through `Chunk 1 is ready for review`, `Chunk 2 is ready for review`, then `Saved sequence is complete` only after Chunk 3. Chunk 1 and Chunk 2 each exposed `Use it and continue`, `Try this chunk again`, and `Use it and finish the rest`; the final state correctly removed no-op continuation controls. +- The prior CPU-only frontend test had exercised an unsupported `beforeQueuePrompt` hook. ComfyUI frontend `1.49.6` actually runs widget `beforeQueued`, serializes through `serializeValue`, then emits `executed` and `execution_success`. `web/project_id.js` now uses that supported lifecycle to queue the transient Chunk 1 boundary without mutating visible/saved widgets and clears setup only for the exact node, Run name, setup token, and prompt identity. +- Live prompts `8a9a2275-7f31-4e3b-bf7c-95747feefc2b`, `5427b850-0490-4b07-8243-77f737be7ba3`, and `ef38c575-faa8-45ea-8485-6ced1500298e` all completed successfully. Each reported exactly one new physical group: `1/3`, `2/3`, and `3/3` logical chunks available; Run Storage progression was `0 reused + 1 generated`, `1 + 1`, then `2 + 1`. Sampler node `312` was not returned as cached in any prompt; only upstream nodes reused ComfyUI cache. +- Focused supported-lifecycle regression passed `1/1`; full CPU regression passed `1156/1156` in `50.60s`; JavaScript syntax passed. Source and installed runtime `web/project_id.js` are byte-identical at SHA-256 `78BA840BB4B57D21BC17AAB9F5CA3C89E3BC3C7AAE1A027BBD3FF54512717A53`. +- Production Python, Sampling, transport, backend lifecycle, and workflow JSON were unchanged. The user performed every GPU Queue/Continue action; Codex did not start GPU work or restart/stop the backend. No commit, push, tag, release, or Registry publication was performed. + +### Newly exposed Render History defect + +- Opening Render History after the accepted run exposed a separate existing bug. The project index contains `76` group revisions across `59` sampling lineages, while the current canonical lineage contains only the three accepted revisions. The frontend presents all project revisions as selectable Takes; the backend correctly validates only the current contract lineage. +- Selecting old Group 2 revisions `9db2a9287ef18796b770db00` or `f968bd1131c20912e207de0a` and queuing an action fails safely with `selected Take provenance is invalid: group revision parent is missing`. The message refers to absence from the current-lineage validation catalog, not deletion of the accepted canonical chain. +- Repaired in `web/project_id.js`: the actionable catalog is now restricted to the canonical sampling lineage and revisions whose complete contiguous ancestry resolves inside that lineage. A stale hidden selection falls back to the corresponding canonical revision and resets its pending Take action. If settings differ from the reviewed result, Take application controls are disabled while read-only browsing remains available. Backend validation remains unchanged. +- The history body is now a compact summary capped at 124 px. Its custom draw uses the reserved computed height even when the frontend supplies a single-row draw hint, eliminating the large blank panel and the one-line-only rendering observed live. +- Mixed-lineage/orphan, selection fallback, compact rendering, and existing Review/Take regressions passed `59/59`; full CPU regression passed `1156/1156` in `52.09s`; JavaScript syntax and both manifests passed. Source/runtime JS SHA-256 is `549A8150BC926BF142758B1610E3730547D6ABCFBCDDB0B37ED8BAAAF86B38CB` after one-file deployment with Queue `0/0`. The current browser tab remains unreloaded because its title carries an unsaved marker; live visual confirmation requires saving or intentionally discarding that tab's changes, then reloading. diff --git a/REGISTRY_MANIFEST.sha256 b/REGISTRY_MANIFEST.sha256 index 89808bb..bbc9c7b 100644 --- a/REGISTRY_MANIFEST.sha256 +++ b/REGISTRY_MANIFEST.sha256 @@ -28,7 +28,7 @@ a4ce23167b83e8d72b86a802dfde4f4045828433c7c13aab799bd64831dc04a4 nodes.py b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py 96f98d727b72d6aefd431061572e187c303365a3e5b4d20cbb2bcf030aa30112 pyproject.toml 88aa955161d04d14ebd8d90d6cb6c6206097160a671eb4d1bfe9b3e76ebc6c13 README_JA.md -8641e14015cd4a955f4d334e45c2af1920de1985cf11a70c0cff424289be0bdf README.md +1f8a6e1a4441ac2fd7a07ddbdfea923ed1da9f3100db49dca729e141de92f4af README.md 44127adcfa30ee84bff9cd4b2d0c695355209550e76982d374122008728aa5bc reference_audio.py 5cb9bfd6810d3a93a637451980a4cc5c1436e5b84cfd1c7a111cd192e876351b reference_video.py 131bdfbb7a7173c9e7826859c0e648bfb69bd18bf20fa5528c0e18a63f888b26 reference.py @@ -100,6 +100,6 @@ c2883272b05a9a9146b5c6cf614ddae8a3e6893cd910902023aae61360195289 web/easy_bypas 9db0aa94f634578a962d5db49e5c70356040a59df968e3a2e531b327a623081f web/easy_load_image.js 873efcbd15c2d9fa10c9d5fc51a796ad3a18c0c6acceecf499c4b956aa845c6c web/easy_load_video.js 0c68d13a1f8beb7431a32b471f8b0612c42fcc4bf72dd97611a025d158008662 web/easy_v38.js -14fd162ba18c7302c9f2bf49b62daf324ed0e1a349d1c42d064c67a28e2e5c38 web/project_id.js +549a8150bc926bf142758b1610e3730547d6abcfbcddb0b37ed8baaaf86b38cb web/project_id.js 0cf8d49bcb71b30437dc893f6218dc4cfb1cd244b647e4fbc2861dea2271a33a web/reference_audio_ui.js 83d28cc0cd549066962dc21ceae05d2b189fe22391b556887eab2cc1800e1e80 examples/workflows/MiniMax_H3_Continuum_V38.zip diff --git a/WORKLOG.md b/WORKLOG.md index 4676575..fc10be7 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -1802,3 +1802,32 @@ D:\Codex\_snapshots\ComfyUI-H3-Continuum\pre-rollback-after-00038-fail-20260821_ - Added browser-only generation-input snapshots (including connected inputs) to withdraw stale actions without granting backend reuse. Stale queued Review intent returns to normal Continue/Next compatibility checks. Added a transient, non-destructive Start again from Chunk 1 button using existing manual boundary/automatic nonce controls, consumed once after Queue. Preserved manual boundaries, saved takes, serialized widget order and all Python runtime contracts. - Added real-JS lifecycle assertions for edits/undo, upstream prompt/media/bypass/reconnection, edits during generation, stale queue intent, direct manual regeneration, and one-shot restart. Focused frontend suite15 PASS after adapting extraction fixtures and simulating each completion's real queued settings. No GPU/model load/backend restart/workflow mutation/runtime deployment. Snapshots9 files verified. Final CPU checks, reviewer handoff and main push recorded in the task evidence folder and response. - Final lifecycle hardening also preserves edits during a delayed initial history fetch and prevents a queued baseline from another Run Name being used. Focused61 PASS; full1155 PASS in46.62s; Registry105/source256 declared hashes PASS; all recorded CUDA exits false/blocked0. H3情報チェック returned PASS / PUSH TO MAIN OK after delayed delivery (user also explicitly permitted review waiver for this hotfix only). Reviewer noted updated_utc must remain a write-time revision signal; current history reads do not write it. Publication scope remains main source only, no new tag/Release/Registry assets; 15-second static/noise unresolved. + +## 2026-09-08 — Local mode-selection setup repair + +- Reproduced the user's Full -> Review pre-generation screen takeover in a real-JS test before editing runtime logic. Added a transient setup-selection token; old saved completion no longer hides the settings on this user action. Explicit Return to Review and newly queued review results can reopen review. Mode selection preserves saved progress and does not force a new run or erase takes. Queue from setup cannot inherit a hidden old Retry/Finish; manual regeneration remains supported. +- New cases cover complete/partial saved state, Storage Off/On, normal ready card, serialized values, history refresh before/after Queue, delayed first history, prior-flight completion, different Run Name, explicit return and subsequent review completion. Existing facade fixture now supplies Queue and completion rather than equating injected history with execution. Focused90 PASS; final full1155 PASS/48.44s; first red reproduction and first full1154/1 fixture failure preserved. Syntax and whitespace checks pass; package/source hash declarations refreshed without changing membership. +- Seven one-file source snapshots verified. Evidence: D:/Codex/_test_results/ComfyUI-H3-Continuum/v38-mode-settings-20260908. Fixed H3情報チェック received self-contained report; deployment pending review. User backend GET only at127.0.0.6:8188, queue0/0; no GPU, Queue, restart, workflow change or publication. +- Deployment completed after fixed reviewer returned PASS / local deployment OK (self-contained report review, not independent file inspection). Backed up installed JS1 file, deployed only web/project_id.js, verified source=runtime=live HTTP200 SHA d84877206cc1142dbfe7fce3f7e9c1b6edb8a22cae5ab117a1407f9435f6dea7. Live object_info lists H3ContinuumSamplerV38 from custom_nodes.ComfyUI-H3-Continuum. Browser visual confirmation remains for user hard refresh. No commit/push, browser reload, backend lifecycle or GPU execution. + +## 2026-09-08 — Review boundary lifecycle correction, CPU Gate + +- Reclassified the user's latest run from “Chunk 1 completed” to saved-history reuse: prompt/history showed zero new physical groups, all three logical chunks reused, and the previous canonical `complete` revision retained. This disproved the prior presentation-only completion claim. +- Corrected the first Queue after an explicit Full Video -> Review Each Chunk selection. If canonical saved review history exists, the API payload alone starts a non-destructive automatic-nonce branch at Chunk 1; serialized/visible settings and saved Takes are preserved. Sampler execution clears the transient setup state, reloads backend truth, and subsequent Continue actions inherit the branch for Chunk 2 and Chunk 3. +- Added exact backend and real-frontend `3 x 5s` lifecycle coverage. Focused Review/UI regressions passed `123`; full CPU regression passed `1156/1156` in `50.69s`. Registry/source Manifest hashes, JavaScript syntax and whitespace checks pass. Evidence: `D:\Codex\_test_results\ComfyUI-H3-Continuum\v38-review-boundary-20260908`. Fixed H3情報チェック returned `PASS / local runtime deploy OK`; its queued-identity note was applied by requiring the exact setup token and Run name before `onExecuted` may release setup. Actual UI/GPU acceptance is deliberately not claimed. No workflow, Production/Sampling, commit, push or release change. + +## 2026-09-08 — Live Review Each Chunk lifecycle accepted + +- Replaced reliance on the unsupported frontend `beforeQueuePrompt` path with the ComfyUI `1.49.6` widget lifecycle: `beforeQueued` -> `serializeValue` -> `executed` -> `execution_success`. Added the exact lifecycle regression and deployed only `web/project_id.js` after a one-file runtime snapshot. +- Validation before deployment: supported-lifecycle test `1 passed`; full guarded CPU suite `1156 passed` in `50.60s`; `node --check` PASS. Final source/runtime JS SHA-256: `78BA840BB4B57D21BC17AAB9F5CA3C89E3BC3C7AAE1A027BBD3FF54512717A53`. +- User-operated live 3 x 5s prompts completed as intended: Chunk 1 prompt `8a9a2275-7f31-4e3b-bf7c-95747feefc2b` generated physical group 1 and opened Chunk 1 review; Chunk 2 prompt `5427b850-0490-4b07-8243-77f737be7ba3` reused one/generated one and opened Chunk 2 review; Chunk 3 prompt `ef38c575-faa8-45ea-8485-6ced1500298e` reused two/generated one and showed complete. Sampler node `312` was not cached in any run. +- Final canonical run: `run_c05b0771405f40f78fbdd8055632e458`, revision `83cf80b0a4ff378b`, active group revisions `f3e4cf7f740ce4c7ad469238`, `a49003f2b27ceb1088b3f776`, `fad8dff7f8641f6e4b5dcc78`. Final preview was a continuous 15-second result. +- No Python Production/Sampling, workflow, backend lifecycle, commit, push, tag, release, or Registry change. All GPU Queue actions were performed by the user. Record snapshot: `D:\Codex\_snapshots\ComfyUI-H3-Continuum\before-v38-live-review-record-20260908_160004` (2 files). + +### Render History diagnosis after live acceptance + +- Read-only live inspection captured the exact failure: `RunStorageError: selected Take provenance is invalid: group revision parent is missing`. The displayed selections `9db2a9287ef18796b770db00` and `f968bd1131c20912e207de0a` belong to old sampling lineages. +- Current `project.json` contains 76 revisions across 59 lineages. The accepted canonical lineage `963eb7095602aef239570525bf999e77b71d8bfa2d5c5cf40f96c78a163fd72e` contains only `f3e4cf7f740ce4c7ad469238 -> a49003f2b27ceb1088b3f776 -> fad8dff7f8641f6e4b5dcc78`. Frontend `takeCatalog()` does not filter lineages, while backend `_validated_take_selection()` deliberately does. +- Classification: feature exists and the backend rejection was safe; frontend catalog eligibility and rendering were defective. Fixed by filtering to canonical-lineage, fully resolvable ancestry; stale selections automatically return to a canonical Take with `Automatic` action. History output is compact and draw-height independent. +- Focused Review/History regression `59 passed`; full CPU regression `1156 passed` in `52.09s`. Runtime deployment changed only `web/project_id.js` after Queue `0/0`; source/runtime SHA-256 match at `549A8150BC926BF142758B1610E3730547D6ABCFBCDDB0B37ED8BAAAF86B38CB`. Runtime snapshot: `D:\Codex\_snapshots\ComfyUI-H3-Continuum\before-v38-render-history-runtime-deploy-20260908_162700`. +- No Take was adopted and no generation was started by Codex. Live browser confirmation is pending reload because the existing ComfyUI tab is marked unsaved; it was not forcibly reloaded. diff --git a/tests/test_v38_completed_review_ui.py b/tests/test_v38_completed_review_ui.py index 803a98b..1f651e2 100644 --- a/tests/test_v38_completed_review_ui.py +++ b/tests/test_v38_completed_review_ui.py @@ -22,13 +22,27 @@ globalThis.fetch = async () => { if (fetchMode === "error") throw new Error("offline fixture"); return project ? {ok:true, status:200, json:async()=>structuredClone(project)} : {ok:false,status:404}; }; +const apiListeners=new Map(); globalThis.__app = { graph: {_nodes: [], links:{}, getNodeById:()=>null}, ui:{settings:{getSettingValue:(_id,fallback)=>fallback,addSetting(){}}}, + api:{addEventListener(name,callback){ + const callbacks=apiListeners.get(name)||[];callbacks.push(callback);apiListeners.set(name,callbacks); + }}, registerExtension(extension){this.extension=extension;} }; ''' cases = r''' +app.extension.setup(); +function emit(name,detail){for(const callback of apiListeners.get(name)||[])callback({type:name,detail});} +async function serializedInputs(n){ + const inputs={}; + for(const [index,widget] of n.widgets.entries()){ + if(!widget.name||widget.options?.serialize===false)continue; + inputs[widget.name]=widget.serializeValue?await widget.serializeValue(n,index):widget.value; + } + return inputs; +} function makeNode() { const values = { prompt_mode:"Auto",chunks:2,chunk_seconds:5,aspect:"Auto from First Image", @@ -97,8 +111,12 @@ async function load(n,p) {project=p;await loadTakeHistory(n);n.__h3ContinuumIntu w(n,"Render History").callback();assert(visible(n,"Render History / Takes")); const drawn=[]; const ctx={save(){},restore(){},beginPath(){},rect(){},clip(){},fillText(text){drawn.push(text);}}; - w(n,"Render History / Takes").draw(ctx,n,400,0,300); + const historyWidget=w(n,"Render History / Takes"); + const historyHeight=historyWidget.computeSize(400)[1]; + assert(historyHeight<=124,"history must not reserve a large empty panel"); + historyWidget.draw(ctx,n,400,0,20); assert(drawn.some(text=>text.startsWith("Selected:")),"selected Take is actually drawn, not an empty text widget"); + assert(drawn.length>1,"history draw must use its computed height, not the frontend's single-row hint"); w(n,"Render History").callback();assert(!visible(n,"Render History / Takes")); w(n,"Try this chunk again").callback(); const inputs={};prepareReviewQueueIntent(n,inputs); @@ -132,6 +150,137 @@ async function load(n,p) {project=p;await loadTakeHistory(n);n.__h3ContinuumIntu w(reloaded,"generation_mode").value="Review Each Chunk"; w(reloaded,"run_storage").value="Off";reloaded.__h3ContinuumProductionUxRefresh(); assert(buttons.every(name=>!visible(reloaded,name)),"storage off does not expose review actions"); + // Mode selection is setup, not a request to review an old saved result. + for (const oldStatus of ["complete", "review_ready"]) { + for (const storage of ["Off", "Save + Auto Resume"]) { + const setup=makeNode(); + setup.inputs=["model","clip","video_vae","sampler","sigmas"].map(name=>({name,link:1})); + w(setup,"size_source").value="Manual"; + w(setup,"Run").callback("Generate Full Video"); + w(setup,"run_storage").value=storage; + const old=state(oldStatus,{start:1,end:1,physical_group:1},`old-${oldStatus}-${storage}`); + await load(setup,old); + const before=setup.serialize().widgets_values.slice(); + w(setup,"Run").callback("Review Each Chunk"); + assert(visible(setup,"Chunks")&&visible(setup,"Run"),"mode switch keeps setup visible"); + assert(visible(setup,"Ready to Queue"),"mode switch keeps Queue-ready summary"); + assert.equal(w(setup,"Ready to Queue").__h3ContinuumInfoVariant,"ready"); + assert(!visible(setup,"Review Ready"),"old completion must not replace setup"); + assert(buttons.every(name=>!visible(setup,name)),"no retry/continue before choosing review"); + assert(!visible(setup,"Start again from Chunk 1"),"no restart button in mode setup"); + assert(visible(setup,"Return to Review"),"saved review remains explicitly accessible"); + const after=setup.serialize().widgets_values; + const changed=before.flatMap((v,i)=>v===after[i]?[]:[[v,after[i]]]); + assert.deepEqual(changed,storage==="Off" + ? [["Off","Save + Auto Resume"],["Full Run","Review Each Chunk"]] + : [["Full Run","Review Each Chunk"]],"mode switch must not reset generation intent or identity"); + await load(setup,old); + assert(visible(setup,"Chunks"),"same history refresh cannot reopen old review"); + w(setup,"Return to Review").callback(); + assert(visible(setup,"Try this chunk again"),"explicit return still opens saved result"); + w(setup,"Try this chunk again").callback(); + w(setup,"Back to Settings").callback(); + w(setup,"Run").callback("Generate Full Video"); + w(setup,"Run").callback("Review Each Chunk"); + const inputs={reroll_from_chunk:"Auto",reroll_nonce:0, + take_group:9,take_revision_id:"stale-take",take_action:"Use This Take"}; + prepareReviewQueueIntent(setup,inputs); + assert.equal(inputs.review_action,"Continue / Next"); + if(["complete","review_ready"].includes(oldStatus)){ + assert.equal(inputs.reroll_from_chunk,"Chunk 1","saved history starts a new review branch"); + assert.equal(inputs.reroll_nonce,0); + assert.equal(inputs.take_group,0); + assert.equal(inputs.take_revision_id,""); + assert.equal(inputs.take_action,"Automatic"); + } + await load(setup,old); + assert(visible(setup,"Chunks"),"Queue alone does not mean generation completed"); + project=state("review_ready",{start:1,end:1,physical_group:1},"new-output"); + setup.onExecuted(); + await new Promise(resolve=>setImmediate(resolve)); + assert(buttons.every(name=>visible(setup,name)),"new queued result opens ordinary review"); + assert(!visible(setup,"Chunks")); + } + } + const delayedSetup=makeNode();await load(delayedSetup,null); + w(delayedSetup,"Run").callback("Generate Full Video"); + w(delayedSetup,"Run").callback("Review Each Chunk"); + await load(delayedSetup,state("complete",{start:2,end:2,physical_group:2},"late-old-history")); + assert(visible(delayedSetup,"Chunks")&&!visible(delayedSetup,"Review Ready"),"late initial history cannot leave setup"); + // A result queued before the user's mode selection must not steal setup focus. + const priorFlight=makeNode();await load(priorFlight,null); + w(priorFlight,"Run").callback("Generate Full Video"); + prepareReviewQueueIntent(priorFlight,{}); + w(priorFlight,"Run").callback("Review Each Chunk"); + await load(priorFlight,state("complete",{start:2,end:2,physical_group:2},"prior-flight")); + assert(visible(priorFlight,"Chunks")&&!visible(priorFlight,"Review Ready")); + const newRunSetup=makeNode();await load(newRunSetup,null); + w(newRunSetup,"Run").callback("Generate Full Video"); + w(newRunSetup,"Run").callback("Review Each Chunk"); + prepareReviewQueueIntent(newRunSetup,{}); + w(newRunSetup,"run_name").value="different-run"; + await load(newRunSetup,state("complete",{start:2,end:2,physical_group:2},"unrelated-history")); + assert(visible(newRunSetup,"Chunks")&&!visible(newRunSetup,"Review Ready")); + const wrongExecution=makeNode(); + await load(wrongExecution,state("complete",{start:3,end:3,physical_group:3},"wrong-run-old")); + w(wrongExecution,"Run").callback("Generate Full Video"); + w(wrongExecution,"Run").callback("Review Each Chunk"); + prepareReviewQueueIntent(wrongExecution,{reroll_from_chunk:"Auto",reroll_nonce:0}); + w(wrongExecution,"run_name").value="changed-after-queue"; + project=state("review_ready",{start:1,end:1,physical_group:1},"wrong-run-result"); + wrongExecution.onExecuted();await new Promise(resolve=>setImmediate(resolve)); + assert(visible(wrongExecution,"Chunks")&&!visible(wrongExecution,"Review Ready"), + "another Run identity cannot release the queued setup token"); + // Frontend 1.49 contract: widget.beforeQueued runs before serializeValue; + // legacy beforeQueuePrompt is not part of the real queue path. + const liveContract=makeNode();liveContract.id=312;app.graph._nodes=[liveContract]; + await load(liveContract,state("complete",{start:3,end:3,physical_group:3},"live-old-complete")); + w(liveContract,"Run").callback("Generate Full Video"); + w(liveContract,"Run").callback("Review Each Chunk"); + for(const widget of liveContract.widgets)widget.beforeQueued?.({isPartialExecution:false}); + const liveInputs=await serializedInputs(liveContract); + assert.equal(liveInputs.reroll_from_chunk,"Chunk 1"); + assert.equal(liveInputs.reroll_nonce,0); + assert.equal(liveInputs.take_group,0); + assert.equal(liveInputs.take_revision_id,""); + assert.equal(liveInputs.take_action,"Automatic"); + assert.equal(liveInputs.review_action,"Continue / Next"); + assert.equal(w(liveContract,"reroll_from_chunk").value,"Auto","visible settings stay unchanged"); + project=state("review_ready",{start:1,end:1,physical_group:1},"live-fresh-chunk-1"); + emit("executed",{node:"312",prompt_id:"live-prompt"}); + emit("execution_success",{prompt_id:"live-prompt"}); + await new Promise(resolve=>setTimeout(resolve,20)); + assert(buttons.every(name=>visible(liveContract,name)),"real completion events open Chunk 1 review"); + assert.match(w(liveContract,"Review Ready").value,/Chunk 1/); + // Acceptance lifecycle: 3 x 5 seconds must stop at every review boundary. + const flow=makeNode();w(flow,"chunks").value=3;w(flow,"chunk_seconds").value=5; + await load(flow,state("complete",{start:3,end:3,physical_group:3},"old-complete-3x5")); + w(flow,"Run").callback("Generate Full Video"); + w(flow,"Run").callback("Review Each Chunk"); + const chunk1Inputs={reroll_from_chunk:"Auto",reroll_nonce:0}; + prepareReviewQueueIntent(flow,chunk1Inputs); + assert.equal(chunk1Inputs.reroll_from_chunk,"Chunk 1"); + project=state("review_ready",{start:1,end:1,physical_group:1},"fresh-chunk-1"); + flow.onExecuted();await new Promise(resolve=>setImmediate(resolve)); + assert(buttons.every(name=>visible(flow,name)),"Chunk 1 opens the review screen"); + assert.match(w(flow,"Review Ready").value,/Chunk 1/); + w(flow,"Use it and continue").callback(); + const chunk2Inputs={reroll_from_chunk:"Auto",reroll_nonce:0}; + prepareReviewQueueIntent(flow,chunk2Inputs); + assert.equal(chunk2Inputs.reroll_from_chunk,"Auto","continuation does not restart Chunk 1"); + project=state("review_ready",{start:2,end:2,physical_group:2},"fresh-chunk-2"); + flow.onExecuted();await new Promise(resolve=>setImmediate(resolve)); + assert(buttons.every(name=>visible(flow,name)),"Chunk 2 opens the review screen"); + assert.match(w(flow,"Review Ready").value,/Chunk 2/); + w(flow,"Use it and continue").callback(); + const chunk3Inputs={reroll_from_chunk:"Auto",reroll_nonce:0}; + prepareReviewQueueIntent(flow,chunk3Inputs); + assert.equal(chunk3Inputs.reroll_from_chunk,"Auto"); + project=state("complete",{start:3,end:3,physical_group:3},"fresh-chunk-3"); + flow.onExecuted();await new Promise(resolve=>setImmediate(resolve)); + assert(visible(flow,"Try this chunk again"),"Chunk 3 completion remains reviewable"); + assert(!visible(flow,"Use it and continue")&&!visible(flow,"Use it and finish the rest")); + assert.match(w(flow,"Review Ready").value,/Saved sequence is complete/); // Hotfix: stale saved review cannot offer/submit Retry after settings edits. const edited=makeNode();w(edited,"chunks").value=4; const originalProject=state("review_ready",{start:2,end:2,physical_group:2},"edit-base"); diff --git a/tests/test_v38_public_surface_cleanup.py b/tests/test_v38_public_surface_cleanup.py index cc852b6..8236883 100644 --- a/tests/test_v38_public_surface_cleanup.py +++ b/tests/test_v38_public_surface_cleanup.py @@ -364,6 +364,7 @@ setTimeout(() => {{ const historyHiddenBeforeTake = node.widgets.find( (item) => item.name === "Render History", ).hidden; + prepareReviewQueueIntent(node, {{}}); node.__h3ContinuumTakeProject = {{ branch_provenance_version: 1, canonical_storage_revision_id: "storage-ready", @@ -378,6 +379,8 @@ setTimeout(() => {{ group: {{ start: 1, end: 1, physical_group: 1 }}, }}], }}; + finishModeSetupAfterExecution(node); + node.__h3ContinuumRememberReviewSettings(); // The queued generation completed. node.__h3ContinuumProductionUxRefresh(); const reviewButtonsVisibleWhenReady = [ "Use it and continue", "Try this chunk again", "Use it and finish the rest", diff --git a/tests/test_v38_review_run_storage.py b/tests/test_v38_review_run_storage.py index 007e160..d6d758a 100644 --- a/tests/test_v38_review_run_storage.py +++ b/tests/test_v38_review_run_storage.py @@ -224,6 +224,7 @@ def _resolve( take_action: str = "Automatic", take_group: int = 0, take_revision_id: str = "", + manual_regenerate_from: int = 0, ): controller = RunStorageController("phase-d-review") controller.run_root = tmp_path / "run" @@ -233,7 +234,7 @@ def _resolve( controller.configure_review( generation_mode=generation_mode, review_action=review_action, - manual_regenerate_from=0, + manual_regenerate_from=manual_regenerate_from, take_action=take_action, take_group=take_group, take_revision_id=take_revision_id, @@ -507,6 +508,67 @@ def test_n3_continue_after_nonce_two_keeps_branch_and_nonce(tmp_path): assert (resolved["reroll_from_chunk"], nonce) == (2, 2) +def test_complete_three_chunk_run_can_start_fresh_review_and_advance_one_chunk( + tmp_path, +): + base = _contract(chunks=3) + _persist( + tmp_path, + base, + prefix=3, + review_unit=(3, 3), + updated_utc="2026-08-31T00:00:01+00:00", + ) + + first, chunk_1, nonce_1, _ = _resolve( + tmp_path, + base, + manual_regenerate_from=1, + ) + assert (chunk_1["reroll_from_chunk"], nonce_1) == (1, 1) + assert first.review_execution.max_new_physical_groups == 1 + assert ( + first.review_execution.next_review_unit_start, + first.review_execution.next_review_unit_end, + ) == (1, 1) + _persist( + tmp_path, + chunk_1, + prefix=1, + review_unit=(1, 1), + updated_utc="2026-08-31T00:00:02+00:00", + ) + + second, chunk_2, nonce_2, _ = _resolve(tmp_path, base) + assert (chunk_2["reroll_from_chunk"], nonce_2) == (1, 1) + assert ( + second.review_execution.next_review_unit_start, + second.review_execution.next_review_unit_end, + ) == (2, 2) + _persist( + tmp_path, + chunk_2, + prefix=2, + review_unit=(2, 2), + updated_utc="2026-08-31T00:00:03+00:00", + ) + + third, chunk_3, nonce_3, _ = _resolve(tmp_path, base) + assert (chunk_3["reroll_from_chunk"], nonce_3) == (1, 1) + assert ( + third.review_execution.next_review_unit_start, + third.review_execution.next_review_unit_end, + ) == (3, 3) + complete = _persist( + tmp_path, + chunk_3, + prefix=3, + review_unit=(3, 3), + updated_utc="2026-08-31T00:00:04+00:00", + ) + assert complete.manifest["status"] == REVISION_STATUS_COMPLETE + + def test_n4_interrupted_nonce_two_resume_does_not_advance(tmp_path): branch = _contract(boundary=2, nonce=2) _persist( diff --git a/tests/test_v38_review_ui.py b/tests/test_v38_review_ui.py index 5c2805b..b6bb083 100644 --- a/tests/test_v38_review_ui.py +++ b/tests/test_v38_review_ui.py @@ -266,6 +266,7 @@ def test_f0_f7_frontend_review_lifecycle(tmp_path): _function_source(source, "isOneShotReviewAction", "normalizeReviewActionOnLoad"), _function_source(source, "normalizeReviewActionOnLoad", "resetReviewActionAfterQueued"), _function_source(source, "resetReviewActionAfterQueued", "prepareReviewQueueIntent"), + _function_source(source, "canonicalStorageRevision", "reviewSettingsSnapshot"), _function_source(source, "prepareReviewQueueIntent", "configureReviewControls"), _function_source(source, "configureReviewControls", "configureAssembler"), ) @@ -745,14 +746,17 @@ const finished = {{ plan: findWidget(node, PRODUCTION_STATUS_WIDGET).value, }}; -node.__h3ContinuumTakeProject = {{ - branch_provenance_version: 1, - active_revisions: {{ "3": "r3b" }}, - group_revisions: [ - {{ revision_id: "r3a", revision_order: "1", group: {{ physical_group: 3 }} }}, - {{ revision_id: "r3b", revision_order: "2", group: {{ physical_group: 3 }} }}, - ], -}}; + node.__h3ContinuumTakeProject = {{ + branch_provenance_version: 1, + canonical_head_revision_id: "r3b", + active_revisions: {{ "1": "r1", "2": "r2", "3": "r3b" }}, + group_revisions: [ + {{ revision_id: "r1", parent_revision_id: null, revision_order: "1", group: {{ physical_group: 1 }} }}, + {{ revision_id: "r2", parent_revision_id: "r1", revision_order: "2", group: {{ physical_group: 2 }} }}, + {{ revision_id: "r3a", parent_revision_id: "r2", revision_order: "3a", group: {{ physical_group: 3 }} }}, + {{ revision_id: "r3b", parent_revision_id: "r2", revision_order: "3b", group: {{ physical_group: 3 }} }}, + ], + }}; node.__h3ContinuumProductionUxRefresh(); findWidget(node, TAKE_PREVIOUS_WIDGET).callback(); findWidget(node, TAKE_USE_WIDGET).callback(); @@ -921,13 +925,16 @@ const project = {{ "5": "r56a-canonical-head", }}, group_revisions: [ - {{ revision_id: "r1-root", parent_revision_id: null, variation_nonce: 0, revision_order: "01", group: {{ physical_group: 1, start: 1, end: 1 }} }}, - {{ revision_id: "r2-main", parent_revision_id: "r1-root", variation_nonce: 0, revision_order: "02", group: {{ physical_group: 2, start: 2, end: 2 }} }}, - {{ revision_id: "r3a-canonical", parent_revision_id: "r2-main", variation_nonce: 1, revision_order: "03a", group: {{ physical_group: 3, start: 3, end: 3 }} }}, - {{ revision_id: "r3b-selected", parent_revision_id: "r2-main", variation_nonce: 2, revision_order: "03b", group: {{ physical_group: 3, start: 3, end: 3 }} }}, - {{ revision_id: "r4a-canonical", parent_revision_id: "r3a-canonical", variation_nonce: 1, revision_order: "04a", group: {{ physical_group: 4, start: 4, end: 4 }} }}, - {{ revision_id: "r4b-branch", parent_revision_id: "r3b-selected", variation_nonce: 2, revision_order: "04b", group: {{ physical_group: 4, start: 4, end: 4 }} }}, - {{ revision_id: "r56a-canonical-head", parent_revision_id: "r4a-canonical", variation_nonce: 1, revision_order: "05", group: {{ physical_group: 5, start: 5, end: 6 }} }}, + {{ revision_id: "r1-root", parent_revision_id: null, lineage_sha256: "current-lineage", variation_nonce: 0, revision_order: "01", group: {{ physical_group: 1, start: 1, end: 1 }} }}, + {{ revision_id: "r2-main", parent_revision_id: "r1-root", lineage_sha256: "current-lineage", variation_nonce: 0, revision_order: "02", group: {{ physical_group: 2, start: 2, end: 2 }} }}, + {{ revision_id: "r3a-canonical", parent_revision_id: "r2-main", lineage_sha256: "current-lineage", variation_nonce: 1, revision_order: "03a", group: {{ physical_group: 3, start: 3, end: 3 }} }}, + {{ revision_id: "r3b-selected", parent_revision_id: "r2-main", lineage_sha256: "current-lineage", variation_nonce: 2, revision_order: "03b", group: {{ physical_group: 3, start: 3, end: 3 }} }}, + {{ revision_id: "r4a-canonical", parent_revision_id: "r3a-canonical", lineage_sha256: "current-lineage", variation_nonce: 1, revision_order: "04a", group: {{ physical_group: 4, start: 4, end: 4 }} }}, + {{ revision_id: "r4b-branch", parent_revision_id: "r3b-selected", lineage_sha256: "current-lineage", variation_nonce: 2, revision_order: "04b", group: {{ physical_group: 4, start: 4, end: 4 }} }}, + {{ revision_id: "r56a-canonical-head", parent_revision_id: "r4a-canonical", lineage_sha256: "current-lineage", variation_nonce: 1, revision_order: "05", group: {{ physical_group: 5, start: 5, end: 6 }} }}, + {{ revision_id: "old-root", parent_revision_id: null, lineage_sha256: "old-lineage", variation_nonce: 0, revision_order: "old-01", group: {{ physical_group: 1, start: 1, end: 1 }} }}, + {{ revision_id: "old-group-2", parent_revision_id: "old-root", lineage_sha256: "old-lineage", variation_nonce: 0, revision_order: "old-02", group: {{ physical_group: 2, start: 2, end: 2 }} }}, + {{ revision_id: "orphan-group-2", parent_revision_id: "missing-root", lineage_sha256: "current-lineage", variation_nonce: 3, revision_order: "orphan", group: {{ physical_group: 2, start: 2, end: 2 }} }}, ], }}; @@ -943,6 +950,7 @@ const one = makeNode({{ const oneText = takeStatus(one); const node = makeNode(project); +const catalogIds = takeCatalog(node).map((item) => item.revision_id); findWidget(node, TAKE_GROUP_WIDGET).value = 3; findWidget(node, TAKE_REVISION_WIDGET).value = "r3b-selected"; const selectedText = takeStatus(node); @@ -1012,6 +1020,7 @@ const missingResult = {{ console.log(JSON.stringify({{ oneText, selectedText, + catalogIds, canonicalBefore, previous, next, @@ -1032,18 +1041,22 @@ console.log(JSON.stringify({{ ) observed = json.loads(result.stdout) - assert "Group 1\n Take 1/1" in observed["oneText"] - assert "✓ Canonical | Head" in observed["oneText"] + assert "Selected: Group 1 / Take 1" in observed["oneText"] + assert "Compatible history: 1 Take" in observed["oneText"] assert "Run Storage: Off" in observed["oneText"] selected = observed["selectedText"] assert "Selected: Group 3 / Take 2 | r3b-selected" in selected assert "Canonical: Group 3 / Take 1 | r3a-canonic" in selected assert "Canonical head: Group 5-6 (atomic) / Take 1 | r56a-canonic" in selected + assert "Compatible history: 7 Takes" in selected + assert "3 incompatible or incomplete Takes hidden" in selected assert "Continue From Here: Reuse Groups 1-3" in selected assert "Regenerate Groups 4, 5-6 (atomic)" in selected - assert "Take 2/2 | r3b-selected | nonce 2 | parent r2-main | ← Selected" in selected - assert "Take 1/2 | r3a-canonica | nonce 1" in selected + assert observed["catalogIds"] == [ + "r1-root", "r2-main", "r3a-canonical", "r3b-selected", + "r4a-canonical", "r4b-branch", "r56a-canonical-head", + ] assert observed["previous"] == { "group": 3, diff --git a/web/project_id.js b/web/project_id.js index 3bbc01c..1aa2c80 100644 --- a/web/project_id.js +++ b/web/project_id.js @@ -421,6 +421,62 @@ function installProductionSerializationGuard(node) { node.__h3ContinuumProductionSerializationGuard = true; } +function reviewModeSetupActive(node) { + return ( + node?.comfyClass === V38_NODE_CLASS + && Boolean(node.__h3ContinuumModeSetup) + && findWidget(node, GENERATION_MODE_WIDGET)?.value === GENERATION_MODE_REVIEW + ); +} + +function installReviewModeSetupQueueContract(node) { + if (node.__h3ContinuumModeSetupQueueContract) return; + const generationWidget = findWidget(node, GENERATION_MODE_WIDGET); + if (!generationWidget) return; + + // ComfyUI frontend 1.49 serializes API inputs through widget.serializeValue. + // Keep the visible/saved settings intact while making the first Queue after + // Full Run -> Review Each Chunk an explicit, non-destructive Chunk 1 branch. + const overrides = new Map([ + [REVIEW_ACTION_WIDGET, REVIEW_ACTION_CONTINUE], + [REGENERATE_WIDGET, "Chunk 1"], + [REROLL_NONCE_WIDGET, 0], + [TAKE_GROUP_WIDGET, 0], + [TAKE_REVISION_WIDGET, ""], + [TAKE_ACTION_WIDGET, TAKE_ACTION_AUTOMATIC], + ]); + for (const [name, value] of overrides) { + const widget = findWidget(node, name); + if (!widget || widget.__h3ContinuumModeSetupSerializeValue) continue; + const previous = widget.serializeValue; + widget.serializeValue = function(...args) { + if (reviewModeSetupActive(node)) return value; + return typeof previous === "function" + ? previous.apply(this, args) + : this.value; + }; + widget.__h3ContinuumModeSetupSerializeValue = true; + } + + const previousBeforeQueued = generationWidget.beforeQueued; + generationWidget.beforeQueued = function(...args) { + const result = previousBeforeQueued?.apply(this, args); + if (reviewModeSetupActive(node)) { + node.__h3ContinuumModeSetupQueued = { + setup: node.__h3ContinuumModeSetup, + runName: takeRunName(node), + promptId: "", + }; + node.__h3ContinuumQueuedSettings = reviewSettingsSnapshot(node); + node.__h3ContinuumQueuedSettingsRun = takeRunName(node); + } else { + delete node.__h3ContinuumModeSetupQueued; + } + return result; + }; + node.__h3ContinuumModeSetupQueueContract = true; +} + function addTransientProductionWidget(node, type, name, value, callback, options = {}) { if (typeof node.addWidget !== "function") return null; const widget = node.addWidget( @@ -1039,6 +1095,14 @@ function configureIntuitiveV38Ux(node) { ), onSet: (value, source) => { const reviewing = value === FACADE_GENERATE_REVIEW; + if (reviewing && source.value !== GENERATION_MODE_REVIEW) { + // Selecting a mode is setup, not selecting a saved review. + node.__h3ContinuumModeSetup = {}; + delete node.__h3ContinuumModeSetupQueued; + } else if (!reviewing) { + delete node.__h3ContinuumModeSetup; + delete node.__h3ContinuumModeSetupQueued; + } setExistingWidgetValue( source, reviewing ? GENERATION_MODE_REVIEW : GENERATION_MODE_FULL_RUN, @@ -1372,6 +1436,43 @@ function rememberReviewSettings(node, requestedSettings) { delete node.__h3ContinuumQueuedSettingsRun; } +function finishModeSetupAfterExecution(node, promptId = "") { + const queued = node.__h3ContinuumModeSetupQueued; + if ( + !queued + || queued.setup !== node.__h3ContinuumModeSetup + || queued.runName !== takeRunName(node) + || (promptId && queued.promptId !== promptId) + ) { + return false; + } + delete node.__h3ContinuumModeSetupQueued; + delete node.__h3ContinuumModeSetup; + node.__h3ContinuumIntuitiveUxRefresh?.(); + node.__h3ContinuumProductionUxRefresh?.(); + return true; +} + +function bindModeSetupPromptFromExecutedNode(event) { + const detail = event?.detail || event || {}; + const promptId = String(detail.prompt_id || ""); + const executedNodeId = String(detail.display_node || detail.node || ""); + if (!promptId || !executedNodeId) return; + for (const node of app.graph?._nodes || []) { + const queued = node.__h3ContinuumModeSetupQueued; + if ( + node.comfyClass !== V38_NODE_CLASS + || String(node.id) !== executedNodeId + || !queued + || queued.setup !== node.__h3ContinuumModeSetup + || queued.runName !== takeRunName(node) + ) { + continue; + } + queued.promptId = promptId; + } +} + function selectProductionRestart(node) { clearTakeSelection(node); setExistingWidgetValue(findWidget(node, REVIEW_ACTION_WIDGET), REVIEW_ACTION_CONTINUE); @@ -1487,11 +1588,59 @@ function takeGroup(item) { } function takeCatalog(node) { - const revisions = node.__h3ContinuumTakeProject?.group_revisions; + const project = node.__h3ContinuumTakeProject; + const revisions = project?.group_revisions; if (!Array.isArray(revisions)) return []; - const sorted = revisions + const normalized = revisions .map((item) => ({ item, group: takeGroup(item) })) - .filter(({ item, group }) => group && String(item?.revision_id || "")) + .filter(({ item, group }) => group && String(item?.revision_id || "")); + if (!normalized.length) return []; + + // project.json is an archive for every sampling lineage that has used this + // Run Name. Take actions, however, are deliberately validated by the + // backend against the current canonical lineage only. Never present old + // lineages (or orphaned ancestry) as actionable history. + const normalizedById = new Map(normalized.map( + (entry) => [String(entry.item.revision_id), entry], + )); + const activeIds = Object.values(project?.active_revisions || {}).map(String); + const anchor = normalizedById.get(String(project?.canonical_head_revision_id || "")) + || activeIds.map((revisionId) => normalizedById.get(revisionId)).find(Boolean) + || null; + const canonicalLineage = String(anchor?.item?.lineage_sha256 || ""); + const lineageAware = normalized.some( + ({ item }) => Boolean(String(item?.lineage_sha256 || "")), + ); + if (lineageAware && !canonicalLineage) return []; + const scoped = canonicalLineage + ? normalized.filter( + ({ item }) => String(item?.lineage_sha256 || "") === canonicalLineage, + ) + : normalized; + const scopedById = new Map(scoped.map( + (entry) => [String(entry.item.revision_id), entry], + )); + const resolvable = ({ item }) => { + const reverse = []; + const seen = new Set(); + let revisionId = String(item.revision_id || ""); + while (revisionId) { + if (seen.has(revisionId)) return false; + seen.add(revisionId); + const entry = scopedById.get(revisionId); + if (!entry) return false; + reverse.push(entry); + revisionId = String(entry.item.parent_revision_id || ""); + } + let expectedStart = 1; + for (const entry of reverse.reverse()) { + if (entry.group.start !== expectedStart) return false; + expectedStart = entry.group.end + 1; + } + return true; + }; + const sorted = scoped + .filter(resolvable) .sort((left, right) => ( left.group.physical_group - right.group.physical_group || String(left.item.revision_order || left.item.revision_id).localeCompare( @@ -1638,6 +1787,10 @@ function takeStatus(node) { (item) => item.revision_id === project.canonical_head_revision_id, ) || null; const action = findWidget(node, TAKE_ACTION_WIDGET)?.value || TAKE_ACTION_AUTOMATIC; + const rawCount = Array.isArray(project.group_revisions) + ? project.group_revisions.length + : 0; + const hiddenCount = Math.max(0, rawCount - catalog.length); const lines = [ `Selected: ${takeLabel(selected)} | ${shortRevision(selected.revision_id)}`, canonical @@ -1646,38 +1799,20 @@ function takeStatus(node) { canonicalHead ? `Canonical head: ${takeLabel(canonicalHead)} | ${shortRevision(canonicalHead.revision_id)}` : "Canonical head: unavailable", + `Compatible history: ${catalog.length} Take${catalog.length === 1 ? "" : "s"}`, continueFromTakeSummary(project, selected, catalog), ]; + if (hiddenCount) { + lines.push( + `${hiddenCount} incompatible or incomplete Take${hiddenCount === 1 ? "" : "s"} hidden`, + ); + } if (findWidget(node, RUN_STORAGE_WIDGET)?.value === "Off") { lines.push("Run Storage: Off (history view only; a Take action enables storage)"); } if (action !== TAKE_ACTION_AUTOMATIC) { lines.push(`Next Queue: ${action} (normal Queue required)`); } - const groups = new Map(); - for (const item of catalog) { - const key = item.group.physical_group; - if (!groups.has(key)) groups.set(key, []); - groups.get(key).push(item); - } - for (const items of groups.values()) { - lines.push(`Group ${physicalGroupLabel(items[0].group)}`); - for (const item of items) { - const markers = []; - if (item.revision_id === selected.revision_id) markers.push("← Selected"); - if (project.active_revisions?.[String(item.group.physical_group)] === item.revision_id) { - markers.push("✓ Canonical"); - } - if (project.canonical_head_revision_id === item.revision_id) markers.push("Head"); - lines.push( - ` Take ${item.take_number}/${item.take_count}` - + ` | ${shortRevision(item.revision_id)}` - + ` | nonce ${Number(item.variation_nonce || 0)}` - + ` | parent ${shortRevision(item.parent_revision_id)}` - + (markers.length ? ` | ${markers.join(" | ")}` : ""), - ); - } - } return lines.join("\n"); } @@ -1808,8 +1943,12 @@ async function loadTakeHistory(node) { } function refreshV38TakeHistoryAfterExecution(event) { + const promptId = String(event?.detail?.prompt_id || ""); for (const node of app.graph?._nodes || []) { if (node.comfyClass !== V38_NODE_CLASS) continue; + if (event?.type === "execution_success" && promptId) { + finishModeSetupAfterExecution(node, promptId); + } if (event?.type !== "execution_success") delete node.__h3ContinuumQueuedSettings; void loadTakeHistory(node); setTimeout(() => void loadTakeHistory(node), 250); @@ -1906,6 +2045,8 @@ function configureProductionReviewUx(node) { PRODUCTION_RETURN_TO_REVIEW_WIDGET, null, () => { + delete node.__h3ContinuumModeSetup; + delete node.__h3ContinuumModeSetupQueued; node.__h3ContinuumReviewSettingsOpen = false; node.__h3ContinuumIntuitiveUxRefresh?.(); node.__h3ContinuumProductionUxRefresh?.(); @@ -1946,16 +2087,20 @@ function configureProductionReviewUx(node) { options: { serialize: false }, [PRODUCTION_TRANSIENT_WIDGET]: true, draw(ctx, _node, width, y, height) { + const renderHeight = Math.max( + 28, + Number(this.computeSize?.(width)?.[1] || height || 28), + ); ctx.save(); ctx.beginPath(); - ctx.rect(15, y + 4, Math.max(1, width - 30), height - 8); + ctx.rect(15, y + 4, Math.max(1, width - 30), renderHeight - 8); ctx.clip(); ctx.fillStyle = "#eeeeee"; ctx.font = "12px Arial"; ctx.textAlign = "left"; ctx.textBaseline = "top"; const lines = String(this.value || "").split("\n"); - const count = Math.max(1, Math.floor((height - 12) / 16)); + const count = Math.max(1, Math.floor((renderHeight - 12) / 16)); for (let i = 0; i < Math.min(lines.length, count); i++) { ctx.fillText(lines[i], 18, y + 6 + i * 16, Math.max(1, width - 36)); } @@ -1974,7 +2119,10 @@ function configureProductionReviewUx(node) { takeStatusWidget.disabled = true; takeStatusWidget.computeSize = () => { const lines = String(takeStatusWidget.value || "").split("\n").length; - return [Math.max(300, Number(node.size?.[0] || 0)), Math.min(300, 42 + lines * 16)]; + return [ + Math.max(300, Number(node.size?.[0] || 0)), + Math.min(124, Math.max(44, 12 + lines * 16)), + ]; }; setWidgetTooltip(takeStatusWidget, ( "Read-only Branch Provenance from Run Storage. Selecting a Take does not " @@ -2004,6 +2152,7 @@ function configureProductionReviewUx(node) { const previous = node.onExecuted; node.onExecuted = function(...args) { const result = previous?.apply(this, args); + finishModeSetupAfterExecution(this); void loadTakeHistory(this); return result; }; @@ -2029,8 +2178,9 @@ function configureProductionReviewUx(node) { } else if (!ready) { node.__h3ContinuumReviewSettingsOpen = false; } - const settingsOpen = ready && Boolean(node.__h3ContinuumReviewSettingsOpen); - const reviewOpen = ready && !settingsOpen; + const modeSetup = Boolean(node.__h3ContinuumModeSetup); + const settingsOpen = ready && !modeSetup && Boolean(node.__h3ContinuumReviewSettingsOpen); + const reviewOpen = ready && !modeSetup && !settingsOpen; const from = findWidget(node, REGENERATE_WIDGET)?.value; const edited = reviewSettingsChanged(node); const canReview = !edited && (!from || from === "Auto" || from === 0); @@ -2064,9 +2214,9 @@ function configureProductionReviewUx(node) { } else if (widget.name === PRODUCTION_BACK_TO_SETTINGS_WIDGET) { setWidgetVisible(widget, reviewOpen); } else if (widget.name === PRODUCTION_RETURN_TO_REVIEW_WIDGET) { - setWidgetVisible(widget, settingsOpen); + setWidgetVisible(widget, settingsOpen || (ready && modeSetup)); } else if (widget.name === PRODUCTION_RESTART_WIDGET) { - setWidgetVisible(widget, ready); + setWidgetVisible(widget, ready && !modeSetup); } else if (widget.name === TAKE_TOGGLE_WIDGET) { setWidgetVisible(widget, reviewOpen && takeCount > 0); } else if (historyNames.has(widget.name)) { @@ -2090,6 +2240,7 @@ function configureProductionReviewUx(node) { } const catalog = takeCatalog(node); const hasSelection = Boolean(selectedTake(node)); + const takeActionAvailable = hasSelection && !edited; const historyToggle = transientProductionWidgets(node).find( (widget) => widget.name === TAKE_TOGGLE_WIDGET, ); @@ -2116,7 +2267,7 @@ function configureProductionReviewUx(node) { } for (const name of [TAKE_USE_WIDGET, TAKE_CONTINUE_WIDGET]) { const widget = transientProductionWidgets(node).find((item) => item.name === name); - if (widget) widget.disabled = !hasSelection; + if (widget) widget.disabled = !takeActionAvailable; } if (reviewOpen) { for (const widget of facadeProductionWidgets(node)) { @@ -2514,20 +2665,42 @@ function prepareReviewQueueIntent(node, apiInputs) { const selectedAction = actionWidget.value; const from = findWidget(node, REGENERATE_WIDGET)?.value; const staleReview = node.__h3ContinuumReviewSettingsChanged?.() || false; + const modeSetup = Boolean(node.__h3ContinuumModeSetup); + const savedStatus = canonicalStorageRevision(node.__h3ContinuumTakeProject)?.status; + const savedReview = ["review_ready", "complete"].includes(savedStatus); const manualRegenerate = from && from !== "Auto" && from !== 0; - const submittedAction = generationMode === GENERATION_MODE_FULL_RUN || staleReview || manualRegenerate + const submittedAction = generationMode === GENERATION_MODE_FULL_RUN || staleReview || manualRegenerate || modeSetup ? REVIEW_ACTION_CONTINUE : selectedAction; - if (staleReview || manualRegenerate) { + if (staleReview || manualRegenerate || modeSetup) { actionWidget.value = REVIEW_ACTION_CONTINUE; delete node[REVIEW_UI_SELECTION]; } apiInputs[GENERATION_MODE_WIDGET] = generationMode; apiInputs[REVIEW_ACTION_WIDGET] = submittedAction; - const takeAction = findWidget(node, TAKE_ACTION_WIDGET)?.value || TAKE_ACTION_AUTOMATIC; + let takeAction = findWidget(node, TAKE_ACTION_WIDGET)?.value || TAKE_ACTION_AUTOMATIC; apiInputs[TAKE_GROUP_WIDGET] = Number(findWidget(node, TAKE_GROUP_WIDGET)?.value || 0); apiInputs[TAKE_REVISION_WIDGET] = String(findWidget(node, TAKE_REVISION_WIDGET)?.value || ""); apiInputs[TAKE_ACTION_WIDGET] = takeAction; + if (generationMode === GENERATION_MODE_REVIEW && modeSetup) { + // Saved results are history, not the first result of a newly selected + // Review Each Chunk run. Start a non-destructive branch at Chunk 1 in + // the queued payload; keep the visible settings unchanged. + if (savedReview) { + apiInputs[REGENERATE_WIDGET] = "Chunk 1"; + apiInputs[REROLL_NONCE_WIDGET] = 0; + apiInputs[TAKE_GROUP_WIDGET] = 0; + apiInputs[TAKE_REVISION_WIDGET] = ""; + apiInputs[TAKE_ACTION_WIDGET] = TAKE_ACTION_AUTOMATIC; + takeAction = TAKE_ACTION_AUTOMATIC; + } + node.__h3ContinuumModeSetupQueued = { + setup: node.__h3ContinuumModeSetup, + runName: takeRunName(node), + }; + } else { + delete node.__h3ContinuumModeSetupQueued; + } node.__h3ContinuumCaptureReviewSettings?.(); if (node.__h3ContinuumRestartSelected && from === "Chunk 1") { node.__h3ContinuumRestartQueued = true; @@ -2677,6 +2850,7 @@ function configureNode(node) { configureReviewControls(node); configureIntuitiveV38Ux(node); configureProductionReviewUx(node); + installReviewModeSetupQueueContract(node); applyV38View(node); node.setDirtyCanvas?.(true, true); return projectWidget; @@ -2693,6 +2867,10 @@ app.registerExtension({ name: "H3Continuum.ProjectId", setup() { + app.api?.addEventListener?.( + "executed", + bindModeSetupPromptFromExecutedNode, + ); for (const eventName of [ "execution_success", "execution_error", @@ -2763,6 +2941,12 @@ app.registerExtension({ node.__h3ContinuumResolutionUxRefresh?.(); requireFixedSeedForReview(node); normalizeRunStorageState(node, apiNode.inputs); + if ( + node.comfyClass === V38_NODE_CLASS + && node.__h3ContinuumModeSetup + ) { + await loadTakeHistory(node); + } prepareReviewQueueIntent(node, apiNode.inputs); apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false) ? "Detailed Report"