Async workflow trigger log stuck in PENDING when Celery dispatch fails

Open Beginner friendly
#42,148 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start at AsyncWorkflowService.trigger_workflow_async and compare its dispatch-failure path with the quota-exceeded path, which already updates the trigger log before re-raising. Review get_failed_logs_for_retry and reinvoke_trigger to understand the retry states. Done means a Celery enqueue failure leaves the log as FAILED with the dispatch error and does not remain invisibly PENDING.

Written by the indexing model from the issue text.

Description

When AsyncWorkflowService.trigger_workflow_async fails to enqueue the Celery task (e.g. broker down, execute_workflow_*_team.delay() raises), the trigger log row created just before stays in PENDING forever.

No worker will ever pick it up since the task was never queued, the quota reservation is refunded, and get_failed_logs_for_retry only surfaces FAILED/RATE_LIMITED logs — so the stuck PENDING log is invisible to the retry flow (reinvoke_trigger).

The quota-exceeded path in the same method already handles its failure correctly (marks the log RATE_LIMITED with the error and commits before re-raising). The dispatch-failure path should do the same: mark the log FAILED with the dispatch error before re-raising.

Dominant language
TypeScript
Stars
157k
Forks
24.7k
Avg merge
22h 32m
Merged PRs (30d)
611

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from langgenius/dify

All issues in langgenius/dify

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.