Description
On macOS with fnm managing Node, installing the Antigravity target writes an MCP command that points into an ephemeral, per-shell directory. It's valid at install time but becomes dangling once the installing shell exits, so Antigravity can no longer spawn the codegraph MCP server.
Root cause
resolveCodegraphCommand() in src/installer/targets/antigravity.ts resolves the absolute path via command -v codegraph. Under fnm, an interactive shell resolves codegraph to ~/.local/state/fnm_multishells/<pid>_<ts>/bin/codegraph — a symlink directory fnm creates per shell and removes when that shell exits. That ephemeral path is written verbatim into ~/.gemini/config/mcp_config.json.
Steps to reproduce (macOS + fnm, codegraph 1.5.0)
command -v codegraph → ~/.local/state/fnm_multishells/77232_.../bin/codegraph
- Install the Antigravity target — that path is written as the MCP
command.
- Close the shell; the
fnm_multishells/77232_... directory is gone.
- The
command now points at a non-existent path → Antigravity can't launch the server.
Expected: a stable absolute path that survives shell exit.
Actual: an ephemeral per-shell path that dangles after the installing shell closes.
Proposed fix
Canonicalize the resolved path out of the ephemeral directory while keeping the codegraph binary name:
if (resolved && fs.existsSync(resolved)) {
try {
return path.join(fs.realpathSync(path.dirname(resolved)), path.basename(resolved));
} catch {
return resolved;
}
}
For fnm this yields ~/.local/share/fnm/node-versions/<ver>/installation/bin/codegraph — stable, and path.basename stays codegraph (so agents that validate the command by basename still match). Happy to open a PR if this looks right.
Environment
- OS: macOS (darwin arm64)
- codegraph: 1.5.0
- Node manager: fnm
- Agent: Google Antigravity
- Shell: zsh
Description
On macOS with fnm managing Node, installing the Antigravity target writes an MCP
commandthat points into an ephemeral, per-shell directory. It's valid at install time but becomes dangling once the installing shell exits, so Antigravity can no longer spawn the codegraph MCP server.Root cause
resolveCodegraphCommand()insrc/installer/targets/antigravity.tsresolves 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 ephemeral path is written verbatim into~/.gemini/config/mcp_config.json.Steps to reproduce (macOS + fnm, codegraph 1.5.0)
command -v codegraph→~/.local/state/fnm_multishells/77232_.../bin/codegraphcommand.fnm_multishells/77232_...directory is gone.commandnow points at a non-existent path → Antigravity can't launch the server.Expected: a stable absolute path that survives shell exit.
Actual: an ephemeral per-shell path that dangles after the installing shell closes.
Proposed fix
Canonicalize the resolved path out of the ephemeral directory while keeping the
codegraphbinary name:For fnm this yields
~/.local/share/fnm/node-versions/<ver>/installation/bin/codegraph— stable, andpath.basenamestayscodegraph(so agents that validate the command by basename still match). Happy to open a PR if this looks right.Environment