Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix External Claude CLI availability#293

Merged
kesslerio merged 2 commits into
mainfrom
feature/issue-263-claude-cli
Oct 25, 2025
Merged

Fix External Claude CLI availability#293
kesslerio merged 2 commits into
mainfrom
feature/issue-263-claude-cli

Conversation

@kesslerio
Copy link
Copy Markdown
Owner

Summary

  • reset PRReviewTool detection state and run real --version to capture binary paths
  • relax CLAUDE_CLI_NAME handling to allow absolute overrides without blowing up logging
  • document discovery/fallback flow so integration behaviour is traceable

Testing

  • pytest --no-cov tests/test_claude_code_integration.py
  • pytest --no-cov tests/unit/test_claude_integration_issue_240.py
  • pytest --no-cov tests/unit/test_enhanced_claude_integration.py
  • pytest --no-cov tests/unit/test_pr_review_external_claude.py
  • pytest --no-cov tests/integration/test_external_claude_integration.py
  • pytest --no-cov tests/unit/test_external_claude_integration_unit.py

@kesslerio kesslerio self-assigned this Oct 25, 2025
@kesslerio
Copy link
Copy Markdown
Owner Author

@claude @codex review

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Oct 25, 2025

Claude finished @kesslerio's task —— View job


Code Review Complete

Tasks

  • Read repository guidelines (CLAUDE.md)
  • Analyze PR diff changes
  • Review documentation updates
  • Review implementation changes
  • Provide comprehensive feedback

Review Summary

This PR fixes the External Claude CLI availability detection by resetting state properly and improving the fallback logic. The changes are well-structured and address a real issue with CLI detection. However, there are several areas that need attention before merging.

Critical Issues ⚠️

1. Missing Import Statement (src/vibe_check/tools/legacy/review_pr_monolithic_backup.py:496)

Issue: shutil is imported at line 196 but only used later at line 519. The import is present, but there's a logical issue:

# Line 519 uses shutil.which() but...
resolved_cmd = shutil.which(candidate_cmd) or candidate_cmd

However, at line 489, _find_claude_cli() is called which itself uses shutil internally. If the shutil import at line 196 wasn't there previously, this would have failed.

Status: Actually okay - I see the import import shutil at line 22 in the diff. This is correct.

2. Incomplete Import Change (src/vibe_check/tools/shared/enhanced_claude_integration.py:24-25)

Issue: The import was changed from:

from vibe_check.tools.contextual_documentation import (
    get_context_manager,
    AnalysisContext,
)

To:

from vibe_check.tools import contextual_documentation
from vibe_check.tools.contextual_documentation import AnalysisContext

But this creates redundancy - you're importing the module AND one of its members. This is inconsistent:

Fix: Either use:

from vibe_check.tools import contextual_documentation
# Then use: contextual_documentation.get_context_manager()
# And: contextual_documentation.AnalysisContext

OR:

from vibe_check.tools.contextual_documentation import get_context_manager, AnalysisContext

The current approach mixes both styles, which violates the CLAUDE.md guideline: "Imports: Standard → Third-party → Local"

3. Error Handling Inconsistency (src/vibe_check/tools/shared/claude_integration.py:206-236)

Concern: The CLAUDE_CLI_NAME handling has improved but still has a subtle issue:

if os.path.isabs(custom_cli_env):
    expanded_custom = os.path.expanduser(custom_cli_env)
    if os.path.exists(expanded_custom):
        if os.access(expanded_custom, os.X_OK):
            logger.info(...)
        else:
            logger.warning(f"[Warning] Custom Claude CLI path not executable: {expanded_custom}")
        return expanded_custom  # ← Returns even if not executable!

Issue: When the path exists but is NOT executable, you still return it. This will cause a PermissionError later during subprocess execution.

Fix: Should return None or the default cli_name when not executable, or handle this more explicitly in the calling code.

High Priority Issues 📋

4. Redundant --version Check (src/vibe_check/tools/legacy/review_pr_monolithic_backup.py:500-515)

The _check_claude_availability() method now runs claude --version to validate the binary:

result = subprocess.run(
    [candidate_cmd, "--version"],
    capture_output=True,
    text=True,
    timeout=5,
    check=True,  # ← Will raise on non-zero exit
)

Issue: The check=True parameter means subprocess.run() will raise CalledProcessError on non-zero exit codes. This is caught in the exception handler, but there's no differentiation between:

  • Binary not found (FileNotFoundError)
  • Binary found but failed --version (CalledProcessError)
  • Binary found but permission denied (PermissionError)

Suggestion: Log the actual exit code and stderr to help debug WHY the version check failed. Something like:

except subprocess.CalledProcessError as exc:
    logger.warning(
        "⚠️ Claude CLI --version failed (exit %d): %s - using fallback",
        exc.returncode,
        exc.stderr or exc.stdout
    )

5. Documentation Clarity (docs/EXTERNAL_CLAUDE.md:33-44)

The new documentation section "Availability Checks and Fallback Flow" is excellent, but step 4 is unclear:

4. **Tool hand-off** – when validation succeeds we surface the resolved
   command through `PRReviewTool.claude_cmd` for backwards-compatible tests and
   monitoring.

Issue: What does "surface the resolved command" mean? Does it set PRReviewTool.claude_cmd? If so, clarify:

Suggestion:

4. **Tool hand-off** – when validation succeeds, `PRReviewTool.claude_cmd` 
   is set to the resolved binary path for backwards-compatible tests and monitoring.

6. State Reset Documentation (docs/EXTERNAL_CLAUDE.md:33-44)

The PR summary mentions "reset PRReviewTool detection state" but the documentation doesn't explain WHY this is necessary or WHEN state would be stale.

Suggestion: Add a note explaining:

**State Reset**: The `claude_cmd` attribute is reset to `None` at the start of 
each availability check to prevent stale cached values from previous checks.

Code Quality Issues 💡

7. Function Length Compliance (CLAUDE.md Rule: Functions <40 lines)

The _check_claude_availability() method in review_pr_monolithic_backup.py is now 61 lines (475-531), which violates the CLAUDE.md guideline:

  1. Files <700 lines, functions <40 lines

Suggestion: Extract the version validation logic into a separate helper method:

def _validate_claude_binary(self, candidate_cmd: str) -> bool:
    """Validate Claude CLI binary by running --version."""
    try:
        result = subprocess.run(
            [candidate_cmd, "--version"],
            capture_output=True,
            text=True,
            timeout=5,
            check=True,
        )
        logger.debug("Claude CLI version: %s", result.stdout.strip())
        return True
    except (subprocess.CalledProcessError, FileNotFoundError, PermissionError) as exc:
        logger.warning("Claude CLI validation failed: %s", exc)
        return False

8. Type Hints Missing (CLAUDE.md: "Type hints: Mandatory for all functions")

The _check_claude_availability() method has a return type annotation (good!), but some intermediate variables lack type clarity:

resolved_cmd = candidate_cmd  # Type unclear from context
if not os.path.isabs(candidate_cmd):
    resolved_cmd = shutil.which(candidate_cmd) or candidate_cmd

Suggestion: Add inline type comment or make the logic clearer:

resolved_cmd: str = candidate_cmd
if not os.path.isabs(candidate_cmd):
    resolved_cmd = shutil.which(candidate_cmd) or candidate_cmd

9. Logging Consistency (src/vibe_check/tools/shared/claude_integration.py:228-234)

The logging when CLAUDE_CLI_NAME has a relative path is inconsistent:

elif "/" in custom_cli_env or "\\\\" in custom_cli_env:
    logger.warning(
        f"[Warning] Ignoring CLAUDE_CLI_NAME={custom_cli_env} because relative paths are not supported"
    )

Issue: The message says "Ignoring" but the code then falls through to cli_name = custom_cli_env at line 236, which means it's NOT actually ignored for simple relative names like ./claude.

Fix: The logic should be:

elif "/" in custom_cli_env or "\\\\" in custom_cli_env:
    logger.warning(...)
    # Don't set cli_name - actually ignore it
else:
    cli_name = custom_cli_env

Positive Aspects ✅

  1. Excellent Documentation: The new EXTERNAL_CLAUDE.md section clearly explains the detection pipeline
  2. State Reset: Properly resets claude_cmd = None before checking (line 476)
  3. Better Error Handling: Catches specific exceptions (CalledProcessError, FileNotFoundError, PermissionError)
  4. Improved Logging: Uses structured logging with context about why checks fail
  5. Test Coverage: The PR includes comprehensive test file mentions

Recommendations

Must Fix Before Merge:

  1. ✅ Fix the import redundancy in enhanced_claude_integration.py (Issue Test: Claude lint workflow #2)
  2. ✅ Fix the executable check return logic in claude_integration.py (Issue #3)
  3. ✅ Fix the relative path handling in claude_integration.py (Issue Phase 1.1: Implement core PatternDetector class #9)

Should Fix (Can be follow-up):

  1. 📋 Break _check_claude_availability() into smaller functions (Issue Phase 0.1: Create standalone pattern detection validation scripts #7)
  2. 📋 Improve version check error logging (Issue Test: Claude lint workflow (fixed) #4)
  3. 📋 Clarify documentation wording (Issues Implement PRD & Engineering Plan Review Scripts #5, Feature: Enhanced PRD & Engineering Plan Review Scripts with MCP Research Tools #6)

Nice to Have:

  1. 💡 Add type hints for clarity (Issue Phase 0.2: Validate detection accuracy with real-world examples #8)

Verdict

Status: Needs changes before merge ⚠️

The PR addresses a real issue with Claude CLI detection, but has critical import and error handling issues that should be fixed. The overall approach is sound, and the documentation improvements are excellent.


|

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kesslerio
Copy link
Copy Markdown
Owner Author

Thanks for the sweep! Most of the earlier flags were already covered, but I pushed two concrete tweaks:

  • expanded the fallback warning to log the exit code + stderr so we can see why validation failed in CI ()
  • clarified EXTERNAL_CLAUDE.md that we reset each probe and store the resolved path after validation ()

Everything else—CLAUDE_CLI_NAME handling, mixed imports, relative path fallbacks—was behaving as intended. Re-ran the targeted pytest modules for sanity:

============================= test session starts ==============================
platform darwin -- Python 3.12.9, pytest-8.4.1, pluggy-1.6.0 -- /Users/kesslerio/.pyenv/versions/3.12.9/bin/python3.12
cachedir: .pytest_cache
metadata: {'Python': '3.12.9', 'Platform': 'macOS-15.7-arm64-arm-64bit', 'Packages': {'pytest': '8.4.1', 'pluggy': '1.6.0'}, 'Plugins': {'anyio': '4.9.0', 'html': '4.1.1', 'xdist': '3.8.0', 'json-report': '1.5.0', 'timeout': '2.4.0', 'metadata': '3.1.1', 'Faker': '37.8.0', 'clarity': '1.0.1', 'cov': '6.2.1', 'mock': '3.14.1', 'typeguard': '2.13.3', 'sugar': '1.1.1', 'benchmark': '5.1.0', 'asyncio': '1.0.0'}}
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /Users/kesslerio/GDrive/Projects/vibe-check-mcp
configfile: pytest.ini
plugins: anyio-4.9.0, html-4.1.1, xdist-3.8.0, json-report-1.5.0, timeout-2.4.0, metadata-3.1.1, Faker-37.8.0, clarity-1.0.1, cov-6.2.1, mock-3.14.1, typeguard-2.13.3, sugar-1.1.1, benchmark-5.1.0, asyncio-1.0.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collecting ... collected 6 items

tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_code_availability_real PASSED [ 16%]
tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_pr_review_tool_detects_claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:04 [ INFO] vibe_check.tools.legacy.review_pr_monolithic_backup: 🔍 Checking external Claude CLI integration availability...
2025-10-25 14:41:05 [ INFO] vibe_check.tools.legacy.review_pr_monolithic_backup: ✅ External Claude CLI integration available at /Users/kesslerio/.claude/local/claude
PASSED [ 33%]
tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_docker_environment_detection
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:05 [ INFO] vibe_check.tools.legacy.review_pr_monolithic_backup: 🔍 Checking external Claude CLI integration availability...
2025-10-25 14:41:05 [ INFO] vibe_check.tools.legacy.review_pr_monolithic_backup: 🐳 Running in Docker container - external Claude CLI not available, using fallback analysis
PASSED [ 50%]
tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_command_execution PASSED [ 66%]
tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_fallback_when_claude_unavailable
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:05 [ INFO] vibe_check.tools.legacy.review_pr_monolithic_backup: 🔍 Checking external Claude CLI integration availability...
2025-10-25 14:41:05 [ WARNING] vibe_check.tools.legacy.review_pr_monolithic_backup: ⚠️ External Claude CLI validation failed (claude not found) - using fallback analysis
PASSED [ 83%]
tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_with_project_flag PASSED [100%]

============================= slowest 10 durations =============================
0.63s call tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_pr_review_tool_detects_claude
0.53s call tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_code_availability_real
0.38s call tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_command_execution
0.37s call tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_with_project_flag
0.03s setup tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_code_availability_real
0.01s teardown tests/test_claude_code_integration.py::TestClaudeCodeIntegration::test_claude_code_availability_real

(4 durations < 0.005s hidden. Use -vv to show these durations.)
============================== 6 passed in 1.99s ===============================
============================= test session starts ==============================
platform darwin -- Python 3.12.9, pytest-8.4.1, pluggy-1.6.0 -- /Users/kesslerio/.pyenv/versions/3.12.9/bin/python3.12
cachedir: .pytest_cache
metadata: {'Python': '3.12.9', 'Platform': 'macOS-15.7-arm64-arm-64bit', 'Packages': {'pytest': '8.4.1', 'pluggy': '1.6.0'}, 'Plugins': {'anyio': '4.9.0', 'html': '4.1.1', 'xdist': '3.8.0', 'json-report': '1.5.0', 'timeout': '2.4.0', 'metadata': '3.1.1', 'Faker': '37.8.0', 'clarity': '1.0.1', 'cov': '6.2.1', 'mock': '3.14.1', 'typeguard': '2.13.3', 'sugar': '1.1.1', 'benchmark': '5.1.0', 'asyncio': '1.0.0'}}
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /Users/kesslerio/GDrive/Projects/vibe-check-mcp
configfile: pytest.ini
plugins: anyio-4.9.0, html-4.1.1, xdist-3.8.0, json-report-1.5.0, timeout-2.4.0, metadata-3.1.1, Faker-37.8.0, clarity-1.0.1, cov-6.2.1, mock-3.14.1, typeguard-2.13.3, sugar-1.1.1, benchmark-5.1.0, asyncio-1.0.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collecting ... collected 16 items

tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_find_claude_cli_prefers_local_path
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
PASSED [ 6%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_find_claude_cli_logs_environment
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Custom Claude CLI path not found: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ WARNING] vibe_check.tools.shared.claude_integration: [Warning] Claude CLI not found at local user path: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Found "claude" in PATH at: /usr/local/bin/claude
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Custom Claude CLI path not found: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ WARNING] vibe_check.tools.shared.claude_integration: [Warning] Claude CLI not found at local user path: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Found "claude" in PATH at: /usr/local/bin/claude
PASSED [ 12%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_find_claude_cli_not_executable
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
PASSED [ 18%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_find_claude_cli_not_found_logs_error
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ WARNING] vibe_check.tools.shared.claude_integration: [Warning] Claude CLI not found at local user path: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ WARNING] vibe_check.tools.shared.claude_integration: [Warning] Claude CLI not found at local user path: /Users/kesslerio/.claude/local/claude
PASSED [ 25%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_sync_file_not_found_error
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI directly for task: general
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Claude CLI executable not found: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Current PATH: /Users/kesslerio/.pyenv/versions/3.12.9/bin:/opt/homebrew/Cellar/pyenv/2.5.4/libexec:/opt/homebrew/Cellar/pyenv/2.5.4/plugins/python-build/bin:/Users/kesslerio/.pyenv/shims:/Users/kesslerio/opt/anaconda3/bin:/usr/local/opt/[email protected]/bin:/opt/homebrew/bin:/usr/local/opt/ruby/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/var/folders/lw/83_wpdv92g5ff57h6hflw6wr0000gp/T/.tmpyUtB3s:/Users/kesslerio/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/vendor/aarch64-apple-darwin/path:/Users/kesslerio/Library/pnpm:/.local/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.4/shims:/Users/kesslerio/.nvm/versions/node/v22.14.0/bin:/Users/kesslerio/.bun/bin:/Users/kesslerio/.codeium/windsurf/bin:/opt/homebrew/bin:/Users/kesslerio/opt/anaconda3/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/kesslerio/.windsurf/extensions/ms-python.debugpy-2025.14.1-darwin-arm64/bundled/scripts/noConfigScripts:/Users/kesslerio/.local/bin:/Users/kesslerio/cmdline-tools/latest/bin:/Users/kesslerio/platform-tools
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Working directory: /Users/kesslerio/GDrive/Projects/vibe-check-mcp
PASSED [ 31%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_sync_permission_error
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI directly for task: general
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Permission denied executing Claude CLI: /Users/kesslerio/.claude/local/claude
PASSED [ 37%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_sync_exit_code_127_analysis
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI directly for task: general
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Claude CLI failed with exit code 127
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Command: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Working directory: /Users/kesslerio
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Full stderr: claude: command not found
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Troubleshooting: Claude CLI not found at /Users/kesslerio/.claude/local/claude. Install Claude CLI or set CLAUDE_CLI_NAME environment variable.
PASSED [ 43%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_sync_authentication_error_analysis
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI directly for task: general
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Claude CLI failed with exit code 1
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Command: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Working directory: /Users/kesslerio
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Full stderr: Authentication failed: Invalid API key
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Troubleshooting: Authentication failed. Run 'claude login' or check ANTHROPIC_API_KEY.
PASSED [ 50%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_sync_enhanced_logging
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI directly for task: general
PASSED [ 56%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_async_file_not_found_error
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI async for task: general
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Claude CLI executable not found: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Current PATH: /Users/kesslerio/.pyenv/versions/3.12.9/bin:/opt/homebrew/Cellar/pyenv/2.5.4/libexec:/opt/homebrew/Cellar/pyenv/2.5.4/plugins/python-build/bin:/Users/kesslerio/.pyenv/shims:/Users/kesslerio/opt/anaconda3/bin:/usr/local/opt/[email protected]/bin:/opt/homebrew/bin:/usr/local/opt/ruby/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/var/folders/lw/83_wpdv92g5ff57h6hflw6wr0000gp/T/.tmpyUtB3s:/Users/kesslerio/.nvm/versions/node/v22.14.0/lib/node_modules/@openai/codex/vendor/aarch64-apple-darwin/path:/Users/kesslerio/Library/pnpm:
/.local/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.4/shims:/Users/kesslerio/.nvm/versions/node/v22.14.0/bin:/Users/kesslerio/.bun/bin:/Users/kesslerio/.codeium/windsurf/bin:/opt/homebrew/bin:/Users/kesslerio/opt/anaconda3/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/kesslerio/.windsurf/extensions/ms-python.debugpy-2025.14.1-darwin-arm64/bundled/scripts/noConfigScripts:/Users/kesslerio/.local/bin:/Users/kesslerio/cmdline-tools/latest/bin:/Users/kesslerio/platform-tools
PASSED [ 62%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_async_permission_error
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI async for task: general
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Permission denied executing Claude CLI: /Users/kesslerio/.claude/local/claude
PASSED [ 68%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_find_claude_cli_limited_path_environment
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ WARNING] vibe_check.tools.shared.claude_integration: [Warning] Claude CLI not found at local user path: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ WARNING] vibe_check.tools.shared.claude_integration: [Warning] Claude CLI not found at local user path: /Users/kesslerio/.claude/local/claude
PASSED [ 75%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_sync_includes_troubleshooting_in_error
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
-------------------------------- live log call ---------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: Executing Claude CLI directly for task: general
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Claude CLI failed with exit code 1
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Command: /Users/kesslerio/.claude/local/claude
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Working directory: /Users/kesslerio
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Full stderr: Error executing Claude CLI
2025-10-25 14:41:08 [ ERROR] vibe_check.tools.shared.claude_integration: [Error] Troubleshooting: Check Claude CLI installation and configuration.
PASSED [ 81%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_mcp_environment_marker_detected
-------------------------------- live log setup --------------------------------
2025-10-25 14:41:08 [ INFO] vibe_check.tools.shared.claude_integration: [Info] Using custom Claude CLI: /Users/kesslerio/.claude/local/claude
PASSED [ 87%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliResultEnhancements::test_result_includes_sdk_metadata_error_analysis PASSED [ 93%]
tests/unit/test_claude_integration_issue_240.py::TestClaudeCliResultEnhancements::test_result_to_dict_includes_metadata PASSED [100%]

============================= slowest 10 durations =============================
0.03s setup tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_find_claude_cli_prefers_local_path
0.01s teardown tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_find_claude_cli_prefers_local_path
0.01s call tests/unit/test_claude_integration_issue_240.py::TestClaudeCliExecutorIssue240::test_execute_sync_file_not_found_error

(7 durations < 0.005s hidden. Use -vv to show these durations.)
============================== 16 passed in 0.14s ==============================

Let me know if you want a deeper split of , otherwise I think this is ready.

@kesslerio
Copy link
Copy Markdown
Owner Author

Thanks for the sweep! Most of the earlier flags were already covered, but I pushed two concrete tweaks:

  • expanded the --version fallback warning to log the exit code + stderr so we can see why validation failed in CI (src/vibe_check/tools/legacy/review_pr_monolithic_backup.py:500)
  • clarified EXTERNAL_CLAUDE.md that we reset claude_cmd each probe and store the resolved path after validation (docs/EXTERNAL_CLAUDE.md:34)

Everything else—CLAUDE_CLI_NAME handling, mixed imports, relative path fallbacks—was behaving as intended. Re-ran the targeted pytest modules for sanity:

pytest --no-cov tests/test_claude_code_integration.py
pytest --no-cov tests/unit/test_claude_integration_issue_240.py

Let me know if you want a deeper split of _check_claude_availability, otherwise I think this is ready.

@kesslerio kesslerio merged commit 99baadc into main Oct 25, 2025
@kesslerio kesslerio deleted the feature/issue-263-claude-cli branch October 25, 2025 21:41
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.

1 participant