From 47b42440da8764df54cc67c09b71fad7f558d43b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Nov 2026 10:50:22 +0000 Subject: [PATCH] Review round 12: project re-checked after the queue question too Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Tw9fjX7o2YfeGQE18MEtPu --- app/ui/features/generate/hub.test.js | 10 ++++++++++ app/ui/features/generate/index.js | 1 + 2 files changed, 11 insertions(+) diff --git a/app/ui/features/generate/hub.test.js b/app/ui/features/generate/hub.test.js index 0db65dba..3c16d769 100644 --- a/app/ui/features/generate/hub.test.js +++ b/app/ui/features/generate/hub.test.js @@ -327,3 +327,13 @@ test("a busy check that errors does not block Generate, and Stop ends the wait", assert.ok(Date.now() - t < 3500, "the wait ended with Stop"); assert.equal(queued, 1, "no shot of the stopped run went"); }); + +test("a project opened while ComfyUI's queue is being asked about is not run", async () => { + let queued = 0; + const { app, doc } = rig("idle", { generate: async () => { queued += 1; return true; } }); + app.has = new Set(); + app.api.upscaleBusy = async () => ({ busy: false }); + app.api.projectQueued = async () => { app.project.project = { ...doc, id: "Other" }; return false; }; + await app.runner.units(["a"], 1); + assert.equal(queued, 0); +}); diff --git a/app/ui/features/generate/index.js b/app/ui/features/generate/index.js index 422e5aea..357f26a0 100644 --- a/app/ui/features/generate/index.js +++ b/app/ui/features/generate/index.js @@ -136,6 +136,7 @@ export default { if (!p.project || p.project.id !== pid) { tell("Stopped: another project was opened."); break; } // the wait can take minutes // The page's own guard does not see another tab: ComfyUI's queue does. Asked per shot: between this run's shots it is empty. if (app.api.projectQueued && (await app.api.projectQueued(pid))) { tell("This project already has a run in ComfyUI's queue (another tab or window?). Wait for it, or Stop it there."); break; } + if (!p.project || p.project.id !== pid) { tell("Stopped: another project was opened."); break; } // the queue answer can take seconds const done = g.waitForTerminal(); // listening before the run starts, so a fast one is not missed said = false; current = snap.scenes.findIndex((s) => s.id === root.id) + 1;