Repository navigation
Conversation
On Windows, nvidia-smi prints "Failed to initialize NVML: Unknown Error" and exits 255 when ProgramFiles and ProgramW6432 are both unset. MCP clients start servers with a minimal inherited environment that lacks both (the Python SDK's get_default_environment), so free VRAM read as unknown and warm refused with free_unknown. In-process NVML works under the same environment. When neither variable is set, nvidia-smi now gets ProgramFiles from the registry (HKLM ...\CurrentVersion\ProgramFilesDir). Otherwise it inherits the server's environment unchanged. Reported by codex:hermes-realtime. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2ENBkHd7pik2TTJnhBHnh
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Problem
A vram-mcp server started by an MCP client on Windows can't read free VRAM:
nvidia-smiprintsFailed to initialize NVML: Unknown Errorand exits 255.warmthen refuses withfree_unknown(#47), andpressurereadsunknown.The cause is the environment. The MCP Python SDK's
get_default_environment()passes only a short list of variables (APPDATA, HOMEDRIVE, HOMEPATH, LOCALAPPDATA, PATH, PATHEXT, SYSTEMROOT, TEMP, USERPROFILE, ...).nvidia-smifails whenever bothProgramFilesandProgramW6432are unset. Bisected on the RTX 3090 desktop by adding each of the other variables to that minimal set in turn: only those two fix it. AddingWINDIR/PROGRAMDATA, or leaving out Hermes's Job object, does not, as Hermes confirmed separately. In-process NVML (pynvml) works under the same minimal environment.Reported by the Hermes lane: its pinned server's first
warmstopped withfree_unknown, and the audit detail readnvidia-smi exited with status 255.Change
When neither variable is set on Windows,
gpu._rungivesnvidia-smiProgramFilesfrom the registry (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir). Otherwise, and off Windows, it inherits the server's environment unchanged.Validation
python -m pytest tests/test_gpu.py -q: 19 passed, 4 of them new.observe_gpu(0)in a child process with the SDK's minimal environment:nvidia-smi exited with status 255free_mb10377Workaround until this is deployed: add
ProgramFilesto the server'senvin the MCP client config.🤖 Generated with Claude Code
https://claude.ai/code/session_01V2ENBkHd7pik2TTJnhBHnh