The "Attached to shared daemon" line is benign INFO, but it was written to stderr — and MCP hosts render all server stderr at error level (and append an `undefined` data field), so on every session start a healthy attach showed up as `[error] … undefined`. It is now gated behind CODEGRAPH_MCP_LOG_ATTACH=1: silent by default, opt-in for debugging daemon attach. Both attach sites (runProxy + connectWithHello) route through one helper. The daemon integration tests opt the harness into the log so their attach assertions still observe a successful attach. Re-applies the approach from #640 by @mturac. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7fd8b4c185
commit
10defecc4b
@@ -52,7 +52,10 @@ function spawnServer(cwd: string, env: NodeJS.ProcessEnv = {}): SpawnedServer {
|
||||
const child = spawn(process.execPath, [BIN, 'serve', '--mcp'], {
|
||||
cwd,
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
env: { ...process.env, ...env },
|
||||
// #618: the daemon-attach log line is now off by default; opt the test
|
||||
// harness into it (CODEGRAPH_MCP_LOG_ATTACH=1) so the attach assertions
|
||||
// below can still observe a successful attach. A per-test env still wins.
|
||||
env: { CODEGRAPH_MCP_LOG_ATTACH: '1', ...process.env, ...env },
|
||||
}) as ChildProcessWithoutNullStreams;
|
||||
// Swallow spawn/EPIPE errors so killing a child mid-write can't surface as an
|
||||
// unhandled error that crashes the vitest worker.
|
||||
|
||||
Reference in New Issue
Block a user