Repository navigation
CI: hold the Anthropic SDK below 1.0 in the inference smoke workflows - #9432
Merged
Merged
Conversation
The SDK was installed as 'anthropic>=0.40', which floats across majors. 1.0.0 removed temperature, top_p and top_k as accepted arguments on messages.create(), so the determinism and image probes, which pass temperature = 0.0, now fail with TypeError: Messages.create() got an unexpected keyword argument 'temperature'. The v1 route for these is extra_body. Moving to it changes what the probes send and is worth doing deliberately, so this pins the known-good major and leaves that decision to a follow-up.
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Member
Author
|
These two are the whole of
So each PR is green on its own subject and red only on the other's, which is about as direct a demonstration as the two get. Merging both clears |
This was referenced Aug 20, 2026
This was referenced Aug 21, 2026
danielhanchen
added a commit
that referenced
this pull request
Aug 21, 2026
…9460) * Bound the SDK majors CI installs, and guard the ones the probes call anthropic 1.0.0 was published 2026-08-20T19:58:58Z. The inference smoke workflows installed `anthropic>=0.40` with no upper bound, pip took the new major, and v1 had removed `temperature`, `top_p` and `top_k` as accepted arguments on messages.create(). Every probe pinning temperature = 0.0 for determinism started raising TypeError. 75 job failures in about four hours, none caused by the PR they were reported against. #9432 pinned `<1` to stop it. This adds the guard that would have caught it while writing the pin, and the guard immediately found two more live instances of the same hazard: `openai>=1.50` and `playwright>=1.45`, both unbounded in four workflows each. `openai>=1.50` already resolves to 3.3.1 today and the probes pass, so openai's majors have not broken us and bounding to `<2` would silently downgrade what CI tests. Bounded below the NEXT major instead, `<4`. playwright is still 1.x and studio-frontend-ci.yml already used `<2`, so the other four now match it. Deliberately not "every >= needs an upper bound". Most pins here are libraries whose majors never reach our code, and asserting on all of them is noise that gets suppressed. The set covers packages whose call surface our own probe scripts use directly with keyword arguments, which is exactly what a major may remove. The guard skips commented-out lines, since #9432 added comments naming anthropic right beside the pins and a comment must not be able to satisfy or trip it. It also carries an anti-vacuity test: if the workflows stop installing these, that test says so rather than the suite going quietly green while checking nothing. Mutation-tested: removing `,<4` from one openai pin fails the openai case, naming studio-inference-smoke.yml:202. Registered in workflow-trigger-lint.yml, the one job with no paths filter, so a workflow-only edit still runs it. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Assert the boundary the pin must exclude, and read multi-line pip installs Two holes in the guard, both of which let it pass while the thing it guards was broken. A `<` anywhere in the specifier counted as bounded, so `openai>=1.50,<999` was accepted while admitting every major the pin exists to keep out. Each package now carries the first major it must not reach, and the assertion is that the pin excludes it. `<=4` does not exclude the 4 series and is rejected; a narrower window like playwright's existing `>=1.55,<1.58` is stricter than the boundary and still passes. Compared as integer tuples rather than through packaging, which the workflow-trigger-lint job does not install. The scan also read one line at a time, so a guarded SDK on a continuation of a `pip install \` command was invisible. That form is the house style at 19 sites in this repo, and the anti-vacuity test would have stayed satisfied by the single-line pins, so such a pin would have been silently unchecked. Continuations are now joined before matching, reported at the line the command starts on. Verified end to end against the real workflow files rather than only in unit tests: planting `playwright>=1.45,<99`, and planting `openai>=1.50` on a continuation line, are each caught. Mutation-tested: dropping the join fails the continuation test, and reverting to presence-of-`<` fails the boundary test. * See a bare install of a guarded SDK, and stop rejecting pins that cannot drift The specifier was mandatory in the pattern, so `pip install openai` matched nothing: the package was neither bounded nor reported, while the anti-vacuity test stayed satisfied by the other pins. An extras form like `openai[datalib]>=1.50` was invisible for the same reason, since the name pattern stopped at the bracket. Both resolve whatever major is current, which is the one thing this file exists to prevent. Requirements are now tokenized with shlex and matched with an optional specifier, so a bare name is a requirement with no constraint rather than an absence. Tokenizing also means a package name inside a URL or a `-r` path is no longer mistakable for an install of it. Writing that surfaced a false positive in the boundary check from the previous commit, which nothing had reported: `pip install openai==3.0.0` carries no `<`, so it was treated as admitting the major even though an exact pin cannot drift anywhere. `~=1.4` had the same problem while meaning `>=1.4,<2`. Rejecting either would push people to add a redundant `<N` beside an `==`, so the rule is now about what the requirement can RESOLVE to rather than which operator was typed. Verified end to end against the real workflow files: planting a bare `pip install openai` is caught. Mutation-tested: restoring the mandatory specifier fails the bare install test, and dropping the exact-pin case fails the cannot-drift test. * Tighten the comments on the SDK major guard * Scan .yaml too, recognize pip beyond the bare command, and treat 4.0 as 4 Three more ways the guard checked less than it claimed, each of which kept the anti-vacuity test satisfied through the existing pins. The glob read only `*.yml`. GitHub accepts `.yaml`, so an unbounded install in such a file would never have been inspected. Both extensions now, through a helper a test can point at a temp directory. The scan also required the literal text `pip install`, which misses `pip3 install` and `"$STUDIO_VENV/bin/pip" install` -- the latter is already used at mlx-ci.yml:439. The invocation is now matched structurally, and `npm install` and `pip download` still do not qualify. The third is a false positive that would have failed CI on a correct pin: `<4.0` was rejected against a boundary of `(4,)` because the tuples differ in length, though the two are the same release boundary. Trailing zeros are dropped before comparing, so `<4`, `<4.0` and `<4.0.0` agree while `<4.0.1`, which really does admit 4.0, still does not qualify. Verified end to end with one planted workflow combining all of it -- a `.yaml` file running `"$VENV/bin/pip" install` with a bare `openai` on a continuation line -- which is caught. Mutation-tested: restoring the `.yml`-only glob, the literal `pip install` text, or the unnormalized comparison each fails exactly one of the three new tests. * Fail closed on a suffixed bound, and keep the precision a compatible pin was written with Two more version-parsing errors, one in each direction. The upper-bound regex captured only the numeric prefix, so `<4.post1` was read as `<4` and passed. A post-release or local-version bound is LOOSER than its digits suggest: `<4.post1` and `<4+local` both admit 4.0. The whole token is captured now and anything that is not a plain release fails closed, since guessing at a suffix is what let this through. A stricter-than-plain form like `<4rc1` is refused too rather than parsed; writing the plain bound is the fix. The other is a false positive I introduced with the trailing-zero normalization in b94e001. `~=` semantics depend on how many components were written -- `~=3.0` implies <4, `~=3.0.0` implies <3.1 -- and normalizing collapsed both to `(3,)`, where the compatible-release branch skipped them for having fewer than two components. So the guard rejected two valid pins. `~=` now reads the release with every component kept, while comparisons keep the normalized form that makes `<4.0` equal `<4`. The reported case was `~=3.0.0`; `~=3.0` was broken the same way and is covered too. The existing tests missed both because they used `~=1.4` and `~=1.4.5`, which have no trailing zeros. Checked as a matrix over post-release, local, plain, trailing-zero, compatible, exact, too-wide and inclusive bounds: 12 cases, no mismatches. Mutation-tested: restoring the numeric-prefix capture, or the normalized version in the `~=` branch, each fails exactly one of the two new tests. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Strip trailing comments, and recognize a Windows pip executable Only whole-line comments were dropped, though the file's own docstring claimed comments could not satisfy or trip the guard. A trailing comment cut both ways: `run: echo ok # pip install 'openai<4'` was scanned as a real install, so commented text could satisfy the bound and anti-vacuity checks once the real installs were gone, and merely naming a bare guarded package after a `#` could fail CI. Comments are now stripped with quote-aware parsing, and since a `#` only opens a comment at the start of a word, `git+https://x#egg=y` survives quoted or not. The pip pattern also ended the executable after digits and dots and accepted only `/` as a separator, so `pip.exe install` and `"$VENV\Scripts\pip.exe" install` matched neither -- the standard Windows forms, in a repo with several windows-latest workflows. Both are recognized now, along with `pip3.12.exe`, while `npm install` and `pip download` still do not qualify. Tokens carrying a backslash are skipped alongside `/` ones so a Windows path cannot be read as a requirement. Verified end to end with a planted windows-latest .yaml carrying both: a decoy trailing comment pinning a safe bound, and a real `pip.exe install openai` with no bound. The decoy does not satisfy the guard and the real install is caught. Mutation-tested: restoring whole-line-only comments, or the previous pip pattern, each fails exactly one of the two new tests. * Join PowerShell continuations as well as backslashes PowerShell continues a line with a backtick. The scanner only joined backslashes, so an install split that way was read as its first line alone and any requirement below it went uninspected, while the existing pins kept the anti-vacuity check satisfied. Nothing in these workflows uses the form today, which is why this is a fix rather than a report of a live hole: no line-continuation backtick appears in any workflow. It is still worth handling, because 92 pwsh or powershell steps live here and 9 of them sit around a pip install, so the form is one long install list away from being written. Verified end to end with a planted windows-latest .yaml running a pwsh step that splits `python -m pip install` across a backtick onto a bare `openai`: caught. Mutation-tested: joining only backslashes fails the new test. * Final comment pass: drop the stale pip-pattern block and tighten three others --------- Co-authored-by: danielhanchen <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The inference smoke workflows install the Anthropic SDK as
anthropic>=0.40, with no upper bound.anthropicpublished 1.0.0, the resolver picked it up, and the OpenAI + Anthropic determinism and image probes started failing on every PR that runs them.What breaks
raised from the "Multi-turn determinism via OpenAI + Anthropic SDKs" and "JSON schema decoding + image input" steps.
What actually changed
v1.0 removed
temperature,top_pandtop_kas accepted arguments onmessages.create(). From the SDK's own MIGRATION.md:and
The stated reason is that current models do not use these sampling parameters. The documented route for callers that still want them is
extra_body, which is merged into the request JSON as-is.The probes pass
temperature = 0.0deliberately, for determinism, so they land exactly on this.Worth noting the 1.0.0 CHANGELOG entry alone does not say this. It reads only "upgrade to httpx2 and some minor breaking changes. See MIGRATION.md for details", so the parameter removal is only visible in the migration guide.
Evidence that this is the version and not the code
Same workflow, same step, same call site, different resolved SDK:
anthropic-0.125.0anthropic-1.0.0It survived a re-run, so it is not a flake. Checking the signature directly on a 0.x install agrees:
The change
'anthropic>=0.40'becomes'anthropic>=0.40,<1'at the four install sites:.github/workflows/studio-inference-smoke.yml.github/workflows/studio-windows-inference-smoke.yml.github/workflows/studio-mac-ui-smoke.yml(two steps)A major-version bound rather than an exact pin, so patch and minor fixes still arrive but a major cannot land under us again without a decision.
>=0.40,<1currently resolves to 0.125.0, which is the version the last green runs used.What this deliberately does not do
It does not migrate the call sites to
extra_body. That changes what the probes send to the backend, and the determinism probes exist precisely to pin what is sent, so it is worth doing as its own change with its own reasoning rather than as a side effect of unbreaking CI. This PR restores the known-good major and leaves that door open.