-
Stefy Lanza (nextime / spora ) authored
It reported "ready on cpu" while holding 9756 MiB of VRAM, 33 GB of host RAM and 1100% CPU. The cause was not the model and not the GPU: /cache had reached 11 MB free of 141 GB -- 15 GB of it pip's download cache from building these venvs, plus two 6 GB venvs put there by this code -- and HF_HOME is on that partition, so the shard download died with OSError: I/O error: IO Error: No space left on device (os error 28) the GPU load aborted part-way, and the fallback loaded the model again on the CPU. Everything about that was invisible: * The child's stderr was read only if it exited silently, so the reason sat in a pipe nobody drained -- which is also a pipe that fills, at which point the child blocks writing to it and looks like a model that hangs. It is now pumped into the engine log for the child's whole life. * "ready on cpu" said nothing about whether the CPU was asked for or fallen into, and the difference is 30x and tens of GB. The fallback now carries its reason (gpu_error) and the parent logs it loudly. * The aborted GPU load kept what it had already allocated for the life of the process: 9756 MiB that the manager's ledger could not see and nothing else could use. The card is now released (gc + empty_cache + ipc_collect) before the CPU retry. And the placement that caused it is fixed: a NEW venv goes on the roomiest candidate root, not the first one named. The engines' own CODERAI_CACHE_DIR is /AI/guffcache with 197 GB free while the default cache root had 15 GB; six GB has to go somewhere, and it should not be the fullest disk. An existing venv still wins over a roomier empty root, so nothing is built twice. One of this file's own tests was also writing a pointer file into the REAL config root, naming a pytest tmpdir, which a later process would then have resolved the venv from. Removed, and a test now fails if any test here calls ensure_installed() without redirecting _pointer_file. Co-Authored-By:Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014T3rZozi1Ehk96NG1WesgC
ec788475