Async workflow trigger log stuck in PENDING when Celery dispatch fails
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
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.
Contributor guide
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.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100