Stop a deleted video chain from keeping the GPU.

Interrupt now clears Comfy, and a missing shot list no longer continues to the next extension.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-30 13:07:17 -05:00
co-authored by Cursor
parent c88a8494d5
commit 9f82377b52
4 changed files with 77 additions and 16 deletions
+7 -2
View File
@@ -144,8 +144,13 @@ export async function queuePrompt(graph: unknown, clientId: string) {
}
export async function interruptComfy() {
const res = await comfyFetch('/interrupt', { method: 'POST' })
return res.ok
const res = await comfyFetch('/interrupt', { method: 'POST' }).catch(() => null)
await comfyFetch('/queue', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ clear: true })
}).catch(() => null)
return Boolean(res?.ok)
}
export async function fetchHistory(promptId: string) {
+18
View File
@@ -259,10 +259,13 @@ function seedCurrentVideo(job: Job) {
function chainShouldHold(job: Job) {
if (!job.library) return false
if (job.status === 'cancelled' || job.status === 'error') return true
if (job.library.stopAfterCurrent) return true
if (job.library.queueId && isShotQueueCancelled(job.library.queueId)) return true
const queue = job.library.queueId
? getShotQueue(job.library.ownerKey, job.library.queueId)
: null
if (job.library.queueId && !queue) return true
if (queue?.stopAfterCurrent || queue?.status === 'paused') return true
return false
}
@@ -371,6 +374,11 @@ export async function continueQueuedExtensions(
? detail
: `Could not extract the last frame for the next extension: ${detail}`)
}
assertJobActive(job)
if (chainShouldHold(job)) {
job.library.stopAfterCurrent = true
break
}
const frame = readFileSync(framePath)
if (!frame.length || frame.length < 64) {
throw new Error('Could not extract the last frame for the next extension: the frame file was empty')
@@ -391,7 +399,17 @@ export async function continueQueuedExtensions(
job.library.shotPermanenceRefs || params.shotPermanenceRefs
)
assertJobActive(job)
if (chainShouldHold(job)) {
job.library.stopAfterCurrent = true
break
}
await ensureComfyReady(ready)
assertJobActive(job)
if (chainShouldHold(job)) {
job.library.stopAfterCurrent = true
break
}
await queueMiniMax(job, {
prompt: ext.prompt,
image: { filename: 'last_frame.png', data: frame, type: 'image/png' },