diff --git a/src/preflight.py b/src/preflight.py index 717cee2..316fdce 100644 --- a/src/preflight.py +++ b/src/preflight.py @@ -35,7 +35,23 @@ _cache = _PreflightCache() def _claude_bin() -> str: - return getattr(settings, "claude_bin", None) or "/opt/claude-code/bin/claude.exe" + """Resolve the claude binary preflight should check. + + Must match the binary the launcher actually spawns. The launcher hardcodes + AgentLauncher.CLAUDE_BIN for the real Popen, so we prefer that; we only fall + back to settings.claude_bin / a default if it is somehow unset. (Note: the + container's ORCH_CLAUDE_BIN may point elsewhere; preflight follows the path + that is genuinely executed, not the unused env override.) + """ + try: + from .agents.launcher import AgentLauncher + launcher_bin = getattr(AgentLauncher, "CLAUDE_BIN", None) + if launcher_bin and os.path.exists(launcher_bin): + return launcher_bin + # Launcher path not present -> fall back to configured/default. + return launcher_bin or getattr(settings, "claude_bin", None) or "/opt/claude-code/bin/claude.exe" + except Exception: + return getattr(settings, "claude_bin", None) or "/opt/claude-code/bin/claude.exe" def _run_version(bin_path: str) -> tuple[bool, str]: