Fix ghost Queued workflow runs from early workflow_job events#30
Merged
Fix ghost Queued workflow runs from early workflow_job events#30
Conversation
… show '#-' when run number missing
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
- Add DELETE /api/workflow-runs/:id endpoint - Add Delete button (red) next to Sync in WorkflowHistory - Confirm dialog before deletion - Real-time updates via workflowDeleted socket event - Allows cleaning up ghost Queued records that are stuck in DB
homeles
approved these changes
Mar 4, 2026
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.
Summary
Fixes ghost "Queued" rows appearing in the Workflow History table with missing run number, branch, and event data.
Root Cause
When GitHub sends webhook events,
workflow_jobevents (withstatus: queued) can arrive before the correspondingworkflow_runevent. Theworkflow_jobpayload lacks run-level fields likehead_branch,event, and sometimesrun_number.Previously,
processWorkflowJobEventwould create a fullWorkflowRundocument from this incomplete data via upsert, resulting in a record with:#)-)-)0sQueuedAdditionally, when the
workflow_runevent arrived later and updated viaprocessWorkflowRun, it would wipe out the existing jobs array sinceworkflow_runpayloads don't include job data.Fixes
Backend (
server/src/services/workflowService.js)processWorkflowJobEvent— new run creation: Use$setOnInsertinstead of plain upsert when creating a new run from a job event. This ensures that if aworkflow_runevent arrives and updates the record between the find and update, we don't overwrite it with incomplete data.processWorkflowRun— preserve existing jobs: When aworkflow_runevent updates an existing record (possibly created by an earlier job event), preserve the existingjobsarray instead of wiping it.Explicit null fields: Set
event: nullandhead_branchfrom job payload (when available) to make it clear the data is incomplete rather than silently empty.Frontend (
client/src/features/workflows/WorkflowHistory.jsx)#-instead of#undefinedor#whenrun.numberis missing.Testing
To reproduce:
Fixes the ghost Queued run bug reported via screen recording.