Commit 33f82bb
authored
[autorevert] dispatch untargeted signals without tests-to-include filter (#8037)
## Summary
Two related fixes to the autorevert lambda's `tests-to-include` dispatch
path. Both surface the same anti-pattern: a signal that *cannot* be
narrowed to a `run_test.py`-recognized module should be dispatched as a
"re-run the whole job(s)" restart, not as a TEST-narrow restart.
## Bug 1 — empty-`file` rows in `tests.all_test_runs` produce bogus
`tests-to-include` entries
`TestRow.test_id` (`signal_extraction_types.py:138-141`) builds the test
key as `f"{file}::{name}" if file else name`. When the CH row has empty
`file`, the test key falls back to just the bare `name` (no `::`).
`signal_extraction.py` then derived `test_module` from the key:
```python
test_module = test_id.split("::")[0].replace(".py", "")
```
With no `::`, `test_module` becomes the bare method name (e.g.
`test_partial_eval_graph_conv`). The lambda forwards that into
`workflow_dispatch.tests-to-include`, and
`pytorch/pytorch:test/run_test.py:144` `TestChoices.__contains__`
rejects it with:
```
argument -i/--include: invalid choice: 'test_partial_eval_graph_conv'
```
The dispatched shard fails before running any tests, surfacing as 15-25
spurious `test-osdc` failures per affected commit on HUD trunk.
Tracking: pytorch/pytorch-gha-infra#1137.
Verified primary-source: `tests.all_test_runs` for
`name='test_partial_eval_graph_conv'` over the last 2 days returns three
distinct `file` values: `'test_jit.py'`, `'test_jit_legacy.py'`, `''`.
Concrete instance — pytorch/pytorch run
[25294380825](https://github.com/pytorch/pytorch/actions/runs/25294380825)
(workflow_dispatch by `pytorch-auto-revert[bot]`, 2026-05-03 23:51 UTC):
```
jobs-to-include: linux-jammy-py3.10-clang18
tests-to-include: test_jit test_freeze_module_detach_gradient test_partial_eval_graph_conv test_freeze_interface_swapping_two_methods test_partial_eval_stitching test_returning_input_symbolic_shapes
```
`test_jit` is the actual file name; the other five are method names that
leaked through the empty-`file` fallback. The `default` / `crossref` /
`dynamo_wrapped` shards on this run failed at argparse; the `openreg` /
`einops` shards were green only because their `test.sh` paths bypass
`$INCLUDE_CLAUSE` entirely.
## Bug 2 — JOB+TEST signals on the same (workflow, commit) silently lose
JOB intent
`signal_actions.py::group_actions` keys the restart map on
`(workflow_name, commit_sha)`. ALL contributing signals — JOB-track and
TEST-track — are merged into a single `ActionGroup` with the union of
`jobs_to_include` and `tests_to_include`. A JOB-track signal
(`test_module=None`, intent = "re-run the whole job") coexisting with a
TEST-track signal in the same group becomes a TEST-narrow restart: only
the test modules contributed by the TEST signals run, and the JOB
signal's full-job-restart intent is silently thrown away.
This was a latent bug independent of Bug 1 — surfaced while auditing the
`tests-to-include` path.
## Fix
1. `signal_extraction.py`: when `test_id` lacks `::`, set
`test_module=None`. The signal stays alive but is marked untargeted.
2. `signal_actions.py::group_actions`: if any source in the group has
`test_module is None`, dispatch with `tests_to_include=frozenset()` for
the whole group.
JOB-track signals (always `test_module=None`) and TEST-track signals
with no extractable module both reach the new branch, so they get
identical "re-run the whole job(s)" treatment instead of being narrowed
by sibling targetable TEST signals. `workflow_checker.py:165` already
drops the `tests-to-include` input when the frozenset is empty — no
change needed there.
## Test plan
- [x] `tests/test_signal_extraction.py` (2 new): empty `file` → Signal
with `test_module=None`; populated `file` → existing module path.
- [x] `tests/test_signal_actions.py` (4 new in
`TestGroupActionsTestsToInclude`): only-targeted-tests keeps filter;
TEST-with-no-module drops filter; mixed targeted+untargeted TEST drops
filter; JOB+TEST same-(wf,sha) drops filter.
- [x] `make test` — all 146 tests pass (1 skipped due to no
`GITHUB_TOKEN`).
- [x] `ruff format --check` + `ruff check` clean.
## Audit follow-up (not in this PR)
Worth checking which test uploader writes empty-`file` rows to
`tests.all_test_runs` — likely a partial-export issue from a specific
reporter — to fix the data leak at source. Open question carried in
`iz2-memory:core/knowledge/autorevert-bot-retry.md`.1 parent 74ac2cd commit 33f82bb
4 files changed
Lines changed: 256 additions & 6 deletions
File tree
- aws/lambda/pytorch-auto-revert/pytorch_auto_revert
- tests
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
338 | 352 | | |
339 | 353 | | |
340 | 354 | | |
341 | 355 | | |
342 | 356 | | |
343 | 357 | | |
344 | 358 | | |
345 | | - | |
346 | | - | |
347 | | - | |
| 359 | + | |
348 | 360 | | |
349 | 361 | | |
350 | 362 | | |
| |||
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
484 | 493 | | |
485 | 494 | | |
486 | 495 | | |
| |||
Lines changed: 164 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1271 | 1271 | | |
1272 | 1272 | | |
1273 | 1273 | | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1274 | 1438 | | |
1275 | 1439 | | |
Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1094 | 1094 | | |
1095 | 1095 | | |
1096 | 1096 | | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
1097 | 1162 | | |
1098 | 1163 | | |
1099 | 1164 | | |
0 commit comments