pytorch - ✅(Solved) Fix [CI] Target determination on PRs is erroring out [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#184441Fetched 2026-05-20 03:38:38
View on GitHub
Comments
1
Participants
2
Timeline
48
Reactions
0
Assignees
Timeline (top)
subscribed ×36labeled ×4mentioned ×3added_to_project_v2 ×1

Error Message

Error in EditedByPR: unsupported operand type(s) for |: 'type' and 'NoneType' Error in HistoricalClassFailurCorrelation: unsupported operand type(s) for |: 'type' and 'NoneType' Error in CorrelatedWithHistoricalFailures: unsupported operand type(s) for |: 'type' and 'NoneType' Error in HistorialEditedFiles: unsupported operand type(s) for |: 'type' and 'NoneType' Error in Profiling: unsupported operand type(s) for |: 'type' and 'NoneType' Error in Filepath: unsupported operand type(s) for |: 'type' and 'NoneType' Error in PublicBindings: unsupported operand type(s) for |: 'type' and 'NoneType'

Fix Action

Fixed

PR fix notes

PR #184442: Fix TD failure under Python 3.9 from runtime PEP 604 union

Description (problem / solution / changelog)

Summary

Fixes #184441.

The target-determination workflow has no actions/setup-python step before the "Do TD" step, so on the self-hosted linux.2xlarge runner python3 resolves to the system Python 3.9 (the boto3 install log in the failing job confirms this: Requirement already satisfied: jmespath ... in /usr/lib/python3.9/site-packages).

tools/testing/target_determination/heuristics/utils.py has from __future__ import annotations, which defers evaluation of annotations — but cast() is a regular function call, so its first argument is evaluated at runtime. PEP 604 union on type objects only works on Python 3.10+; on 3.9 cast(str | None, ...) raises TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'. That exception escapes _get_pr_merge_base and is caught by each heuristic's outer try/except, producing the observed cascade:

Error in EditedByPR: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in HistoricalClassFailurCorrelation: ...
Error in CorrelatedWithHistoricalFailures: ...
Error in HistorialEditedFiles: ...
Error in Profiling: ...
Error in Filepath: ...
Error in PublicBindings: ...

The two offending runtime expressions landed in #182957 (2026-05-08), which is also when TD failures started becoming user-visible (lookup errors are no longer silently turned into empty heuristic results).

Quote the cast targets so the type expression is never evaluated. typing.cast ignores its first argument at runtime, so a forward-reference string works on every Python version.

Test plan

  • CI target-determination job runs without the unsupported operand type(s) for | errors.

Authored by Claude.

Changed files

  • tools/testing/target_determination/heuristics/utils.py (modified, +2/-2)

Code Example

Error in EditedByPR: unsupported operand type(s) for |: 'type' and 'NoneType'
Can't get commit info due to unsupported operand type(s) for |: 'type' and 'NoneType'
Results from MentionedInPR

Error in HistoricalClassFailurCorrelation: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in CorrelatedWithHistoricalFailures: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in HistorialEditedFiles: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in Profiling: unsupported operand type(s) for |: 'type' and 'NoneType'
could not find path /home/ec2-user/actions-runner/_work/pytorch/pytorch/.additional_ci_files/llm_results/mappings/indexer-files-gitdiff-output.json
Results from LLM

Error in Filepath: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in PublicBindings: unsupported operand type(s) for |: 'type' and 'NoneType'
RAW_BUFFERClick to expand / collapse

We are seeing multiple instances of target determination failing on PRs to generate a proper list of tests based on heuristics: 1, 2, 3, 4, 5

The errors appear in the before-test / target-determination step in the workflow run:

Error in EditedByPR: unsupported operand type(s) for |: 'type' and 'NoneType'
Can't get commit info due to unsupported operand type(s) for |: 'type' and 'NoneType'
Results from MentionedInPR

Error in HistoricalClassFailurCorrelation: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in CorrelatedWithHistoricalFailures: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in HistorialEditedFiles: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in Profiling: unsupported operand type(s) for |: 'type' and 'NoneType'
could not find path /home/ec2-user/actions-runner/_work/pytorch/pytorch/.additional_ci_files/llm_results/mappings/indexer-files-gitdiff-output.json
Results from LLM

Error in Filepath: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in PublicBindings: unsupported operand type(s) for |: 'type' and 'NoneType'

This issue wasn't seen in a run from 3 weeks ago, so this must have started recently.

cc @malfet @pytorch/pytorch-dev-infra

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

pytorch - ✅(Solved) Fix [CI] Target determination on PRs is erroring out [1 pull requests, 1 comments, 2 participants]