fix(typecheck): pin mypy's analysis platform so results match CI - #4489
Closed
ProjeetBhaumik wants to merge 1 commit into
Closed
fix(typecheck): pin mypy's analysis platform so results match CI#4489ProjeetBhaumik wants to merge 1 commit into
ProjeetBhaumik wants to merge 1 commit into
Conversation
ProjeetBhaumik
force-pushed
the
fix/typecheck-platform-determinism
branch
from
August 17, 2026 18:57
012ae70 to
e5d5157
Compare
mypy defaults to the host platform, so a Windows contributor sees three src/agents/sandbox/ errors that CI, which runs on Linux, never reports. Closes openai#4477
ProjeetBhaumik
force-pushed
the
fix/typecheck-platform-determinism
branch
from
August 17, 2026 18:59
e5d5157 to
ff3b318
Compare
Author
|
Closing in favour of #4482, which fixes the three errors at the source rather than pinning the analysis platform. That is the better fix: I checked it out locally and it clears the full tree on both |
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.
Summary
make typecheckgates contributions, but mypy defaults to the host platform, so the same checkout answers differently depending on who runs it.On
d40f5d9under Python 3.14:The three win32-only errors are all in
src/agents/sandbox/, wheretempfileand theunix_localpaths differ between platforms in typeshed:src/agents/sandbox/util/tar_utils.py:161—Incompatible return value type (got "_TemporaryFileWrapper[bytes]", expected "IOBase")src/agents/sandbox/sandboxes/unix_local.py:339—Name "process" is used before definitionsrc/agents/sandbox/sandboxes/docker.py:1430—Argument "stream" ... has incompatible type "_TemporaryFileWrapper[bytes]"; expected "IOBase"The typecheck job runs on
ubuntu-latest, so CI never exercises the win32 result. A Windows contributor sees three failures they did not cause and cannot act on.Pinning mypy to Linux makes the gate reproducible and makes it report what CI actually enforces.
Why pyright is left alone
The issue covers
make typecheck, which runs mypy and pyright, so the symmetric change would be"pythonPlatform": "Linux"inpyrightconfig.json. I tried that and backed it out, because it makes things worse off-Linux.Pyright resolves the host's real installed stdlib rather than bundled stubs, so forcing
pythonPlatformto Linux on a macOS host produces a hybrid environment that no real machine sees. Measured on macOS, same venv, back to back:mainmain+"pythonPlatform": "Linux"tests/Those 14 are spurious — a real Linux machine and a real macOS machine both report 0. Pyright's platform default is already the right behaviour, so this PR touches mypy only.
Note on a second, separate axis
While measuring this I hit a different source of nondeterminism, which this PR does not address: mypy's results also vary by interpreter version. Under Python 3.10 the tree reports 5 errors on any platform (4 in
archive_ops.pyforSpooledTemporaryFilevsIOBase, 1 inrun_loop.pyforBaseExceptionGroup), and 0 under 3.11+.uv syncresolves 3.10 locally when there is no.python-versionfile, while CI pins 3.14 and sees none of them.That looks worth a separate decision — either pinning the dev interpreter or type-checking the supported floor — so I left it out rather than bundling it here. Happy to follow up if you have a preference.
Test plan
Python 3.14.7 on macOS,
uv sync --all-extras --all-packages --group dev:bash .agents/skills/code-change-verification/scripts/run.sh— all commands passed (make lint38s,make tests265s,make typecheck305s)make typecheckon this branch — mypySuccess: no issues found in 305 source files, pyright0 errors, 0 warnings, 0 informationswin32and re-running: 3 errors, matching the--platform win32overrideOne caveat, for transparency: two earlier full-suite runs on this machine each hit a single different timeout-based failure (
test_stop_terminates_active_pty_sessions, thentest_read_path_probe_resolves_symlinks_before_classifying_missing). Both pass in isolation and both passed in the final run; they appear to be load-induced on my hardware rather than related to this change, which touches no runtime code.Issue number
Closes #4477
Checks
make lintandmake format