Skip to content

fix(webui): keep Generate Video usable when the task record is stale - #1824

Open
venkatsammm wants to merge 2 commits into
harry0703:mainfrom
venkatsammm:fix/issue-1812-stale-generation-task
Open

venkatsammm wants to merge 2 commits into
harry0703:mainfrom
venkatsammm:fix/issue-1812-stale-generation-task

Conversation

@venkatsammm

Copy link
Copy Markdown
Contributor

Summary

  • The WebUI now treats a task as busy only while this process still holds the submission reservation. A persisted PROCESSING record left by a restarted or crashed worker no longer disables Generate Video.
  • Reproduced [Bug]: #1812 with a Redis-backed state=4 record 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.
  • Updated the restart test to expect an enabled button plus the "no active execution record" hint for orphaned jobs.

Testing

  • pytest test/services/test_generation_progress.py -q — 31 passed
  • 63 WebUI provider tests (jalapeno, loomloom, metaso, muapi, ofox, seedance, useapi) passed
  • Live Docker check: seeded a stale PROCESSING task 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 untouched

Fixes #1812

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.
@harry0703

Copy link
Copy Markdown
Owner

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.
@venkatsammm

Copy link
Copy Markdown
Contributor Author

Done

@harry0703

Copy link
Copy Markdown
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:

2 participants