From c23f000c05e517d60808f064327e2d0bd1a601fb Mon Sep 17 00:00:00 2001 From: Dev Agent Date: Wed, 3 Jun 2026 00:13:44 +0300 Subject: [PATCH] fix(preflight): check the binary the launcher actually spawns (ORCH-1) Container ORCH_CLAUDE_BIN pointed at a non-existent /usr/bin/claude while the launcher spawns the hardcoded /opt/claude-code/bin/claude.exe. Preflight now follows AgentLauncher.CLAUDE_BIN (the genuinely executed path), so it no longer falsely blocks every job in production. --- src/preflight.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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]: