Skip to content

fix(apps): a runpod pin in dependencies=[...] silently produces a mixed install on workers - #700

Open
deanq wants to merge 5 commits into
mainfrom
deanq/sls-993-reject-runpod-dependency
Open

deanq wants to merge 5 commits into
mainfrom
deanq/sls-993-reject-runpod-dependency

Conversation

@deanq

@deanq deanq commented Nov 8, 2026

Copy link
Copy Markdown
Member

What

A runpod entry in a resource's dependencies=[...] (or requirements.txt) was installed at deploy time and then overlaid by sync_running_package, which copies the client's own runpod tree on top. The worker ran a silent mix of the two builds with no warning.

This fails the build when a declared dependency resolves to the runpod distribution, and points the user at the RUNPOD_PACKAGE_SPEC environment variable, which is the supported way to choose the worker's runpod build.

Why

dependencies is not a sound channel for pinning the SDK: the overlay always wins for the package tree while the pinned dist-info and any version-specific files remain, so the worker runs code the user did not pin. Failing fast with an actionable message is clearer than a mixed install that only surfaces as runtime behavior drift.

Changes

  • reject_runpod_dependency, called in build_environment before any vendoring runs.
  • Detection resolves a spec to its canonical distribution name, covering plain version pins and runpod wheel/sdist URLs (and #egg= fragments), without tripping on lookalikes like runpodctl or my-runpod-helper.

Test plan

  • reject_runpod_dependency: rejects bare runpod, runpod==X, runpod>=X, case variants, a wheel URL, a plain runpod.tar.gz URL, and a local sdist path; passes numpy, requests, runpod-cleanup, run_pod (a different distribution), and non-runpod URLs.
  • build_environment raises before vendor is called when a resource lists runpod in dependencies.
  • Full suite green locally: 2789 passed, coverage 94.36%.

Known gap (out of scope): a git+<repo> ref to the runpod repo with no #egg= fragment is not caught by filename parsing; version pins and wheel/sdist URLs are covered.

A runpod entry in a resource's dependencies (or requirements.txt) was
installed and then overlaid by sync_running_package, so the worker ran a
silent mix of the two builds.

Fail the build when a dependency resolves to the runpod distribution,
naming RUNPOD_PACKAGE_SPEC as the supported way to pin the worker's
runpod build. Detection covers version pins and runpod wheel/sdist URLs.

- add reject_runpod_dependency, called before vendoring
- tests cover a version pin, a wheel URL, and non-runpod lookalikes
@celine-runpod celine-runpod changed the title fix(apps): reject a runpod pin in app dependencies fix(apps): reject a runpod pin in app dependencies (SLS-993) Nov 9, 2026
@celine-runpod celine-runpod changed the title fix(apps): reject a runpod pin in app dependencies (SLS-993) fix(apps): a runpod pin in dependencies=[...] silently produces a mixed install on workers (SLS-993) Nov 9, 2026
@celine-runpod

Copy link
Copy Markdown
Contributor

bugbot run

@deanq
deanq requested a balanced review from Copilot November 9, 2026 18:02
@deanq deanq changed the title fix(apps): a runpod pin in dependencies=[...] silently produces a mixed install on workers (SLS-993) fix(apps): a runpod pin in dependencies=[...] silently produces a mixed install on workers Nov 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Dependency-name parsing still allows RunPod requirements to bypass the mixed-install guard and incorrectly rejects unrelated dependencies with hyphenated source archive names.

4 open issues
What changed in this PR

This PR adds an early build guard intended to prevent mixed worker SDK installations when applications declare runpod as a dependency, directing users to RUNPOD_PACKAGE_SPEC instead.

Changes:

  • Adds distribution-name detection for requirement specs, archive paths, and URLs.
  • Rejects detected runpod dependencies before vendoring.
  • Adds rejection, lookalike-package, and build-order tests.
File Description
tests/​test_apps/​test_build.py Tests dependency rejection, allowed alternatives, and failure before vendoring.
runpod/​apps/​build.py Adds distribution detection and integrates the rejection guard into environment builds.

Review effort: Balanced

Comment thread runpod/apps/build.py Resolved
Comment thread runpod/apps/build.py Resolved
Comment thread runpod/apps/build.py Resolved
Comment thread runpod/apps/build.py Resolved
deanq and others added 2 commits November 9, 2026 10:11
Use packaging's Requirement and wheel/sdist filename parsers instead of
hand-rolled name extraction so the guard recognises more runpod pins and
stops rejecting unrelated distributions:

- a direct reference (runpod @ https://.../sdk.tar.gz) and a bare wheel
  filename now resolve to runpod
- the egg fragment is read before the query is stripped, so
  ...?release=1#egg=runpod is recognised
- egg extras (#egg=runpod[all]) are parsed off before canonicalizing
- wheel and sdist filenames are parsed per PEP 427/625, so a hyphenated
  sdist like runpod-cleanup-1.0.tar.gz is no longer misread as runpod

Adds a test row for each case.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants