fix(frontend): pass CLAUDE_CLI_PATH to Python backend subprocess (ACS-230) (#1081)

* 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 <stillknotknown@users.noreply.github.com>
This commit is contained in:
StillKnotKnown
2026-01-15 17:25:24 +02:00
committed by GitHub
parent 767dd5c3b0
commit 5e91c3a75c
@@ -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<string, string> = {};
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 { return {
...augmentedEnv, ...augmentedEnv,
...gitBashEnv, ...gitBashEnv,
...claudeCliEnv,
...extraEnv, ...extraEnv,
...profileEnv, ...profileEnv,
PYTHONUNBUFFERED: '1', PYTHONUNBUFFERED: '1',