Fix workflow consumer greylist removal to prevent workflows stuck in "Pending" status #1382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The workflow consumer was not properly removing workflows from the greylist when they couldn't be processed, causing workflows to get permanently stuck in "Pending" status. The issue occurred when workflows were queued by the RunnablePoller but had their status changed to non-Runnable before the consumer processed them.
Root Cause
In
WorkflowConsumer.ProcessItem(), the greylist removal was only executed whenworkflow.Status == WorkflowStatus.Runnable:This created a scenario where:
Solution
Moved greylist removal to always execute regardless of workflow status:
Additional Improvements
This fix ensures workflows are never permanently stuck in the greylist while maintaining all existing functionality for runnable workflows.
Fixes #1381.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.