Repository: pytorch
Issue: lintrunner has stale errors 
Labels: module: lint,triaged,module: devx

### 🐛 Describe the bug

Sometimes lintrunner will have stale errors even though the errors no longer exist (eg. if you switch back to a clean main commit). Here's a small repro:

```
ghstack checkout https://github.com/pytorch/pytorch/pull/144263
lintrunner -a
git checkout --detach origin/main
lintrunner -a
```

Notice the errors are still there even though we are on a clean main

```
(/home/bobren/local/b/pytorch-env) [15:02] devgpu009:/home/bobren/local/b/pytorch lintrunner -a
Warning: Could not find a lintrunner config at: '.lintrunner.private.toml'. Continuing without using configuration file.
  FLAKE8 success!
  CLANGFORMAT success!
  MYPY failure
  MYPYSTRICT success!
  CLANGTIDY success!
  TYPEIGNORE success!
  NOQA success!
  TYPENOSKIP success!
  NATIVEFUNCTIONS success!
  GHA success!
  NEWLINE success!
  SPACES success!
  TABS success!
  C10_UNUSED success!
  INCLUDE success!
  C10_NODISCARD success!
  ERROR_PRONE_ISINSTANCE success!
  PYBIND11_INCLUDE success!
  PYBIND11_SPECIALIZATION success!
  EXEC success!
  PYPIDEP success!
  CUBINCLUDE success!
  ROOT_LOGGING success!
  RAWCUDA success!
  RAWCUDADEVICE success!
  DEPLOY_DETECTION success!
  CMAKE success!
  ACTIONLINT success!
  SHELLCHECK success!
  TESTOWNERS success!
  CALL_ONCE success!
  TEST_HAS_MAIN success!
  WORKFLOWSYNC success!
  ONCE_FLAG success!
  CONTEXT_DECORATOR success!
  NO_WORKFLOWS_ON_FORK success!
  PYFMT success!
  BAZEL_LINTER success!
  COPYRIGHT success!
  LINTRUNNER_VERSION success!
  RUFF success!
  MERGE_CONFLICTLESS_CSV success!
  META_NO_CREATE_UNBACKED success!
  ATEN_CPU_GPU_AGNOSTIC success!
  IMPORT_LINTER success!
  SET_LINTER success!
  DOCSTRING_LINTER success!


>>> Lint for torch/_functorch/_activation_checkpointing/graph_info_provider.py:

  Error (MYPY) [attr-defined]
    Module has no attribute "viridis"

        276  |            vmin=min(self.get_knapsack_memory_input()),
        277  |            vmax=max(self.get_knapsack_memory_input()),
        278  |        )
    >>> 279  |        cmap = cm.viridis
        280  |
        281  |        # Assign colors based on memory
        282  |        node_colors = [



>>> Lint for torch/fx/experimental/proxy_tensor.py:

  Error (MYPY) [attr-defined]
    "Thunk[Proxy]" has no attribute "proxy"

        1085  |
        1086  |    def unwrap_proxy(self, e: T) -> object:
        1087  |        if isinstance(e, Tensor):
    >>> 1088  |            return get_proxy_slot(e, self, e, lambda x: x.proxy)
        1089  |        elif isinstance(e, py_sym_types):
        1090  |            return get_proxy_slot(e, self, e, lambda e: e.force())
        1091  |        elif isinstance(e, _AnyScriptObject):



>>> Lint for torch/testing/_internal/common_utils.py:

  Error (MYPY) [import-not-found]
    Cannot find implementation or library stub for module named "pytest"

         101  |import torch.utils._pytree as pytree
         102  |from torch.utils import cpp_extension
         103  |try:
    >>>  104  |    import pytest
         105  |    has_pytest = True
         106  |except ImportError:
         107  |    has_pytest = False

Successfully applied all patches.
(/home/bobren/local/b/pytorch-env) [15:02] devgpu009:/home/bobren/local/b/pytorch git stash
Saved working directory and index state WIP on (no branch): 5c94ea34c52     Migrate from Tuple -> tuple in torch/_functorch
(/home/bobren/local/b/pytorch-env) [15:02] devgpu009:/home/bobren/local/b/pytorch git checkout --detach origin/main
Previous HEAD position was 5c94ea34c52     Migrate from Tuple -> tuple in torch/_functorch
HEAD is now at c7f12a4a7b8 [MPSInductor] Speedup maximum/minumum ops (#144581)
(/home/bobren/local/b/pytorch-env) [15:02] devgpu009:/home/bobren/local/b/pytorch lintrunner -a
Warning: Could not find a lintrunner config at: '.lintrunner.private.toml'. Continuing without using configuration file.
  FLAKE8 success!
  CLANGFORMAT success!
  MYPY failure
  MYPYSTRICT success!
  CLANGTIDY success!
  TYPENOSKIP success!
  TYPEIGNORE success!
  NOQA success!
  NATIVEFUNCTIONS success!
  NEWLINE success!
  GHA success!
  TABS success!
  SPACES success!
  C10_UNUSED success!
  C10_NODISCARD success!
  PYBIND11_INCLUDE success!
  INCLUDE success!
  PYBIND11_SPECIALIZATION success!
  ERROR_PRONE_ISINSTANCE success!
  EXEC success!
  RAWCUDA success!
  DEPLOY_DETECTION success!
  RAWCUDADEVICE success!
  CUBINCLUDE success!
  PYPIDEP success!
  ROOT_LOGGING success!
  CMAKE success!
  SHELLCHECK success!
  ACTIONLINT success!
  TESTOWNERS success!
  CONTEXT_DECORATOR success!
  TEST_HAS_MAIN success!
  CALL_ONCE success!
  ONCE_FLAG success!
  WORKFLOWSYNC success!
  NO_WORKFLOWS_ON_FORK success!
  PYFMT success!
  COPYRIGHT success!
  BAZEL_LINTER success!
  RUFF success!
  LINTRUNNER_VERSION success!
  MERGE_CONFLICTLESS_CSV success!
  META_NO_CREATE_UNBACKED success!
  ATEN_CPU_GPU_AGNOSTIC success!
  DOCSTRING_LINTER success!
  IMPORT_LINTER success!
  SET_LINTER success!


>>> Lint for torch/_functorch/_activation_checkpointing/graph_info_provider.py:

  Error (MYPY) [attr-defined]
    Module has no attribute "viridis"

        276  |            vmin=min(self.get_knapsack_memory_input()),
        277  |            vmax=max(self.get_knapsack_memory_input()),
        278  |        )
    >>> 279  |        cmap = cm.viridis
        280  |
        281  |        # Assign colors based on memory
        282  |        node_colors = [



>>> Lint for torch/fx/experimental/proxy_tensor.py:

  Error (MYPY) [attr-defined]
    "Thunk[Proxy]" has no attribute "proxy"

        1085  |
        1086  |    def unwrap_proxy(self, e: T) -> object:
        1087  |        if isinstance(e, Tensor):
    >>> 1088  |            return get_proxy_slot(e, self, e, lambda x: x.proxy)
        1089  |        elif isinstance(e, py_sym_types):
        1090  |            return get_proxy_slot(e, self, e, lambda e: e.force())
        1091  |        elif isinstance(e, _AnyScriptObject):



>>> Lint for torch/testing/_internal/common_utils.py:

  Error (MYPY) [import-not-found]
    Cannot find implementation or library stub for module named "pytest"

         100  |import torch.utils._pytree as pytree
         101  |from torch.utils import cpp_extension
         102  |try:
    >>>  103  |    import pytest
         104  |    has_pytest = True
         105  |except ImportError:
         106  |    has_pytest = False

Successfully applied all patches.
```

