Skip to content

Antigravity installer writes an ephemeral fnm per-shell path as the MCP command #1443

Description

@kevocodes

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)

  1. command -v codegraph~/.local/state/fnm_multishells/77232_.../bin/codegraph
  2. Install the Antigravity target — that path is written as the MCP command.
  3. Close the shell; the fnm_multishells/77232_... directory is gone.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions