Skip to content

fix(mcp): silence the daemon-attach log by default (#618)#725

Merged
colbymchenry merged 1 commit into
mainfrom
fix/quiet-daemon-attach-log
Jun 8, 2026
Merged

fix(mcp): silence the daemon-attach log by default (#618)#725
colbymchenry merged 1 commit into
mainfrom
fix/quiet-daemon-attach-log

Conversation

@colbymchenry
Copy link
Copy Markdown
Owner

Summary

The "Attached to shared daemon" line is benign INFO, but it was written to process.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 to the shared daemon showed up in Claude Code (and others) as [error] [CodeGraph MCP] Attached to shared daemon on … (pid …, v…). followed by undefined. (The undefined is the host rendering the bare stderr line — codegraph never emits it.)

Fix

Route both attach sites (runProxy + connectWithHello) through one logAttachedDaemon() helper gated behind CODEGRAPH_MCP_LOG_ATTACH=1silent by default, opt-in for debugging. With the line gone, the host has nothing to render, so both the spurious [error] and the undefined disappear.

Tests

  • New daemon-attach-log.test.ts: silent by default; logs only when the env var is 1.
  • mcp-daemon.test.ts: the harness now opts into the log so the existing attach assertions still observe a successful attach (a per-test env still wins; the NO_DAEMON negative assertion is unaffected).
  • Full suite: 1261 passed, 0 failures.

Re-applies the approach from #640 by @mturac (closed in favor of this, since #640 had drifted out of date against main).

Closes #618.

🤖 Generated with Claude Code

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>
@colbymchenry colbymchenry merged commit 10defec into main Jun 8, 2026
@colbymchenry colbymchenry deleted the fix/quiet-daemon-attach-log branch June 8, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[error] [CodeGraph MCP] Attached to shared daemon on /Users/xxx/.codegraph/daemon.sock (pid 12163, v0.9.8). undefined

1 participant