### Versions

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: CentOS Stream 9 (x86_64)
GCC version: (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2)
Clang version: Could not collect
CMake version: version 3.31.1
Libc version: glibc-2.34

Python version: 3.10.15 (main, Oct  3 2024, 07:27:34) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.4.3-0_fbk15_zion_2630_gf27365f948db-x86_64-with-glibc2.34
Is CUDA available: N/A
CUDA runtime version: 12.2.140
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration:
GPU 0: NVIDIA H100
GPU 1: NVIDIA H100
GPU 2: NVIDIA H100
GPU 3: NVIDIA H100
GPU 4: NVIDIA H100
GPU 5: NVIDIA H100
GPU 6: NVIDIA H100
GPU 7: NVIDIA H100

Nvidia driver version: 535.154.05
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      52 bits physical, 57 bits virtual
Byte Order:                         Little Endian
CPU(s):                             384
On-line CPU(s) list:                0-383
Vendor ID:                          AuthenticAMD
Model name:                         AMD EPYC 9654 96-Core Processor
CPU family:                         25
Model:                              17
Thread(s) per core:                 2
Core(s) per socket:                 96
Socket(s):                          2
Stepping:                           1
Frequency boost:                    enabled
CPU(s) scaling MHz:                 76%
CPU max MHz:                        3707.8120
CPU min MHz:                        1500.0000
BogoMIPS:                           4792.43
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor smca fsrm flush_l1d
Virtualization:                     AMD-V
L1d cache:                          6 MiB (192 instances)
L1i cache:                          6 MiB (192 instances)
L2 cache:                           192 MiB (192 instances)
L3 cache:                           768 MiB (24 instances)
NUMA node(s):                       2
NUMA node0 CPU(s):                  0-95,192-287
NUMA node1 CPU(s):                  96-191,288-383
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Vulnerable: eIBRS with unprivileged eBPF
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] flake8==6.1.0
[pip3] flake8-bugbear==23.3.23
[pip3] flake8-comprehensions==3.15.0
[pip3] flake8-executable==2.1.3
[pip3] flake8-logging-format==0.9.0
[pip3] flake8-pyi==23.3.1
[pip3] flake8-simplify==0.19.3
[pip3] mypy==1.13.0
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] onnx==1.17.0
[pip3] optree==0.13.0
[pip3] pytorch-triton==3.2.0+git35c6c7c6
[pip3] torch==2.6.0a0+git2966fb3
[pip3] torchaudio==2.5.0a0+332760d
[pip3] torchdata==0.10.0a0+77bf3d1
[pip3] torchtext==0.17.0a0+1d4ce73
[pip3] torchvision==0.20.0a0+b33aef4
[conda] blas                      1.0                         mkl
[conda] magma-cuda116             2.6.1                         1    pytorch
[conda] mkl                       2023.1.0         h213fc3f_46344
[conda] mkl-include               2023.1.0         h06a4308_46344
[conda] mkl-service               2.4.0           py310h5eee18b_1
[conda] mkl_fft                   1.3.11          py310h5eee18b_0
[conda] mkl_random                1.2.8           py310h1128e8f_0
[conda] numpy                     1.26.4          py310h5f9d8c6_0
[conda] numpy-base                1.26.4          py310hb5e798b_0
[conda] optree                    0.13.0                   pypi_0    pypi
[conda] pytorch-triton            3.2.0+git35c6c7c6          pypi_0    pypi
[conda] torch                     2.6.0a0+git2966fb3           dev_0    <develop>
[conda] torchaudio                2.5.0a0+332760d           dev_0    <develop>
[conda] torchdata                 0.10.0a0+77bf3d1          pypi_0    pypi
[conda] torchfix                  0.4.0                    pypi_0    pypi
[conda] torchtext                 0.17.0a0+1d4ce73           dev_0    <develop>
[conda] torchvision               0.20.0a0+b33aef4           dev_0    <develop>

cc @ZainRizvi @kit1980 @huydhn @clee2000