Conversation
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.
Cause: runWorkerBatch always selects the earliest job with status "pending". generateReport() throws for jobs whose rows aren't an array (e.g. rows: null), but the catch block in runWorkerBatch only recorded job.lastError and pushed a "failed" attempt — it never changed job.status away from "pending". So a permanently invalid job (job-101 in the captured incident) was re-selected and re-failed on every subsequent step, consuming the whole bounded batch and starving healthy jobs behind it (job-102, job-103) which never got a chance to run, even though their rows were valid.
Fix: in the catch branch of runWorkerBatch (app/worker.mjs), set job.status = "failed" alongside recording job.lastError, so a job that failed generateReport is removed from the pending queue and the batch proceeds to the next pending job. Completed-job handling and CSV generation are unchanged.
Regression test: app/test/worker.regression.test.mjs derives a 3-job snapshot from the captured incident (job-101 with rows: null ahead of two healthy pending jobs). It asserts the batch attempts exactly one failed attempt for job-101 followed by completed attempts for job-102 and job-103, that job-101 ends in status "failed" with attempts: 1, and that job-102/job-103 produce their expected CSV outputs. This test fails on the original source (job-101 is retried on every step, healthy jobs never run) and passes after the fix.
Sentry incident: event. This is the deliberately faulty on-call example app.
Tested against commit
b664e075ca7c0173b06f344d47a8cbcfa6e426fa. The same regression command failed before the fix and passed afterward: