Skip to content

Fix the tests left red on main by #12408, #12382 and #12436 - #12447

Merged
danielhanchen merged 2 commits into
mainfrom
fix/main-red-oct1-afternoon
Oct 1, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix/main-red-oct1-afternoon

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

After #12440 and #12441, main is still red in (Python 3.13, a-k), (Python 3.13, rest) and Repo tests (CPU, rest) (seen on #12442 and #12443). The causes are three PRs merged today. In each case the product change is right and the tests or their CI wiring are not.

Failure Introduced by Cause
test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding[4] and [5] #12408 4 new read_text() calls on checked-in files with no encoding, which breaks on Windows once the file gains a non-ASCII byte
test_diffusion_offload_seed_balanced.py::test_denoiser_seed_forwards_the_placement #12408 import diffusers, which the CPU runners do not install (ModuleNotFoundError)
test_sf_client_tools_passthrough.py::test_multimodal_content_parts_flattened_for_local_template and test_vision_client_tools.py::test_a_historical_image_stays_on_the_turn_that_sent_it_without_tools #12382 the first user message now opens with [Current date: YYYY-MM-DD]\n\n (by design), and both compared the text exactly
tests/test_st_modules_json_trust_gate.py (17 tests) #12436 needs sentence_transformers, which the CPU repo-test shards do not install. #12436 merged with its own Repo tests jobs cancelled, so this never ran

Fix

Verification

  • The four studio backend files: 177 passed, 2 skipped.
  • tests/test_st_modules_json_trust_gate.py with sentence-transformers 6.1.0 installed: 17 passed. With sentence_transformers blocked: 1 skipped (module level).
  • test_source_read_encoding.py, test_formatter_fixed_point.py and tests/studio/test_version_compat_bundle.py: all pass (54 passed together with the gate file).
  • Sabotage:
    • changing CURRENT_DATE_UPDATE_PREFIX to "[Today is: " fails both date-note tests;
    • forwarding placement_device = None in diffusion_denoiser_prequant.py fails the placement test.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 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-10-01T15:40:41.818405Z 9fc6cd0 Manual request
🔒 Security Review ⚠️ Failed 2026-10-01T15:00:17.763482Z 709b067 PR opened
ℹ️ 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: 709b0670f0

ℹ️ 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".

PYTHONPATH=. python -m pytest \
tests/vllm_compat/test_unsloth_zoo_imports.py \
tests/vllm_compat/test_extended_module_imports.py \
tests/test_st_modules_json_trust_gate.py \

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 Trigger the workflow when the trust-gate test changes

This makes zoo-imports-under-spoof the only CI job that actually executes this file, because the CPU repo-test shards lack sentence_transformers and now skip it at collection; however, this workflow's pull_request.paths list does not include tests/test_st_modules_json_trust_gate.py. Consequently, a PR that only modifies or accidentally weakens this security regression test will not trigger its sole executing workflow and can pass with only a skip elsewhere. Add this test path to the workflow's pull-request paths.

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.

Fixed in 9fc6cd0. tests/test_st_modules_json_trust_gate.py is now in the workflow's pull_request.paths. I also added test_every_test_file_a_job_runs_triggers_the_workflow to tests/studio/test_version_compat_bundle.py: every test file any job in this workflow runs must match one of those paths. Removing the new path entry fails it and names this file.

@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: 9fc6cd0134

ℹ️ 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 1242643 into main Oct 1, 2026
34 of 36 checks passed
@danielhanchen
danielhanchen deleted the fix/main-red-oct1-afternoon branch October 1, 2026 16:07
danielhanchen added a commit that referenced this pull request Oct 1, 2026
main added the same pytest.importorskip in #12447, so the conflict is only in the
comment above it. Kept this branch's, corrected: that PR's note says
version-compat-ci's zoo-imports job runs this file, and it does not. That job
installs sentence-transformers but runs two named tests/vllm_compat files. The only
shard that collects this one is Repo tests (CPU, rest), which is why this branch
also installs the package there. Without that, the importorskip leaves the gate
skipped in every job, where it cannot fail and so proves nothing.
danielhanchen added a commit that referenced this pull request Oct 1, 2026
The merge commit on this branch asserted that version-compat-ci's zoo-imports job does
not run tests/test_st_modules_json_trust_gate.py, and used that to justify the
sentence-transformers install added here. The assertion is wrong: that job names the file
on its pytest line, at version-compat-ci.yml:240, and installs the package for it. #12447
was right and my note contradicting it was not.

The install itself stands on its own, which is why this only touches the two comments.
studio-backend-ci's Repo tests shard collects the file by discovery rather than by name,
and with no sentence-transformers there the importorskip leaves it skipped for good, which
is the same reason the pinned-ruff step directly above it exists. So the file runs in two
places for two different reasons: the version matrix under the CUDA spoof in
version-compat-ci, and the core dependency set here. Both comments now say that.
nick-oom pushed a commit to OOMResearch/unsloth that referenced this pull request Oct 1, 2026
…firm the resolved class (unslothai#12444)

* Check a module config on every sentence-transformers version, and confirm the class

Two follow-ups to the modules.json trust gate.

The config check keyed off util.import_module_class to mean "sentence-transformers
6, which gates these itself". That is not what the attribute means: 5.5 exports it
while its WordEmbeddings.load still calls import_from_string on the config's
tokenizer_class, so the check skipped exactly the versions that need it. The
prefixes are upstream's own rules, so run them unconditionally, where they either
agree with a version that gates for itself or cover one that does not. Verified
refused on 5.0, 5.5, 6.0 and 6.1, and the 24 per-module config files the real
embedders ship are all still accepted.

The in-namespace branch also trusted the prefix alone. The module part is pinned to
the installed package so the import reaches only trusted code, but the same dotted
syntax names any public attribute, and the caller goes straight on to .load() it.
Resolution now rejects a malformed path before importing and confirms the result is
a sentence-transformers module class, so a type naming a function or a submodule is
refused instead of being handed a load call. All 62 module classes the library ships
and the 4 types the real embedders declare still resolve.

* Trim the comments on the new gate code

* Cover legacy module config filenames and the checkpoint reload

config_file_name only exists from sentence-transformers 5. On 3.x and 4.x
WordEmbeddings opens wordembedding_config.json by name and Router/Asym open
router_config.json, so the attribute lookup found nothing to check on those
versions. Map the known legacy names by class.

Checkpoint resume is a second caller of the same shape: the class comes from the
live model, so it is trusted, but load() still reads the checkpoint's own config
files and some versions import dotted paths out of them. Run the same check first.

* Honour the model's own consent when reloading a checkpoint

The config check on checkpoint resume passed False unconditionally, so a model
that legitimately needed trust_remote_code could no longer resume, and the
error advised a flag the reload cannot accept, since it takes only a checkpoint
path. Record the consent the model was loaded with on each route and read it
back there, defaulting to False when it is absent so an older object still
fails closed.

* Trim the comments after convergence

* Install sentence-transformers for the shard that runs the trust gate

The gate's tests errored in Repo tests (CPU, rest) with ModuleNotFoundError:
sentence-transformers is an extra, not a core dependency, and that shard installs
the core set. The file now skips when the package is absent, so it reports a skip
rather than an error, and the shard installs the package so it runs rather than
skipping everywhere, which would leave the gate unfailable in CI.

The install rides the existing transformers pin on one line, so resolving
sentence-transformers cannot lift transformers past the <5.5 ceiling.

* Correct the note on which jobs run the trust gate

The merge commit on this branch asserted that version-compat-ci's zoo-imports job does
not run tests/test_st_modules_json_trust_gate.py, and used that to justify the
sentence-transformers install added here. The assertion is wrong: that job names the file
on its pytest line, at version-compat-ci.yml:240, and installs the package for it. unslothai#12447
was right and my note contradicting it was not.

The install itself stands on its own, which is why this only touches the two comments.
studio-backend-ci's Repo tests shard collects the file by discovery rather than by name,
and with no sentence-transformers there the importorskip leaves it skipped for good, which
is the same reason the pinned-ruff step directly above it exists. So the file runs in two
places for two different reasons: the version matrix under the CUDA spoof in
version-compat-ci, and the core dependency set here. Both comments now say that.

* Dispatch the config class-ref check by the loader, not the key name

The check keyed on the key name alone, so any module config carrying an
activation_function or a tokenizer_class was refused for a value outside torch.* or
sentence_transformers.*. SpladePooling lists activation_function in its own config_keys,
saves the literal "relu" or "log1p_relu" there and then does
`if self.activation_function == "log1p_relu"`: nothing is imported, and the check refused
both values. No SPLADE sparse model could load without the user turning on remote code
for a name no loader resolves.

The rules are now keyed by the class that resolves them, and a class that imports nothing
out of its config returns before any file is read. Verified against the 5.1.0 source
rather than inferred: the only config-driven import_from_string calls in the package are
Dense.load on activation_function, WordEmbeddings.load on tokenizer_class, Router.load on
types, and SentenceTransformer's own modules.json type, which _resolve_module_class
already covers. CrossEncoder.load resolves an activation path too, but it is not loaded
through modules.json and does not reach here. Asym has been an alias of Router since 5.0
(`Asym = Router`) so it arrives as Router; its entry is kept for versions where it is its
own class, and the rules follow the bases so a subclass stays gated.

Five tests. The SpladePooling one raises on the previous head with exactly the message a
user would have hit. The Dense and WordEmbeddings cases are negative controls that pass
on the previous head too, which is the point: they prove the scoping did not buy the fix
by dropping coverage. One test asserts the set of covered classes, so a version that adds
another config-driven import shows up as a missing key rather than as a silently
unchecked path.

28 pass in this file, 85 across the three sentence-transformers suites, 65 under the CUDA
spoof alongside the vllm_compat files.
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