[PROD HOTFIX] Allow cancelled events to be persisted to db even for dump workflow step#282
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refines WorkflowQueueHandler.handleWorkflowRunEvents to better handle workflow job events, especially around initial/terminal states and the special dump-workflow-context job, so cancelled outcomes can still be persisted.
Changes:
- Stops filtering
aiWorkflowRunlookups by status so all runs for a givengitRunIdare considered. - Expands accepted
aiWorkflowRun.statusvalues to includeINITfor workflow job event handling. - Adjusts
dump-workflow-contextignore logic so only non-cancelled terminal outcomes are ignored, and improves an error log message for multiple matches.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
521
to
523
| this.logger.error( | ||
| `ERROR! There are more than 1 workflow runs in DISPATCHED status and workflow.gitWorkflowId=${event.workflow_job.name}!`, | ||
| `ERROR! There are more than 1 workflow runs for workflow=${event.workflow_job.name} and gitWorkflowId=${event.workflow_job.run_id}!`, | ||
| ); |
Comment on lines
+539
to
+544
| const conclusion = event.workflow_job.conclusion?.toUpperCase(); | ||
| const terminalStatus = this.normalizeWorkflowConclusion(conclusion); | ||
| if ( | ||
| event.workflow_job.name === 'dump-workflow-context' && | ||
| terminalStatus !== 'CANCELLED' | ||
| ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request refines the workflow job event handling logic in
workflow-queue.handler.ts. The most significant updates include expanding the set of valid workflow run statuses, improving error messages, and ensuring that certain workflow jobs are ignored only under specific terminal conditions.Workflow status handling improvements:
aiWorkflowRunto include'INIT'in addition to'DISPATCHED'and'IN_PROGRESS', preventing errors for runs in the initial state.aiWorkflowRunto no longer filter by status, ensuring all runs for a givengitRunIdare considered.Error handling and logging enhancements:
run_idfor better traceability.Conditional workflow job event handling:
dump-workflow-contextworkflow job events only if their terminal status is not'CANCELLED', preventing unnecessary log entries for cancelled jobs.Code cleanup:
conclusionandterminalStatusto ensure they are available before use and removed redundant code. [1] [2]