coding-agents: mcp-server.js exits silently when launched via a symlinked path (~/.hindsight symlink) — hindsight_* tools never load

Aperta Adatta ai principianti
#7,028 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
73/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
backend, devtools

Direzione di ricerca

Inizia con il controllo del punto di ingresso del modulo principale in dist/mcp-server.js e confronta il modo in cui Node segnala il percorso invocato con import.meta.url quando lo script viene avviato tramite un collegamento simbolico. Controlla se gli altri punti di ingresso di dist/*.js effettuano lo stesso controllo. Il lavoro è completato quando l’avvio tramite un collegamento simbolico avvia il server e una richiesta initialize restituisce una risposta; verifica anche gli altri punti di ingresso interessati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

integration:coding-agents

Summary

dist/mcp-server.js exits immediately with status 0 and no output when it is launched through a symlinked path. The installer writes exactly that kind of path into every harness config when ~/.hindsight is a symlink, so the hindsight_* tools silently disappear. Claude Code reports hindsight (CONNECTION_CLOSED): "Connection closed", and Codex, Cursor and Copilot CLI fail the same way. Hooks keep working, so memory injection looks healthy while the tools are missing.

Cause

The bundle only starts when it believes it is the main module:

if (process.argv[1] && process.argv[1] === fileURLToPath3(import.meta.url)) {
  main().catch(...)
}

Node resolves symlinks for the main module (unless --preserve-symlinks-main is set), so import.meta.url is the real path, while process.argv[1] is the path as typed. When any directory in the path is a symlink, the two differ, main() never runs, and the process exits cleanly.

Reproduce

# ~/.hindsight is a symlink, e.g. ~/.hindsight -> /data/hindsight/.hindsight
npx @vectorize-io/hindsight-coding-agents install claude-code   # 0.8.8
claude mcp get hindsight   # args: ~/.hindsight/coding-agents/dist/mcp-server.js -> fails to connect

printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}' \
  | node ~/.hindsight/coding-agents/dist/mcp-server.js
# -> no output, exit 0

printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize",...}' \
  | node "$(readlink -f ~/.hindsight/coding-agents/dist/mcp-server.js)"
# -> initialize result; tools/list returns all 8 hindsight_* tools

Environment: hindsight-coding-agents 0.8.8, Node v24.22.3, Linux. Self-hosted server, healthy throughout.

Suggested fix

Compare real paths in the entry check, for example:

import { realpathSync } from "node:fs";
const self = fileURLToPath(import.meta.url);
const invoked = process.argv[1] && realpathSync(process.argv[1]);
if (invoked === self) main().catch(...);

Alternatively, have the installer write realpath of the runtime into harness configs. The same entry check probably exists in the other dist/*.js entry points and is worth fixing everywhere. A non-zero exit with a message when main() is skipped would also have made this much easier to spot.

Workaround

Point the harness configs at the resolved path (readlink -f ~/.hindsight/coding-agents/dist/mcp-server.js). A later install may write the symlinked path back.

Lingua principale
Python
Stelle
45.2k
Fork
5.9k
Merge medio
5h 46m
PR unite (30g)
389

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vectorize-io/hindsight

Tutte le issue di vectorize-io/hindsight

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.