fix(glean-core): resolve HOME via os.homedir() so session-start works on Windows#30
Open
almacd35712 wants to merge 1 commit into
Open
Conversation
The session-start hook used $HOME inside a node -e snippet to require ~/.claude.json. On Windows under Git Bash, $HOME expands to a Unix-style path (e.g. /c/Users/foo) which Node on Windows cannot require(), so the check throws, exits 1, and the 'Glean is installed but no MCP server is configured' message fires on every session — even when a Glean server is in fact configured. Resolve the home directory inside Node via os.homedir() instead, which returns a platform-correct path everywhere.
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.
Summary
The
glean-coreSessionStart hook prints "Glean is installed but no MCP server is configured" on every session under Windows + Git Bash, even when a Glean MCP server is in fact configured and connected.Root cause:
plugins/glean-core/scripts/session-start.shrunsnode -e "const c=require('$HOME/.claude.json'); ..."Under Git Bash on Windows,
$HOMEexpands to a Unix-style path like/c/Users/foo. Node on Windows cannot resolve that path withrequire(), so the snippet throwsMODULE_NOT_FOUND, exits 1, and the hook falls through to emitting thesession-unconfigured.txttemplate.This PR resolves the home directory inside Node via
os.homedir(), which returns a platform-correct absolute path on every OS. Behavior on macOS/Linux is unchanged.Reproduction
On Windows + Git Bash with
glean_defaultconfigured in~/.claude.json:After the fix:
(silent, as expected when configured).
Test plan
~/.claude.json, the script exits 0 silently.os.homedir()form behaves identically to the prior$HOMEform (no behavior change expected).