Repository navigation
Conversation
Windows gateway runs use the PM store python, and activation pops VIRTUAL_ENV, so _ensure_windows_gateway_venv_imports fell through to the pre-PM in-tree <root>/venv and inserted its site-packages at sys.path[0]. That tree is built for a different interpreter, so its pure-Python packages imported fine while their compiled submodules could not load: RuntimeError: Failed to initialize OpenAI client: ModuleNotFoundError: No module named 'pydantic_core' Every gateway agent turn failed (Telegram replied with the error text) while the adapters themselves stayed healthy, and the supervised tui_gateway worker died five times in a row on the same import. Resolve the committed PM generation first (pm.environments.committed_venv is the committed-environment contract, invisible to sys.prefix/VIRTUAL_ENV), and gate every fallback candidate on the running interpreter's ABI so no foreign tree can reach sys.path.
SummaryThis PR gates gateway venv adoption behind an ABI check, which is the right direction, but the gate as written does not fire for the venvs that actually exist in the wild, and the two tests that would have caught that are vacuous. The core change is in The headline: the parser looks for the Findings1. [blocker] The ABI guard only parses
|
Noting for the record as this closes: the blocker from my review is still the final state of the branch. The last commit is The headline, restated so it is actionable without my review: The check is one condition in the right place, and parsing both keys would close it. If you have decided the underlying hazard is handled elsewhere, that is a reasonable position and no reply is needed — I only want to make sure the silence is not read as agreement. Also fine to note: |
Symptom
On a Windows package-manager install, the gateway connected to every platform and then failed every agent turn. Telegram replied with the raw error text:
The supervised
tui_gatewayworker (tui_gateway.server, which imports pydantic) died five times in a row on the same import.Root cause
The gateway deliberately runs the package manager's store interpreter, and activation pops
VIRTUAL_ENV._ensure_windows_gateway_venv_imports()therefore fell through to the pre-PM in-tree<root>/venv— a tree built for a different interpreter — and prepended itssite-packagestosys.pathwith no interpreter check:Pure-Python distribution contents imported fine, so the adapters stayed healthy and Telegram still connected — but every compiled submodule raised. A
cp311pydantic_core*.pydcannot load into acp314interpreter, and the foreign tree shadowed the correct one atsys.path[0].Fix
pm.environments.committed_venvfirst. The committed generation is the contract for "which environment this install is running" and is invisible tosys.prefix/VIRTUAL_ENV, so it must win before any fallback._windows_venv_matches_running_python, readingpyvenv.cfg) so a foreign tree can never reachsys.path.Tests
tests/gateway/test_gateway_venv_imports.py— 8 contract tests:venv;VIRTUAL_ENVis refused;venvis still adopted (backward compatibility);pyvenv.cfgthat cannot be read is not treated as a match-by-default.Verification
On the affected install (store CPython 3.14 plus a cp311 in-tree
venv):process_bootstrap.OpenAI(...), in the gateway's launch environmentModuleNotFoundError: No module named 'pydantic_core'tui_gatewayworker at boot