Let clips move between folders, save busy jobs, and fail dropped Comfy runs.

Held jobs restore the form after a 3-minute wait, hidden stills stay blurred in the picker, and reloading Comfy no longer leaves xaigen spinning.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-25 21:46:24 -05:00
co-authored by Cursor
parent ba7a483aac
commit a7a810a7b3
22 changed files with 775 additions and 97 deletions
+17 -10
View File
@@ -69,8 +69,9 @@ export function watchComfyJob(job: Job): Promise<void> {
turbo: job.library.turbo,
seed: job.library.seed,
hideThumbnail: job.library.hideThumbnail,
hideInput: job.library.hideInput,
video: buffer,
thumb: job.library.hideThumbnail ? null : job.library.thumb,
thumb: job.library.thumb,
comfyFilename: video.filename
})
job.clipId = clip.id
@@ -79,6 +80,7 @@ export function watchComfyJob(job: Job): Promise<void> {
await purgeComfyArtifacts({
video,
imageName: job.library.imageName,
imageSubfolder: job.library.imageSubfolder,
promptId: job.promptId
})
}
@@ -105,6 +107,8 @@ export function watchComfyJob(job: Job): Promise<void> {
return true
}
let dropMisses = 0
const pollHistory = async () => {
if (settled || !job.promptId) return
try {
@@ -115,6 +119,15 @@ export function watchComfyJob(job: Job): Promise<void> {
}
if (inspected.video) {
await succeed()
return
}
if (await isComfyPromptDropped(job.promptId)) {
dropMisses += 1
if (dropMisses >= 3) {
await fail('ComfyUI dropped this job. Reloading the Comfy interface clears the queue. Generate again.')
}
} else {
dropMisses = 0
}
} catch {
// Transient ComfyUI history misses are expected while the graph is still running.
@@ -134,15 +147,9 @@ export function watchComfyJob(job: Job): Promise<void> {
emitJob(job, { type: 'status', message: 'Connected to ComfyUI', progress: Math.max(job.progress, 4) })
})
ws.addEventListener('error', () => {
if (settled) return
emitJob(job, {
type: 'status',
message: job.promptId
? 'Live socket unavailable, polling ComfyUI history...'
: 'Waiting for ComfyUI socket...',
progress: Math.max(job.progress, 4)
})
ws.addEventListener('close', () => {
if (settled || !job.promptId) return
void pollHistory()
})
ws.addEventListener('message', async (event) => {