From 5e91c3a75c4d103bb657d42788d98e2c9e985378 Mon Sep 17 00:00:00 2001 From: StillKnotKnown <192589389+StillKnotKnown@users.noreply.github.com> Date: Thu, 15 Jan 2026 17:25:24 +0200 Subject: [PATCH] fix(frontend): pass CLAUDE_CLI_PATH to Python backend subprocess (ACS-230) (#1081) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): pass CLAUDE_CLI_PATH to Python backend subprocess Fixes ACS-230: Claude Code CLI not found despite being installed When the Electron app is launched from Finder/Dock (not from terminal), the Python subprocess doesn't inherit the user's shell PATH. This causes the Claude Agent SDK in the Python backend to fail finding the Claude CLI when it's installed via Homebrew at /opt/homebrew/bin/claude (macOS) or other non-standard locations. This fix: 1. Detects the Claude CLI path using the existing getToolInfo('claude') 2. Passes it to Python backend via CLAUDE_CLI_PATH environment variable 3. Respects existing CLAUDE_CLI_PATH if already set (user override) 4. Follows the same pattern as CLAUDE_CODE_GIT_BASH_PATH (Windows only) The Python backend (apps/backend/core/client.py) already checks CLAUDE_CLI_PATH first in find_claude_cli() (line 316), so no backend changes are needed. Related: PR #1004 (commit e07a0dbd) which added comprehensive CLI detection to the backend, but the frontend wasn't passing the detected path. Refs: ACS-230 * fix: correct typo in CLAUDE_CLI_PATH environment variable check Addressed review feedback on PR #1081: - Fixed typo: CLADE_CLI_PATH → CLAUDE_CLI_PATH (line 147) - This ensures user-provided CLAUDE_CLI_PATH overrides are respected - Previously the typo caused the check to always fail, ignoring user overrides The typo was caught by automated review tools (gemini-code-assist, sentry). Fixes review comments: - https://github.com/AndyMik90/Auto-Claude/pull/1081#discussion_r2691279285 - https://github.com/AndyMik90/Auto-Claude/pull/1081#discussion_r2691284743 --------- Co-authored-by: StillKnotKnown --- apps/frontend/src/main/agent/agent-process.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/frontend/src/main/agent/agent-process.ts b/apps/frontend/src/main/agent/agent-process.ts index b9448832..807d882b 100644 --- a/apps/frontend/src/main/agent/agent-process.ts +++ b/apps/frontend/src/main/agent/agent-process.ts @@ -140,9 +140,26 @@ export class AgentProcessManager { } } + // Detect and pass Claude CLI path to Python backend + // Common issue: Claude CLI installed via Homebrew at /opt/homebrew/bin/claude (macOS) + // or other non-standard locations not in subprocess PATH when app launches from Finder/Dock + const claudeCliEnv: Record = {}; + if (!process.env.CLAUDE_CLI_PATH) { + try { + const claudeInfo = getToolInfo('claude'); + if (claudeInfo.found && claudeInfo.path) { + claudeCliEnv['CLAUDE_CLI_PATH'] = claudeInfo.path; + console.log('[AgentProcess] Setting CLAUDE_CLI_PATH:', claudeInfo.path, `(source: ${claudeInfo.source})`); + } + } catch (error) { + console.warn('[AgentProcess] Failed to detect Claude CLI path:', error); + } + } + return { ...augmentedEnv, ...gitBashEnv, + ...claudeCliEnv, ...extraEnv, ...profileEnv, PYTHONUNBUFFERED: '1',