Skip to content

datamate-cli.js opens as an editor tab when launching sessions (stdio MCP spawn loses ELECTRON_RUN_AS_NODE) #1082

Description

@ralphstodomingo

Bug

When a project's IDE MCP config (.vscode/mcp.json) has a datamate stdio entry written by the VS Code extension, launching an Altimate Code session on a desktop editor can suddenly open dist/datamate-cli.js as an editor tab, and the datamate MCP server fails with MCP error -32000: Connection closed. Once it starts happening, it repeats on every session launch.

Root cause

On desktop editors the IDE entry's command is the editor's Electron binary, and the entry's env block carries ELECTRON_RUN_AS_NODE=1 so the binary runs as Node. datamate_manager add reuses the entry's command + args but drops the env block — both in the immediate spawn and in the entry it persists to .altimate-code/altimate-code.json. Spawned without the flag, Electron boots the editor GUI and opens the script path as a document instead of executing it. The healing sync that would repair the persisted entry only runs on altimate serve boot, never in the TUI or run, so the broken entry never self-repairs for terminal users.

Steps to reproduce

  1. In a project where the VS Code extension has written a datamate stdio entry to .vscode/mcp.json (desktop editor, so command is the Electron binary with env: {"ELECTRON_RUN_AS_NODE": "1"}), run Altimate Code in the terminal.
  2. Use datamate_manager operation add to connect a datamate.
  3. The CLI file opens as an editor tab and the tool reports MCP error -32000: Connection closed; .altimate-code/altimate-code.json now has a datamate entry with no environment block.
  4. Any later session launch in that project re-spawns the broken entry and pops the file again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions