[autorevert] dispatch untargeted signals without tests-to-include filter#8037
Open
izaitsevfb wants to merge 1 commit into
Open
[autorevert] dispatch untargeted signals without tests-to-include filter#8037izaitsevfb wants to merge 1 commit into
izaitsevfb wants to merge 1 commit into
Conversation
When a TEST-track signal's CH row in `tests.all_test_runs` has empty `file`, `TestRow.test_id` falls back to the bare `name` (no `::`), and `signal_extraction.py` previously emitted that bare method name as `test_module`. The lambda then forwarded it through `tests-to-include` into `workflow_dispatch`, where `run_test.py`'s `--include` argparse choices rejected it with `argument -i/--include: invalid choice` and the dispatched shard failed before running anything (15-25 spurious test-osdc failures per affected commit). Coalescing in `group_actions` had a sibling problem: any group keyed by `(workflow_name, commit_sha)` merges JOB-track and TEST-track signals into a single restart with the union of `jobs_to_include` and `tests_to_include`. A JOB-track signal (test_module always None, intent = "re-run the whole job") coexisting with a TEST-track signal silently became a TEST-narrow restart — the JOB signal's intent was thrown away. Fix: 1. `signal_extraction.py`: when `test_id` lacks `::`, set `test_module=None` (signal stays alive but is untargeted). 2. `signal_actions.py::group_actions`: if any source in the group has `test_module=None`, dispatch with `tests_to_include=frozenset()` for the whole group. JOB-track signals AND TEST-track signals with no extractable module both reach this branch, so they get the same job-style "re-run the whole job(s)" treatment instead of being narrowed by sibling targetable TEST signals. Tests: - `test_signal_extraction`: empty `file` produces a Signal with `test_module=None`; populated `file` still produces the module path. - `test_signal_actions`: 4 cases covering only-targeted-tests, TEST-with-no-module-only, mixed targeted+untargeted TEST, and JOB+TEST same-(wf,sha). Concrete instance: pytorch/pytorch run 25294380825 (workflow_dispatch by pytorch-auto-revert[bot], 2026-05-03 23:51 UTC) dispatched with `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` was the file name, the other five were method names that leaked through the empty-`file` fallback. With this change, that group would have dispatched with `tests-to-include` omitted entirely. Tracking: pytorch/pytorch-gha-infra#1137.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
Summary
Two related fixes to the autorevert lambda's
tests-to-includedispatch path. Both surface the same anti-pattern: a signal that cannot be narrowed to arun_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-
filerows intests.all_test_runsproduce bogustests-to-includeentriesTestRow.test_id(signal_extraction_types.py:138-141) builds the test key asf"{file}::{name}" if file else name. When the CH row has emptyfile, the test key falls back to just the barename(no::).signal_extraction.pythen derivedtest_modulefrom the key:With no
::,test_modulebecomes the bare method name (e.g.test_partial_eval_graph_conv). The lambda forwards that intoworkflow_dispatch.tests-to-include, andpytorch/pytorch:test/run_test.py:144TestChoices.__contains__rejects it with:The dispatched shard fails before running any tests, surfacing as 15-25 spurious
test-osdcfailures per affected commit on HUD trunk. Tracking: pytorch/pytorch-gha-infra#1137.Verified primary-source:
tests.all_test_runsforname='test_partial_eval_graph_conv'over the last 2 days returns three distinctfilevalues:'test_jit.py','test_jit_legacy.py',''.Concrete instance — pytorch/pytorch run 25294380825 (workflow_dispatch by
pytorch-auto-revert[bot], 2026-05-03 23:51 UTC):test_jitis the actual file name; the other five are method names that leaked through the empty-filefallback. Thedefault/crossref/dynamo_wrappedshards on this run failed at argparse; theopenreg/einopsshards were green only because theirtest.shpaths bypass$INCLUDE_CLAUSEentirely.Bug 2 — JOB+TEST signals on the same (workflow, commit) silently lose JOB intent
signal_actions.py::group_actionskeys the restart map on(workflow_name, commit_sha). ALL contributing signals — JOB-track and TEST-track — are merged into a singleActionGroupwith the union ofjobs_to_includeandtests_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-includepath.Fix
signal_extraction.py: whentest_idlacks::, settest_module=None. The signal stays alive but is marked untargeted.signal_actions.py::group_actions: if any source in the group hastest_module is None, dispatch withtests_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:165already drops thetests-to-includeinput when the frozenset is empty — no change needed there.Test plan
tests/test_signal_extraction.py(2 new): emptyfile→ Signal withtest_module=None; populatedfile→ existing module path.tests/test_signal_actions.py(4 new inTestGroupActionsTestsToInclude): only-targeted-tests keeps filter; TEST-with-no-module drops filter; mixed targeted+untargeted TEST drops filter; JOB+TEST same-(wf,sha) drops filter.make test— all 146 tests pass (1 skipped due to noGITHUB_TOKEN).ruff format --check+ruff checkclean.Audit follow-up (not in this PR)
Worth checking which test uploader writes empty-
filerows totests.all_test_runs— likely a partial-export issue from a specific reporter — to fix the data leak at source. Open question carried iniz2-memory:core/knowledge/autorevert-bot-retry.md.