AAP-91782: Make workflow_node_wait wait until approval nodes leave pending - #16642
nikhjain14 wants to merge 1 commit into
Conversation
Approval jobs set event_processing_finished immediately, so wait_on_url returned before a human approved or denied. Also wait while status is new/pending/waiting/running (Fixes ansible#15503). Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change updates ChangesWorkflow node polling
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to Workflow approval waits now continue until the approval reaches a terminal outcome rather than returning while pending. No merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
| if wait_on_field not in result['json']: | ||
| wait_on_field = 'finished' | ||
| while not result['json'][wait_on_field]: | ||
| while (not result['json'][wait_on_field]) or (not self.is_job_done(result['json'].get('status'))): |
There was a problem hiding this comment.
This is kind of a coding nit, formally this is De Morgan’s law
But not (this and that) really is a lot easier to read. I look at this, and I don't know what it's saying.
We require both conditions before we are done with this "wait" method.




Summary
workflow_node_waitlooks only atevent_processing_finished. After a successful launch of an approval node, that field is already true whilestatusis stillpending. A wait task then returnsokimmediately instead of waiting for approve, deny, or timeout. This change also waits while the job is stillnew,pending,waiting, orrunning.ISSUE TYPE
COMPONENT NAME
Problem
When
awx.awx.workflow_node_waitis used on an approval node (collection 24.3.1+), the first poll seesevent_processing_finished: true. The wait loop never runs. The playbook continues while the workflow is still waiting for a human.Expected behavior
The wait task should stay running until the approval node is approved, denied, or the timeout is reached.
Actual behavior
The wait task returns
okin about 2 seconds withstatus: pending. Nobody has approved yet.Solution
In
wait_on_url, keep looping whileevent_processing_finishedis false oris_job_done(status)is false. Approve then returnsok. Deny fails the wait. No action hits the timeout. Other job waits are unchanged.Changes made
awx_collection/plugins/module_utils/controller_api.py: wait while the job status is still in progressTesting Results
okin ~2s,status=pending(workflow job 145)successful; Deny while waiting → wait failedRelated Issue
Fixes #15503
Summary by CodeRabbit