Skip to content

[PROD HOTFIX] Allow cancelled events to be persisted to db even for dump workflow step#282

Merged
kkartunov merged 1 commit into
masterfrom
hotfix_return-run-details
Jun 12, 2026
Merged

[PROD HOTFIX] Allow cancelled events to be persisted to db even for dump workflow step#282
kkartunov merged 1 commit into
masterfrom
hotfix_return-run-details

Conversation

@vas3a

@vas3a vas3a commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Expanded the list of valid statuses for aiWorkflowRun to include 'INIT' in addition to 'DISPATCHED' and 'IN_PROGRESS', preventing errors for runs in the initial state.
  • Adjusted the query for aiWorkflowRun to no longer filter by status, ensuring all runs for a given gitRunId are considered.

Error handling and logging enhancements:

  • Improved the error message when multiple workflow runs are found, now including both the workflow name and run_id for better traceability.

Conditional workflow job event handling:

  • Updated logic to ignore dump-workflow-context workflow job events only if their terminal status is not 'CANCELLED', preventing unnecessary log entries for cancelled jobs.

Code cleanup:

  • Moved the definition of conclusion and terminalStatus to ensure they are available before use and removed redundant code. [1] [2]

@vas3a vas3a requested a review from Copilot June 12, 2026 10:16
@vas3a vas3a changed the title Allow cancelled events to be persisted to db even for dump workflow step [PROD HOTFIX] Allow cancelled events to be persisted to db even for dump workflow step Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 aiWorkflowRun lookups by status so all runs for a given gitRunId are considered.
  • Expands accepted aiWorkflowRun.status values to include INIT for workflow job event handling.
  • Adjusts dump-workflow-context ignore 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'
) {
@kkartunov kkartunov merged commit 9c3b1ed into master Jun 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants