fix(security-guidance): support Windows venv layout so the agentic reviewer works on win32 - #81426
Open
mholovetskyi wants to merge 1 commit into
Open
Conversation
…viewer works on win32 The SessionStart bootstrap (ensure_agent_sdk.py) hard-skipped Windows (SKIP_WIN32) because the consumer glob in llm.py only matched the POSIX venv layout (lib/python*/site-packages) and venv_py assumed bin/python. Net effect: the plugin's agentic commit-review layer was unavailable on Windows unless claude_agent_sdk happened to be system-installed. - llm.py (both fallback sites): also glob the Windows layout Lib/site-packages, which has no python* subdir - ensure_agent_sdk.py: select Scripts/python.exe on win32 and remove the early-return; the SKIP_WIN32 outcome code is retained (never emitted) so telemetry rows from older plugin versions keep their meaning Tested on Windows 11 (Python 3.13): - run 1: sdk_bootstrap=2 (BUILT) - venv created, SDK pip-installed - run 2: sdk_bootstrap=1 (NOOP_VENV) - existing venv detected - old glob matches [] on the built venv; new glob finds Lib/site-packages and claude_agent_sdk imports through it Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 26, 2026
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
security-guidance's strongest layer — the agentic commit reviewer — is unavailable on Windows unless
claude_agent_sdkhappens to be system-installed. The SessionStart bootstrap (hooks/ensure_agent_sdk.py) returnsSKIP_WIN32early, and the skip's own comment explains why: "Windows venv layout (Lib/site-packages, no python subdir) isn't handled by the consumer's glob."* The consumer fallbacks inhooks/llm.pyglob only the POSIX layout (lib/python*/site-packages), andvenv_pyassumedbin/python.This PR closes that annotated gap end-to-end rather than working around it.
Fix
llm.py(both SDK-fallback sites): additionally glob the Windows layoutLib/site-packages(nopython*subdir). On POSIX the extra glob matches nothing; on Windows the original glob matches nothing — no behavior change on either platform beyond enabling the intended fallback.ensure_agent_sdk.py: select the venv interpreter asScripts/python.exeon win32 (bin/pythonelsewhere) and remove the early-return. TheSKIP_WIN32outcome code is retained but never emitted, sosdk_bootstraptelemetry rows from older plugin versions keep their meaning; new Windows rows will now report the same BUILT/NOOP/BUILD_FAILED codes as POSIX, and the existingerr_phase/err_kindfingerprinting applies unchanged.Everything else in the bootstrap is already platform-neutral (the
O_EXCLsentinel lock, timeouts, pip invocation via the venv interpreter).Tested on Windows 11 (Python 3.13.14)
Bootstrap, run twice against a scratch
SECURITY_WARNINGS_STATE_DIR:Consumer glob, against the venv built above:
i.e. the pre-fix glob cannot see a Windows venv at all (confirming why the skip existed), and the new glob finds it and the SDK imports through it.
py_compilepasses on both files.Notes
ensure_agent_sdk,agent-sdk-venv,SKIP_WIN32,security-guidance windows); the existing Windows-related PRs (fix(security-guidance): normalize CLAUDE_PLUGIN_ROOT path separators on Windows #68694, fix(security-guidance): strip CRLF from Python version probe on Windows #68701, fix(security-guidance): use a cross-platform Python launcher #47502) address path separators, CRLF, and the launcher — not the venv bootstrap.platform:windowsis one of the largest open-issue label groups; this restores the plugin's headline feature for that entire user class.🤖 Generated with Claude Code