Skip to content

Commit 0460f9d

Browse files
authored
[autorevert] Filter out disabled workflows in workflow resolver (#7617)
Autorevert had trouble dispatching `inductor` workflow. Turns out, we have an old deleted workflow with the same name: https://github.com/pytorch/pytorch/actions/workflows/inductor-cu126.yml The short term fix (this PR) is to filter out disabled workflows from the cache, and warn about naming conflicts. ### Testing ``` python -m pytorch_auto_revert autorevert-checker inductor --hours 18 --hud-html --as-of "2025-12-22 23:25:05" ``` Successfully dispatched workflow inductor for commit 270863426366da61609430dffb479a452311d02b (run: https://github.com/pytorch/pytorch/actions/workflows/inductor.yml?query=branch%3Atrunk%2F270863426366da61609430dffb479a452311d02b Successfully dispatched workflow inductor for commit 9be4f54558636a68d068b40d424c1bf129f17f59 (run: https://github.com/pytorch/pytorch/actions/workflows/inductor.yml?query=branch%3Atrunk%2F9be4f54558636a68d068b40d424c1bf129f17f59)
1 parent 960d462 commit 0460f9d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,26 @@ def _build_indices(self) -> None:
110110
for attempt in RetryWithBackoff():
111111
with attempt:
112112
for w in self._repository.get_workflows():
113+
# Skip disabled workflows (deleted files may leave stale entries)
114+
state = getattr(w, "state", "") or ""
115+
if state != "active":
116+
continue
113117
name = getattr(w, "name", "") or ""
114118
path = getattr(w, "path", "") or ""
115119
base = os.path.basename(path) if path else ""
116120
if not (name and base):
117121
continue
118122
ref = WorkflowRef(display_name=name, file_name=base)
123+
if name in self._by_display:
124+
existing = self._by_display[name]
125+
logging.warning(
126+
"Duplicate workflow display name '%s': %s vs %s, keeping %s",
127+
name,
128+
existing.file_name,
129+
base,
130+
existing.file_name,
131+
)
132+
continue
119133
self._by_display[name] = ref
120134
self._by_file[base] = ref
121135

0 commit comments

Comments
 (0)