Skip to content

Commit 29f1bcc

Browse files
authored
[autorevert] fix pending job check (#6982)
Pending job detection was incorrect. - Before: `has_pending_jobs` checked `status == "pending"`, which GitHub Actio ns does not emit; statuses are typically `queued`, `in_progress`, `completed`. - Now: Treat any job with `status != "completed"` as pending.
1 parent 05625d3 commit 29f1bcc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

aws/lambda/pytorch-auto-revert/pytorch_auto_revert/autorevert_checker.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def failed_jobs(self) -> List[JobResult]:
4141

4242
@property
4343
def has_pending_jobs(self) -> bool:
44-
"""Check if any jobs are still pending."""
45-
return any(j.status == "pending" for j in self.jobs)
44+
"""Check if any jobs are not yet completed (queued/in_progress)."""
45+
return any(j.status != "completed" for j in self.jobs)
4646

4747
@property
4848
def job_base_names(self) -> Set[str]:
@@ -314,6 +314,10 @@ def detect_autorevert_pattern_workflow(self, workflow_name: str) -> List[Dict]:
314314
# No older commit with the same job found
315315
continue
316316

317+
# Ensure the oldest commit has stable signal (no running jobs)
318+
if last_commit_with_same_job.has_pending_jobs:
319+
continue
320+
317321
if any(j.classification_rule == failure_rule for j in last_same_jobs):
318322
# The older commit has the same job failing with same rule
319323
continue

0 commit comments

Comments
 (0)