fix(gateway): keep the legacy base-pythonw venv overlay on non-PM installs (#122183)

The `Path(sys.prefix).resolve() != resolved_venv` guard skipped exactly the
case _ensure_windows_gateway_venv_imports exists for (264ac72b67): a gateway
restarted under uv's base pythonw.exe that still needs venv/Lib/site-packages
(MCP SDK). When sys.prefix IS the venv its site-packages is already on
sys.path, so the guard turned the function into a no-op on non-PM installs.

It is not needed for #122183: the committed_venv early return alone keeps a
PM install off the leftover pre-PM venv (and a corrupt facts.json raising
there is fail-closed, matching hermes_bootstrap). Mutation-checked with a
fake-win32 harness: removing that early return turns
test_committed_generation_blocks_the_legacy_venv_overlay red.
This commit is contained in:
kshitijk4poor
2026-09-26 19:10:55 +05:30
committed by kshitij
parent 716efc89c0
commit 2506f801de

View File

@@ -448,9 +448,6 @@ def _ensure_windows_gateway_venv_imports() -> None:
if venv_key in seen:
continue
seen.add(venv_key)
# Only a venv built on this interpreter is ABI-safe to overlay.
if Path(sys.prefix).resolve() != resolved_venv:
continue
site_packages = resolved_venv / "Lib" / "site-packages"
if not site_packages.exists():