Repository navigation
Bound the SDK majors CI installs, and guard the ones the probes call - #9460
Conversation
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.
…talls 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.
…not 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.
…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.
…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.
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.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91972a01af
ℹ️ 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".
| stripped = line.rstrip() | ||
| if stripped.endswith("\\"): | ||
| pending.append(stripped[:-1]) | ||
| continue |
There was a problem hiding this comment.
Handle PowerShell continuation lines
When a Windows workflow uses a PowerShell step and splits an install with the native backtick continuation (for example, python -m pip install ``` followed by an unbounded openai` argument), this parser records only the first line as the command and never examines the following requirement lines. Because other workflows keep the anti-vacuity check satisfied, such an unbounded guarded SDK install passes this new guard silently; join PowerShell continuations as well as backslashes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in a2f8a75. Worth stating precisely: no line-continuation backtick appears in any workflow here today, so this is not a live hole. It is still worth handling because 92 pwsh or powershell steps live in these workflows 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 whose pwsh step splits 'python -m pip install' across a backtick onto a bare 'openai': caught. Mutation-tested: joining only backslashes fails the new test.
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.
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81c734331f
ℹ️ 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".
| if stripped.endswith("\\") or stripped.endswith("`"): | ||
| pending.append(stripped[:-1]) | ||
| continue |
There was a problem hiding this comment.
Honor folded YAML run blocks when scanning
When an install uses a folded scalar such as run: >- followed by python -m pip install and an unbounded openai on the next line, GitHub executes one command, but this scanner flushes pending after the first physical line because there is no backslash or backtick. It therefore records an install with no requirements and ignores openai, while the existing pins keep the anti-vacuity test passing. This syntax is already used in .github/workflows/cross-platform-parity-ci.yml:206, so the scanner should fold YAML run scalars before extracting commands.
Useful? React with 👍 / 👎.
anthropic1.0.0 was published2026-08-20T19:58:58Z. The inference smoke workflows installedanthropic>=0.40with no upper bound, pip resolved the new major, and v1 removedtemperature,top_pandtop_kas accepted arguments onmessages.create():75 job failures in about four hours, across every PR that ran those workflows, none of them caused by the PR they were reported against. #9432 pinned
<1to stop it.This is the guard that would have caught it while the pin was being written.
It found two more of the same thing
openai>=1.50andplaywright>=1.45, both unbounded, in four workflows each.anthropic>=0.40,<1openai>=1.50>=1.50,<4playwright>=1.45>=1.45,<2studio-frontend-ci.ymlopenai>=1.50resolving to 3.3.1 today matters: openai's majors have not broken us, so bounding to<2would silently downgrade what CI tests. The bound goes below the next major, which keeps today's behaviour and makes the next one a decision instead of a surprise.Scope
Deliberately not "every
>=needs an upper bound". Most pins here are libraries whose majors never reach our code, and asserting on all of them would be noise that gets suppressed. The guarded set is the packages whose call surface our own probe scripts use directly with keyword arguments, which is exactly what a major is allowed to remove. Adding to the set needs that property; removing needs a reason.Two ways this guard could have been useless
anthropicdirectly beside the pins. The scan skips commented-out lines, and a test asserts that.Mutation-tested: removing
,<4from oneopenaipin fails theopenaicase and namesstudio-inference-smoke.yml:202.Registered in
workflow-trigger-lint.yml, the one job with nopathsfilter, so a workflow-only edit still runs it.tests/studio/test_workflow_guards_run_unfiltered.pypasses.