Skip to content

CLI: silence noisy ENOENT log when daemon socket is absent#3322

Merged
youknowriad merged 1 commit intotrunkfrom
claude/busy-bell-853eaf
May 3, 2026
Merged

CLI: silence noisy ENOENT log when daemon socket is absent#3322
youknowriad merged 1 commit intotrunkfrom
claude/busy-bell-853eaf

Conversation

@youknowriad
Copy link
Copy Markdown
Contributor

Related issues

  • Related to user-reported noise mid-session in studio code

How AI was used in this PR

Investigated the source of an in-session log line, identified the over-eager console.error in isProcessRunning, and gated it behind the existing isRecoverableConnectError helper.

Proposed Changes

  • In apps/cli/lib/daemon-client.ts, suppress the console.error in isProcessRunning() for recoverable connect errors (ENOENT/ECONNREFUSED/EPIPE). Non-recoverable errors still log. The function continues to return undefined either way, so the agent's user-facing "Site is not running" message is unchanged.

Why

When the process-manager daemon isn't running yet, attempting to connect to ~/.studio/daemon/daemon.sock fails with ENOENT. connectToDaemon() already treats this as a recoverable condition and auto-spawns the daemon — but if the recovery path itself surfaces an error to isProcessRunning, that error gets logged as Error checking if process studio-site-… is running: Error: connect ENOENT …. This noise shows up mid-session in studio code (e.g. when the agent calls wp_cli_run and the site server isn't up yet), even though the situation is benign and the tool already returns a clear "Site is not running" message to the user.

Testing Instructions

  • Run studio code against a session where a site is not currently running, then ask the agent to run a WP-CLI command on that site (e.g. Run wp eval ...).
  • Before this change: the session shows Error checking if process studio-site-<id> is running: Error: connect ENOENT /Users/<you>/.studio/daemon/daemon.sock immediately above the agent's Site "<name>" is not running. Start it first using site_start. message.
  • After this change: only the Site "<name>" is not running message appears; no preceding console.error line.
  • npm test -- apps/cli/lib/tests/daemon-client.test.ts continues to pass.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

isProcessRunning() logged every connect failure, including the recoverable
ENOENT/ECONNREFUSED/EPIPE cases that just mean the process-manager daemon
isn't running yet. That noise shows up mid-session in `studio code` (e.g.
when the agent calls wp_cli_run before the site server is started).

Skip the log for recoverable connect errors, matching the existing
isRecoverableConnectError check used elsewhere in this file. The function
still returns undefined either way, so the agent's user-facing
"Site is not running" message is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wpmobilebot
Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing b7ca4c5 vs trunk

app-size

Metric trunk b7ca4c5 Diff Change
App Size (Mac) 1557.90 MB 1557.90 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk b7ca4c5 Diff Change
load 1528 ms 1508 ms 20 ms ⚪ 0.0%

site-startup

Metric trunk b7ca4c5 Diff Change
siteCreation 8088 ms 8086 ms 2 ms ⚪ 0.0%
siteStartup 4953 ms 4951 ms 2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@youknowriad youknowriad merged commit 4bd088b into trunk May 3, 2026
11 checks passed
@youknowriad youknowriad deleted the claude/busy-bell-853eaf branch May 3, 2026 12:32
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.

2 participants