Skip to content

fix(wheels): disable cooldown for local and cache wheel servers#1141

Open
smoparth wants to merge 1 commit into
mainfrom
fix/disable-cooldown-cache-server
Open

fix(wheels): disable cooldown for local and cache wheel servers#1141
smoparth wants to merge 1 commit into
mainfrom
fix/disable-cooldown-cache-server

Conversation

@smoparth
Copy link
Copy Markdown
Contributor

@smoparth smoparth commented May 12, 2026

Use PyPICacheProvider (introduced in #1143) for local and cache wheel server lookups in the build and download-sequence paths. This separates trusted internal sources (no cooldown, no upload-time checks) from upstream pre-built sources.

  • Add resolve_cached_wheel() using PyPICacheProvider
  • Simplify _is_wheel_built() to only check cache servers (local + cache_wheel_server) via resolve_cached_wheel
  • Route download_sequence local server through resolve_cached_wheel
  • Remove supports_upload_time workaround from resolve_all_prebuilt_wheels
  • Add tests for cache/local cooldown bypass and upstream cooldown retention

Follows up on #1143 and closes #1140.

Pull Request Description

What

Why

@smoparth smoparth requested a review from a team as a code owner May 12, 2026 09:57
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR threads a new cache_wheel_server_url through build and download paths, adds resolve_cached_wheel and cache-first resolution to prefer local/cache servers when locating prebuilt wheels, and updates acquisition to use a local cached file when the resolved URL is the local wheel server. resolve_all_prebuilt_wheels no longer special-cases local servers for upload-time support. Tests were added/updated to assert that local and cache wheel servers skip cooldown warnings while external servers retain cooldown behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: disabling cooldown for local and cache wheel servers through use of PyPICacheProvider.
Linked Issues check ✅ Passed All changes directly address #1140 requirements: resolve_cached_wheel and resolve_existing_wheel implement cache server handling without cooldown, tests verify cooldown bypass for cache/local servers and retention for upstream sources, and pre-built wheel resolution remains separate.
Out of Scope Changes check ✅ Passed All changes are scoped to disabling cooldown for cache/local servers and refactoring wheel resolution to separate cache lookup from pre-built resolution, with no unrelated modifications detected.
Description check ✅ Passed The PR description clearly relates to the changeset, explaining the introduction of PyPICacheProvider for local and cache wheel server lookups, removal of cooldown checks for trusted internal sources, and the addition of resolve_cached_wheel().

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify Bot added the ci label May 12, 2026
@smoparth
Copy link
Copy Markdown
Contributor Author

Considered storing cache_wheel_server_url on WorkContext directly, but PR #1065 already proposes that (as cache_wheel_server_urls on ctx). Kept this fix minimal by threading it as a function parameter; once #1065 lands, the parameter can be replaced with ctx.cache_wheel_server_urls.

@smoparth smoparth requested a review from ryanpetrello May 12, 2026 09:58
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fromager/wheels.py`:
- Around line 556-565: The equality checks against ctx.wheel_server_url and
cache_wheel_server_url can fail due to URL normalization differences (trailing
slashes, etc.); update the comparisons in the block that assigns
provider.cooldown to None so they compare normalized URLs instead of raw strings
— normalize `url`, `ctx.wheel_server_url`, and `cache_wheel_server_url` (e.g.,
parse and rebuild or at minimum strip trailing slashes and ensure consistent
scheme/netloc/path) before doing the equality checks, and then set
provider.cooldown = None when the normalized values match.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 13501074-a382-4bd6-bbb9-92f828557ff1

📥 Commits

Reviewing files that changed from the base of the PR and between 7b10135 and f1ca260.

📒 Files selected for processing (3)
  • src/fromager/commands/build.py
  • src/fromager/wheels.py
  • tests/test_cooldown.py

Comment thread src/fromager/wheels.py Outdated
@tiran
Copy link
Copy Markdown
Collaborator

tiran commented May 12, 2026

This PR feels like a hack on top of a hack. The code is becoming increasingly confusing and hard to understand.

I think the root cause of the issue is the fact that code paths are mixing cache wheel server and PyPI server for pre-built wheels. Cache lookup is using the same code path as pre-built download. At least that's what I think is happening...

Copy link
Copy Markdown
Member

@LalatenduMohanty LalatenduMohanty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this PR to use PyPICacheProvider for both the local and cache wheel server URLs inside resolve_all_prebuilt_wheels, rather than conditionally nulling out cooldown after the fact. refer #1143

@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from f1ca260 to eae3f0d Compare May 12, 2026 22:31
@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from eae3f0d to 85b2780 Compare May 12, 2026 22:35
@smoparth
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from 85b2780 to 19c9cd9 Compare May 13, 2026 13:42
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/fromager/commands/build.py (1)

524-532: 💤 Low value

Log wording: "prebuilt" no longer matches the function's scope.

_is_wheel_built now covers cache/local candidates too, not just prebuilt wheels. The "could not locate prebuilt wheel" log messages at lines 526 and 531 will be misleading when the failure is for a cache hit. Consider "existing" to match line 488.

♻️ Suggested change
-        logger.debug(
-            "could not locate prebuilt wheel %s-%s",
-            dist_name,
-            resolved_version,
-            exc_info=True,
-        )
-        logger.info("could not locate prebuilt wheel")
+        logger.debug(
+            "could not locate existing wheel %s-%s",
+            dist_name,
+            resolved_version,
+            exc_info=True,
+        )
+        logger.info("could not locate existing wheel")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fromager/commands/build.py` around lines 524 - 532, The logs in
_is_wheel_built incorrectly say "prebuilt wheel" while the function also checks
cache/local candidates; update both logger calls that reference dist_name and
resolved_version (the logger.debug with exc_info and the logger.info that
returns None) to use wording like "existing wheel" or "existing candidate"
(consistent with earlier "existing" wording at line 488) so messages accurately
reflect cache/local/prebuilt scope.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fromager/commands/build.py`:
- Around line 481-489: The call to wheels.resolve_existing_wheel is currently
executed before the try/except in _is_wheel_built, so any exceptions (e.g.,
transient network errors) escape and abort the build; move the
resolve_existing_wheel(...) invocation into the existing try block that
surrounds the logic at lines 491+ so that exceptions are caught and the function
returns None (falling back to source build) as before—adjust references to
ctx=wkctx, req=req, pbi=pbi, cache_wheel_server_url=cache_wheel_server_url and
preserve the existing logger.info("could not locate existing wheel")/return None
flow inside the except path.

---

Nitpick comments:
In `@src/fromager/commands/build.py`:
- Around line 524-532: The logs in _is_wheel_built incorrectly say "prebuilt
wheel" while the function also checks cache/local candidates; update both logger
calls that reference dist_name and resolved_version (the logger.debug with
exc_info and the logger.info that returns None) to use wording like "existing
wheel" or "existing candidate" (consistent with earlier "existing" wording at
line 488) so messages accurately reflect cache/local/prebuilt scope.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d96726c4-5302-4336-905e-1d3f306b488c

📥 Commits

Reviewing files that changed from the base of the PR and between eae3f0d and 19c9cd9.

📒 Files selected for processing (4)
  • src/fromager/commands/build.py
  • src/fromager/commands/download_sequence.py
  • src/fromager/wheels.py
  • tests/test_cooldown.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/test_cooldown.py
  • src/fromager/commands/download_sequence.py
  • src/fromager/wheels.py

Comment thread src/fromager/commands/build.py Outdated
@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from 19c9cd9 to 128b1b2 Compare May 13, 2026 13:55
@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from 128b1b2 to 8862a7e Compare May 13, 2026 14:00
@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from 8862a7e to a7aba28 Compare May 13, 2026 14:08
@smoparth smoparth requested review from a team and LalatenduMohanty May 13, 2026 14:16
Comment thread src/fromager/commands/build.py Outdated
Copy link
Copy Markdown
Contributor

@rd4398 rd4398 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! I will wait for @LalatenduMohanty to approve since he requested changes before

Comment thread src/fromager/commands/build.py Outdated
@tiran
Copy link
Copy Markdown
Collaborator

tiran commented May 13, 2026

The function resolve_existing_wheel is conflating two different concepts. Let's treat pre-built wheels and cached wheels as separate entities.

  • pre-built wheels come from PyPI or 3rd party wheel index. They should use cooldown.
  • cached wheels are built by us and stored in a cache index that contains only our wheels + previously cached pre-built wheels.

smoparth added a commit that referenced this pull request May 13, 2026
Use PyPICacheProvider (introduced in #1143) for local and cache wheel
server lookups in the build and download-sequence paths.  This separates
trusted internal sources (no cooldown, no upload-time checks) from
upstream pre-built sources.

- Add resolve_cached_wheel() using PyPICacheProvider
- Simplify _is_wheel_built() to only check cache servers (local +
  cache_wheel_server) via resolve_cached_wheel
- Route download_sequence local server through resolve_cached_wheel
- Remove supports_upload_time workaround from resolve_all_prebuilt_wheels
- Add tests for cache/local cooldown bypass and upstream cooldown retention

Follows up on #1143 and addresses maintainer feedback from #1141.

Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Shanmukh Pawan <smoparth@redhat.com>
@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from a7aba28 to 6b21905 Compare May 13, 2026 16:51
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/fromager/wheels.py (1)

532-548: 💤 Low value

Add a Sphinx versionadded directive to the new public helper.

resolve_cached_wheel is a new public function; per the repo's documentation conventions, user-facing additions should be annotated so downstream docs and consumers can tell when the API appeared.

📝 Suggested docstring tweak
 def resolve_cached_wheel(
     *,
     ctx: context.WorkContext,
     req: Requirement,
     cache_server_url: str,
 ) -> tuple[str, Version]:
     """Resolve a wheel from a trusted cache server (local or remote).

     Uses ``PyPICacheProvider`` -- no cooldown, no hooks, no upload-time checks.
+
+    .. versionadded:: NEXT
     """

As per coding guidelines: "Use Sphinx versionadded, versionremoved, versionchanged directives for user-facing changes".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fromager/wheels.py` around lines 532 - 548, The new public helper
resolve_cached_wheel needs a Sphinx "versionadded" directive in its docstring;
edit the triple-quoted docstring for resolve_cached_wheel to add a line like
"versionadded:: <release>" (use the current release number for this change)
immediately under the short description so the function appears in generated
docs as added in that version. Ensure the directive follows Sphinx formatting
and stays inside the existing docstring for the resolve_cached_wheel function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/fromager/wheels.py`:
- Around line 532-548: The new public helper resolve_cached_wheel needs a Sphinx
"versionadded" directive in its docstring; edit the triple-quoted docstring for
resolve_cached_wheel to add a line like "versionadded:: <release>" (use the
current release number for this change) immediately under the short description
so the function appears in generated docs as added in that version. Ensure the
directive follows Sphinx formatting and stays inside the existing docstring for
the resolve_cached_wheel function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7777c231-6814-4a3e-9e71-54bc6e528cc5

📥 Commits

Reviewing files that changed from the base of the PR and between 19c9cd9 and 6b21905.

📒 Files selected for processing (4)
  • src/fromager/commands/build.py
  • src/fromager/commands/download_sequence.py
  • src/fromager/wheels.py
  • tests/test_cooldown.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/fromager/commands/download_sequence.py
  • tests/test_cooldown.py

@smoparth
Copy link
Copy Markdown
Contributor Author

The function resolve_existing_wheel is conflating two different concepts. Let's treat pre-built wheels and cached wheels as separate entities.

  • pre-built wheels come from PyPI or 3rd party wheel index. They should use cooldown.
  • cached wheels are built by us and stored in a cache index that contains only our wheels + previously cached pre-built wheels.

@tiran, fixed. _is_wheel_built now only checks cache servers (local + cache_wheel_server) via resolve_cached_wheel using PyPICacheProvider.
Pre-built wheel resolution is no longer part of this function -- it stays as a separate concern handled in _build.

Use PyPICacheProvider (introduced in #1143) for local and cache wheel
server lookups in the build and download-sequence paths.  This separates
trusted internal sources (no cooldown, no upload-time checks) from
upstream pre-built sources.

- Add resolve_cached_wheel() using PyPICacheProvider
- Simplify _is_wheel_built() to only check cache servers (local +
  cache_wheel_server) via resolve_cached_wheel
- Route download_sequence local server through resolve_cached_wheel
- Remove supports_upload_time workaround from resolve_all_prebuilt_wheels
- Add tests for cache/local cooldown bypass and upstream cooldown retention

Follows up on #1143 and closes #1140.

Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Shanmukh Pawan <smoparth@redhat.com>
@smoparth smoparth force-pushed the fix/disable-cooldown-cache-server branch from 6b21905 to 186577a Compare May 13, 2026 19:22
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.

disable cooldown for local and cache wheel server

4 participants