Skip to content

[lint] Degrade gracefully on shim-linter git timeouts instead of crashing - #189947

Closed
frgossen wants to merge 2 commits into
gh/frgossen/208/basefrom
gh/frgossen/208/head
Closed

frgossen wants to merge 2 commits into
gh/frgossen/208/basefrom
gh/frgossen/208/head

Conversation

@frgossen

@frgossen frgossen commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Follows the pattern from #189419: keep the short 5s timeout (plenty when git
objects are local) and, on subprocess.TimeoutExpired, take an explicit graceful
fallback rather than raising the ceiling. A timeout signals the objects are not
present in the partial clone, not that we should wait longer, and bumping the
default only blocks every cold call while hiding that condition.

The two blob-reading call sites are handled per their linter's semantics:

  • stable_shim_version_linter.get_added_lines (the two git diff calls): on
    timeout, fall back to an empty added-lines set. Enforcement then only applies
    to lines confirmed new; the AOTI shim's existing declarations are already
    exempt when not newly added, so this cannot false-positive.

  • generated_shims_version_linter (the git show base read): on timeout, skip the
    check (return no messages). Crucially this must NOT reuse the "file absent"
    path, which treats every current op as newly added: with the base empty, all
    already-versioned ops (currently 2.10-2.13 against a 2.14 tree) would be
    flagged wrong-version, turning a flaky infra timeout into ~24 false errors.

The git merge-base call is left at 5s untouched: it only walks the commit graph,
which a blobless partial clone has in full, so it never touches the network.

Test Plan: lintrunner on the three adapters passes (STABLE_SHIM_VERSION and
GENERATED_SHIMS_VERSION clean). The partial-clone network timeout is CI-only and
not deterministically reproducible locally.

Authored with Claude.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189947

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 0f70fd4 with merge base 521fb0f (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Jul 14, 2026
@frgossen

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "topic: not user facing"

[ghstack-poisoned]
frgossen added a commit that referenced this pull request Jul 14, 2026
…hing

Follows the pattern from #189419: keep the short 5s timeout (plenty when git
objects are local) and, on subprocess.TimeoutExpired, take an explicit graceful
fallback rather than raising the ceiling. A timeout signals the objects are not
present in the partial clone, not that we should wait longer, and bumping the
default only blocks every cold call while hiding that condition.

The two blob-reading call sites are handled per their linter's semantics:

- stable_shim_version_linter.get_added_lines (the two git diff calls): on
  timeout, fall back to an empty added-lines set. Enforcement then only applies
  to lines confirmed new; the AOTI shim's existing declarations are already
  exempt when not newly added, so this cannot false-positive.

- generated_shims_version_linter (the git show base read): on timeout, skip the
  check (return no messages). Crucially this must NOT reuse the "file absent"
  path, which treats every current op as newly added: with the base empty, all
  already-versioned ops (currently 2.10-2.13 against a 2.14 tree) would be
  flagged wrong-version, turning a flaky infra timeout into ~24 false errors.

The git merge-base call is left at 5s untouched: it only walks the commit graph,
which a blobless partial clone has in full, so it never touches the network.

Test Plan: lintrunner on the three adapters passes (STABLE_SHIM_VERSION and
GENERATED_SHIMS_VERSION clean). The partial-clone network timeout is CI-only and
not deterministically reproducible locally.

ghstack-source-id: edc3e6d
Pull-Request: #189947

Authored with Claude.
@frgossen frgossen changed the title [lint] Handle shim-linter blob-read timeouts via lazy-fetch retry, not a bigger timeout [lint] Degrade gracefully on shim-linter git timeouts instead of crashing Jul 14, 2026
frgossen added a commit that referenced this pull request Jul 14, 2026
…hing

Follows the pattern from #189419: keep the short 5s timeout (plenty when git
objects are local) and, on subprocess.TimeoutExpired, take an explicit graceful
fallback rather than raising the ceiling. A timeout signals the objects are not
present in the partial clone, not that we should wait longer, and bumping the
default only blocks every cold call while hiding that condition.

The two blob-reading call sites are handled per their linter's semantics:

- stable_shim_version_linter.get_added_lines (the two git diff calls): on
  timeout, fall back to an empty added-lines set. Enforcement then only applies
  to lines confirmed new; the AOTI shim's existing declarations are already
  exempt when not newly added, so this cannot false-positive.

- generated_shims_version_linter (the git show base read): on timeout, skip the
  check (return no messages). Crucially this must NOT reuse the "file absent"
  path, which treats every current op as newly added: with the base empty, all
  already-versioned ops (currently 2.10-2.13 against a 2.14 tree) would be
  flagged wrong-version, turning a flaky infra timeout into ~24 false errors.

The git merge-base call is left at 5s untouched: it only walks the commit graph,
which a blobless partial clone has in full, so it never touches the network.

Test Plan: lintrunner on the three adapters passes (STABLE_SHIM_VERSION and
GENERATED_SHIMS_VERSION clean). The partial-clone network timeout is CI-only and
not deterministically reproducible locally.

ghstack-source-id: edc3e6d
Pull-Request: #189947

Authored with Claude.
@frgossen
frgossen requested a review from janeyx99 July 14, 2026 22:26
@frgossen
frgossen marked this pull request as ready for review July 14, 2026 22:26
@janeyx99

Copy link
Copy Markdown
Contributor

I don't think this PR is necessary after #189419, I have not observed any more timeouts on the HUD past that commit. If it arises I'd rather land #190089.

This commit as is makes some checks a no-op which is undesirable. The git merge-base should never time out (by that time the git fetch should have occurred and everything is local) and the git show could still time out retrieving blobs over the network, but still not much more than 5s. Let's close this and wait and see?

@frgossen frgossen closed this Jul 15, 2026
@github-actions
github-actions Bot deleted the gh/frgossen/208/head branch August 15, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants