Skip to content

Strip distro .devN markers from the Colab pins - #11326

Merged
danielhanchen merged 7 commits into
mainfrom
fix/strip-distro-dev-markers-from-colab-pins
Sep 19, 2026
Merged

danielhanchen merged 7 commits into
mainfrom
fix/strip-distro-dev-markers-from-colab-pins

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

My own regression, from the oracle refresh in #11324, found by dispatching the smoke matrix on main to confirm #11325 rather than waiting for the cron.

All eight legs now fail earlier than before, in Install Colab-shaped venv:

ERROR: Could not find a version that satisfies the requirement mako==1.3.2.dev0
       (from versions: 1.1.2, ..., 1.3.0, 1.3.2, 1.3.3, ..., 1.4.1)
ERROR: No matching distribution found for mako==1.3.2.dev0

Why

The Colab image moved to Ubuntu 24.04 in this rotation, and its Mako is the distro build, which labels itself 1.3.2.dev0. PyPI has 1.3.2 and never had 1.3.2.dev0.

The freeze is a snapshot of an image, so it records versions as the image labels them. The seed step already strips a local version for exactly this reason:

# Drop the local version (`+cu128`) whatever the package is
ver = re.sub(r"[+\-].+$", "", ver)

and had nothing for .devN. One unresolvable pin fails the bulk resolve for all of them.

Mako is the only new offender: the other marked entries in the snapshot are the +cu128 torch builds, which the rewrite map already handles, and they predate this refresh.

The fix

Strip the marker to the base version, which PyPI does publish. Not a skip: the image really does carry Mako, and skipping would quietly shrink the venv this job exists to reproduce.

Verification

Two tests, both replaying the seed's own transformation rather than asserting against a hand-written list:

  • no seeded pin may carry a .dev or + marker PyPI cannot resolve;
  • a package whose marker was stripped must still be pinned, not dropped.

Removing the strip fails both, the first naming mako==1.3.2.dev0 exactly as CI did. tests/notebooks: 324 passed, 2 skipped.

Not verified here

This box cannot run the smoke matrix. The failure, and the version list PyPI offered, both come from the dispatched run on main (35432057179); the fix is checked against the committed snapshot rather than against a live resolve. The matrix is cron/dispatch only, so it will not run on this PR either — I will dispatch it on main again once this lands.

Also worth recording from that run: static + transitive resolve and the rest of Notebooks CI are now green on main, so #11324's half is confirmed. The torchcodec fix in #11325 is still unconfirmed, because the install step now fails before the import check it repairs is reached.

My own regression, from the oracle refresh in #11324. I dispatched the smoke
matrix on main to confirm the torchcodec fix and all eight legs failed earlier
than before, in 'Install Colab-shaped venv':

    ERROR: No matching distribution found for mako==1.3.2.dev0

The Colab image moved to Ubuntu 24.04 in this rotation, and its Mako is the
distro build, which labels itself 1.3.2.dev0. PyPI has 1.3.2 and never had
1.3.2.dev0. The freeze is a snapshot of an image, so it records versions as the
image labels them; the seed already strips a local version (+cu128) for exactly
this reason and had nothing for .devN. One unresolvable pin fails the bulk
resolve for all 690 of them.

Strip the marker to the base version rather than skipping the package: the image
really does carry Mako, and skipping would quietly shrink the venv this job
exists to reproduce.

Two tests, both replaying the seed's own transformation: no seeded pin may carry
a .dev or + marker PyPI cannot resolve, and a package whose marker was stripped
must still be pinned rather than dropped. Removing the strip fails both, the
first naming mako==1.3.2.dev0 exactly as CI did.

tests/notebooks: 324 passed, 2 skipped.

Not verified here: this box cannot run the smoke matrix. The failure and the
version list PyPI offered both come from the dispatched run on main
(35432057179), and the fix is checked against the committed snapshot rather
than against a resolve.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-19T09:02:11.947239Z db83cb9 Manual request
🔒 Security Review ✅ Completed 2026-09-19T08:35:10.339602Z 08bb567 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08bb56740f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/notebooks-ci.yml Outdated
# Strip to the base version rather than skipping the package: the image
# really does carry it, and skipping would quietly shrink the venv this
# job exists to reproduce.
ver = re.sub(r"\.dev\d+$", "", ver)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Limit .devN stripping to known distro rewrites

When a refreshed Colab snapshot contains a genuine published development release, this unconditional rewrite changes (for example) pkg==2.0.dev3 into the distinct final release pkg==2.0, which may not exist and no longer reproduces the captured environment. The repository already recognizes .devN as a real PEP 440 prerelease in scripts/notebook_validator.py (_split_prerelease, lines 431–446), so the Mako distro anomaly should be handled through an explicit package/version rewrite rather than applied to every future pin.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed, and the counterexample is the right one: .devN is a genuine PEP 440 prerelease, so rewriting by pattern would turn a real pkg==2.0.dev3 into pkg==2.0, a different release that may not exist and is not what the image had. Mako is a distro anomaly, not a rule.

Fixed in 9d36618. It now goes through an explicit distro_dev_version entry in colab_to_cpu_pin.json, keyed on the exact (package, recorded version) with the reason recorded beside it. Anything unlisted passes through untouched and fails the resolve loudly, which is a human's call rather than a guess. Putting the blind pattern strip back fails a new test that an undeclared .devN pin is left alone.

Comment on lines +232 to +234
ver = re.sub(r"[+\-].+$", "", ver)
ver = re.sub(r"\.dev\d+$", "", ver)
out.append(f"{name}=={ver}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Test the workflow's actual seed transform

If the production rewrite at .github/workflows/notebooks-ci.yml:574 is removed or broken, both new tests still pass because this helper independently performs the same substitution before making any assertions. Consequently, the regression that caused every smoke leg to fail is not actually guarded; the test should extract or execute the workflow's seed logic, or otherwise assert that the workflow itself contains the required transformation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one was the more serious of the two and you are exactly right. The helper re-implemented the seed transform, so deleting the rewrite from the workflow left both tests green - the regression they exist to catch was not guarded at all. Worse, the sabotage I ran to check them removed the strip from the test helper rather than from the workflow, so it demonstrated nothing.

Fixed in 9d36618: the tests now lift the seed heredoc out of notebooks-ci.yml and execute it, with only the output paths redirected and the snapshot's python_version set to the running interpreter, since that guard is about the snapshot matching the runner and has its own test. Sabotage is against the workflow now: removing the rewrite fails both pin tests, naming mako==1.3.2.dev0 exactly as CI did.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 08bb56740f

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Two defects, both reported, both real.

The blind strip was wrong. .devN is also a genuine PEP 440 prerelease, and
rewriting it by pattern would turn a real pkg==2.0.dev3 into pkg==2.0, a
different release that may not exist and is not what the image had. Mako is a
distro anomaly, not a rule. It now goes through an explicit
distro_dev_version entry keyed on the exact (package, recorded version), so a
pin nobody has judged passes through untouched and fails the resolve loudly,
where a human decides.

The tests were worse: they re-implemented the seed transform, so deleting the
rewrite from the workflow left both of them green. The regression they exist to
catch was not guarded at all, and the sabotage I ran to 'prove' them removed
the strip from the test helper rather than from the workflow, so it proved
nothing. They now lift the seed heredoc out of the workflow and execute it, with
only the output paths redirected and the snapshot's python_version set to the
running interpreter -- that guard is about the snapshot matching the runner and
has its own test.

Sabotage against the workflow this time. Removing the rewrite fails both pin
tests, naming mako==1.3.2.dev0 exactly as CI did; putting the blind pattern
strip back fails the new test that an undeclared .devN pin is left alone.

tests/notebooks: 325 passed, 2 skipped.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d36618eb5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +283 to +284
offenders = [pin for pin in _run_seed(tmp_path) if ".dev" in pin or "+" in pin]
assert not offenders, (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict the marker assertion to declared distro rewrites

Although the workflow now correctly preserves undeclared development releases, this newly added assertion still rejects every seeded .devN version. When a future Colab snapshot legitimately contains a published prerelease such as pkg==2.0.dev3, _run_seed preserves it as intended, but this test fails and misleadingly labels it a distro-only marker, effectively forcing maintainers to rewrite or suppress a valid pin. Check only the exact from versions declared in distro_dev_version (the separate undeclared-pin test already verifies pass-through behavior).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, and it contradicted the test directly beside it: that one injects an undeclared pkg==2.0.dev3 and requires the seed to preserve it, while this one rejected every seeded .devN. A snapshot carrying a genuine published prerelease would have satisfied the design and failed the suite.

Fixed in faa582f. It now checks the versions declared in distro_dev_version: a pin still carrying a declared from version is one the rewrite failed to apply, which is the actual regression. Local versions stay a blanket check, since the seed strips +cu128 from every pin whatever the package, so any survivor there is a defect.

Verified both directions: removing the rewrite from the workflow still fails it with ['mako==1.3.2.dev0'], and a freeze carrying some-real-pkg==2.0.dev3 now passes with the prerelease preserved.

pre-commit-ci Bot and others added 2 commits September 19, 2026 08:39
The assertion I added contradicted the test beside it. One deliberately injects
an undeclared pkg==2.0.dev3 and requires the seed to preserve it; the other
rejected every seeded .devN. A future snapshot carrying a genuine published
prerelease would satisfy the design and fail the suite, pushing a valid pin
towards being rewritten or suppressed for no reason.

Check the versions declared in distro_dev_version instead: a pin that still
carries a declared "from" version is one the rewrite failed to apply, which is
the actual regression. Local versions stay a blanket check, because the seed
strips +cu128 from every pin whatever the package, so any survivor there is a
defect.

Still catches the real thing: removing the rewrite from the workflow fails it
with ['mako==1.3.2.dev0']. And a freeze carrying some-real-pkg==2.0.dev3 now
passes, with the prerelease preserved.

tests/notebooks: 325 passed, 2 skipped.
@danielhanchen
danielhanchen force-pushed the fix/strip-distro-dev-markers-from-colab-pins branch from dd94188 to faa582f Compare September 19, 2026 08:50
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: faa582f3ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +306 to +307
if not rewrites:
pytest.skip("no distro .devN rewrites are declared")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail when the required rewrite mapping disappears

If distro_dev_version is deleted or misspelled while the committed freeze still contains Mako==1.3.2.dev0, the production seed treats Mako as undeclared and passes the unresolvable pin to pip. In the revised tests, test_no_declared_distro_marker_survives_the_seed then computes an empty declared set and passes, while this test skips, so the suite remains green despite recreating the exact CI regression; make the absence of a rewrite for the known current offender a failure while it remains in the freeze.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and it is a hole I put there by scoping the checks to the mapping. With distro_dev_version gone the declared set is empty, so the marker test passes vacuously and the rewrite test skips, while the seed hands pip the unresolvable Mako==1.3.2.dev0 and the matrix dies exactly as it did. A green suite over the original regression.

Fixed in db83cb9 by reading the requirement from the freeze, which is what the image actually has. Every .devN entry must now be judged one way or the other: a distro label with a distro_dev_version rewrite, or a prerelease upstream really published, listed under a new published_prerelease key and passed through untouched. Neither answer is derivable from the version string, so a new one fails until a person says which it is.

Deleting distro_dev_version now fails, and so does misspelling it, which was the quieter half of your point.

…udly

Scoping the checks to what distro_dev_version declares left a hole I put there:
delete or misspell that key and the declared set is empty, so the marker test
passes vacuously and the rewrite test skips, while the seed hands pip the
unresolvable Mako==1.3.2.dev0 and every leg of the matrix dies exactly as it
did. A green suite over the original regression.

Read the requirement from the FREEZE instead, which is what the image actually
has. Every .devN entry must be judged one way or the other: a distro label with
a distro_dev_version rewrite, or a prerelease upstream really published, listed
under the new published_prerelease key and passed through untouched. Neither
answer is derivable from the version string, so a new one fails until a person
says which it is.

Deleting distro_dev_version now fails, and so does misspelling it, which is the
case that would otherwise have been silent.

tests/notebooks: 326 passed, 2 skipped.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: db83cb9093

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit a855815 into main Sep 19, 2026
29 checks passed
@danielhanchen
danielhanchen deleted the fix/strip-distro-dev-markers-from-colab-pins branch September 19, 2026 09:16
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
* Strip distro .devN markers from the Colab pins

My own regression, from the oracle refresh in unslothai#11324. I dispatched the smoke
matrix on main to confirm the torchcodec fix and all eight legs failed earlier
than before, in 'Install Colab-shaped venv':

    ERROR: No matching distribution found for mako==1.3.2.dev0

The Colab image moved to Ubuntu 24.04 in this rotation, and its Mako is the
distro build, which labels itself 1.3.2.dev0. PyPI has 1.3.2 and never had
1.3.2.dev0. The freeze is a snapshot of an image, so it records versions as the
image labels them; the seed already strips a local version (+cu128) for exactly
this reason and had nothing for .devN. One unresolvable pin fails the bulk
resolve for all 690 of them.

Strip the marker to the base version rather than skipping the package: the image
really does carry Mako, and skipping would quietly shrink the venv this job
exists to reproduce.

Two tests, both replaying the seed's own transformation: no seeded pin may carry
a .dev or + marker PyPI cannot resolve, and a package whose marker was stripped
must still be pinned rather than dropped. Removing the strip fails both, the
first naming mako==1.3.2.dev0 exactly as CI did.

tests/notebooks: 324 passed, 2 skipped.

Not verified here: this box cannot run the smoke matrix. The failure and the
version list PyPI offered both come from the dispatched run on main
(35432057179), and the fix is checked against the committed snapshot rather
than against a resolve.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rewrite the distro pin by name, and test the workflow's own seed script

Two defects, both reported, both real.

The blind strip was wrong. .devN is also a genuine PEP 440 prerelease, and
rewriting it by pattern would turn a real pkg==2.0.dev3 into pkg==2.0, a
different release that may not exist and is not what the image had. Mako is a
distro anomaly, not a rule. It now goes through an explicit
distro_dev_version entry keyed on the exact (package, recorded version), so a
pin nobody has judged passes through untouched and fails the resolve loudly,
where a human decides.

The tests were worse: they re-implemented the seed transform, so deleting the
rewrite from the workflow left both of them green. The regression they exist to
catch was not guarded at all, and the sabotage I ran to 'prove' them removed
the strip from the test helper rather than from the workflow, so it proved
nothing. They now lift the seed heredoc out of the workflow and execute it, with
only the output paths redirected and the snapshot's python_version set to the
running interpreter -- that guard is about the snapshot matching the runner and
has its own test.

Sabotage against the workflow this time. Removing the rewrite fails both pin
tests, naming mako==1.3.2.dev0 exactly as CI did; putting the blind pattern
strip back fails the new test that an undeclared .devN pin is left alone.

tests/notebooks: 325 passed, 2 skipped.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Scope the marker assertion to declared rewrites, not to .devN as a shape

The assertion I added contradicted the test beside it. One deliberately injects
an undeclared pkg==2.0.dev3 and requires the seed to preserve it; the other
rejected every seeded .devN. A future snapshot carrying a genuine published
prerelease would satisfy the design and fail the suite, pushing a valid pin
towards being rewritten or suppressed for no reason.

Check the versions declared in distro_dev_version instead: a pin that still
carries a declared "from" version is one the rewrite failed to apply, which is
the actual regression. Local versions stay a blanket check, because the seed
strips +cu128 from every pin whatever the package, so any survivor there is a
defect.

Still catches the real thing: removing the rewrite from the workflow fails it
with ['mako==1.3.2.dev0']. And a freeze carrying some-real-pkg==2.0.dev3 now
passes, with the prerelease preserved.

tests/notebooks: 325 passed, 2 skipped.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Judge every .devN pin from the freeze, so losing the mapping fails loudly

Scoping the checks to what distro_dev_version declares left a hole I put there:
delete or misspell that key and the declared set is empty, so the marker test
passes vacuously and the rewrite test skips, while the seed hands pip the
unresolvable Mako==1.3.2.dev0 and every leg of the matrix dies exactly as it
did. A green suite over the original regression.

Read the requirement from the FREEZE instead, which is what the image actually
has. Every .devN entry must be judged one way or the other: a distro label with
a distro_dev_version rewrite, or a prerelease upstream really published, listed
under the new published_prerelease key and passed through untouched. Neither
answer is derivable from the version string, so a new one fails until a person
says which it is.

Deleting distro_dev_version now fails, and so does misspelling it, which is the
case that would otherwise have been silent.

tests/notebooks: 326 passed, 2 skipped.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

1 participant