Fix stuck pending runs on unhandled errors#4814
Open
DanielRyanSmith wants to merge 3 commits intomainfrom
Open
Fix stuck pending runs on unhandled errors#4814DanielRyanSmith wants to merge 3 commits intomainfrom
DanielRyanSmith wants to merge 3 commits intomainfrom
Conversation
DanielRyanSmith
commented
Mar 20, 2026
Comment on lines
+57
to
+67
| // Only show runs updated within the last 14 days to avoid stuck runs | ||
| // that have been dropped from the task queue. | ||
| if filter == "pending" { | ||
| cutoff := time.Now().Add(-14 * 24 * time.Hour) | ||
| filteredRuns := make([]shared.PendingTestRun, 0) | ||
| for _, run := range runs { | ||
| if run.Updated.After(cutoff) { | ||
| filteredRuns = append(filteredRuns, run) | ||
| } | ||
| } | ||
| runs = filteredRuns |
Contributor
Author
There was a problem hiding this comment.
I didn't know if this was the best path forward, but the other option is to create a script or something that manually changes the pending status of the existing runs.
- Fix E302, E305 (blank lines) and W293 (blank line whitespace) in cleanup_stuck_runs.py. - Fix E501 (line too long) in cleanup_stuck_runs.py, processor.py, and processor_test.py. - Remove unused sys import (F401) in processor.py.
b992901 to
6c0a26e
Compare
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 PR addresses the issue where
PendingTestRunentities could become stuck in a pending state indefinitely if theresults-processorencountered an unhandled exception or reached its retry limit in Cloud Tasks.Changes:
try...exceptblock to catch unexpected exceptions and update the run status toINVALIDbefore re-raising for Cloud Tasks retries. This ensures that even if a task eventually fails permanently, the status is not left as 'processing'._log.exceptionand including the original error message in the log summary for easier diagnosis.INVALIDin Datastore.Fixes #4813