fix(installer): resolve Antigravity codegraph command out of fnm's ephemeral per-shell dir#1444
Open
kevocodes wants to merge 1 commit into
Open
Conversation
…hemeral per-shell dir - resolveCodegraphCommand resolved `command -v codegraph`, which under fnm returns an ephemeral ~/.local/state/fnm_multishells/<pid>/bin path that fnm removes when the installing shell exits, leaving a dangling MCP command - realpath the containing directory so the written command survives shell exit - preserve the `codegraph` basename so agents that validate the command by basename still match - fall back to the raw resolved path if realpath fails
kevocodes
force-pushed
the
fix/antigravity-fnm-ephemeral-command-path
branch
from
July 24, 2026 16:29
029f6ea to
8d37eb2
Compare
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.
Overview
On macOS with fnm, the Antigravity installer writes an MCP
commandthat points into an ephemeral, per-shell directory. It works at install time but dangles once the installing shell exits, so Antigravity can no longer spawn the codegraph server.Fixes #1443.
Root cause
resolveCodegraphCommand()(src/installer/targets/antigravity.ts) resolves the absolute path viacommand -v codegraph. Under fnm, an interactive shell resolvescodegraphto~/.local/state/fnm_multishells/<pid>_<ts>/bin/codegraph— a symlink directory fnm creates per shell and removes when that shell exits. That path is written verbatim into~/.gemini/config/mcp_config.json.Change
Canonicalize the resolved path's containing directory with
fs.realpathSync, then re-join the basename:fnm_multishells/<pid>dir, so the written path outlives the installing shell. For fnm it yields~/.local/share/fnm/node-versions/<ver>/installation/bin/codegraph.codegraphbasename. Some agents validate the MCP command byfilepath.Base, so keeping the name matters — resolving the full path would land onnpm-shim.jsand break those checks.realpaththrows.Verification
npx tsc --noEmit— clean.npx vitest run __tests__/installer-targets.test.ts— 162/162 pass.command -v codegraph→~/.local/state/fnm_multishells/<pid>/bin/codegraph(dangles after the shell exits); after the change the written command resolves to the stablenode-versions/<ver>/installation/bin/codegraphand runs.Note on tests
Happy to add a regression test.
resolveCodegraphCommandisn't exported and the suite intentionally doesn't mockexecSync, so a deterministic test needs a small seam (export the function, or mockchild_process). Glad to go whichever way you prefer.