Repository navigation
fix(webui): keep Generate Video usable when the task record is stale - #1824
venkatsammm wants to merge 2 commits into
Conversation
Since 1.3.10 the WebUI disables "Generate Video" whenever the tracked task's persisted state is PROCESSING. That record can outlive the worker that wrote it (service restart, crashed thread, Redis persistence), so the button stays disabled forever and generation looks broken (harry0703#1812). Only the in-process submission reservation proves a task is still running. Keep duplicate-submit protection there and let the button stay usable for records no worker owns. The restart test now expects an enabled button plus the "no active execution record" hint for a persisted PROCESSING job.
|
Thanks for fixing the stuck Generate button. I reproduced the stale-task case locally and was able to start a new job and render an MP4 with your patch. I also tried two WebUI processes sharing Redis. When I reconnected to the second process while the first was still running the job, Generate became clickable. Clicking it started a second job with the same input. That could submit the same request twice to a paid provider. Could we keep the retry for orphaned records while still blocking a second submission when another worker is running the tracked task? |
Only trusting the in-process reservation let a second WebUI process that shares Redis start a duplicate paid request while the first process was still running the tracked task. Workers now refresh generation_heartbeat_at every 10 seconds from submission (including time in the queue) until the job ends, and the Generate button stays disabled while that heartbeat is fresh. Records without a heartbeat, or with one older than 60 seconds, are still treated as orphans so a restart or crash does not lock the button.
|
Done |
|
Thanks for adding the heartbeat. I retested with two WebUI processes sharing Redis, and reconnecting to the second process now keeps Generate disabled while the first one is still running the job. I found two cases that still need attention. When a heartbeat expires while the page is open, the warning updates but Generate stays disabled until a full page rerun. During a rolling upgrade, the new process also treats a job still running on an older process as orphaned because the old process has no heartbeat. I was able to start a duplicate job that way. Could we refresh the button when the heartbeat expires and keep the duplicate guard during a mixed-version rollout? |
Summary
PROCESSINGrecord left by a restarted or crashed worker no longer disables Generate Video.state=4record and no live worker: the button was permanently disabled before the change. After it, Generate submits a new task and re-enables when that task ends.Testing
pytest test/services/test_generation_progress.py -q— 31 passedPROCESSINGtask in Redis, clicked Generate, the new task ran and failed at the script stage (no LLM key), the button re-enabled, the stale record stayed untouchedFixes #1812