From 4aa5d01588419f3558e044372a302e95b07bff07 Mon Sep 17 00:00:00 2001 From: rob Date: Fri, 31 Oct 2025 09:57:26 -0300 Subject: [PATCH] fix: Handle claude CLI exit code 1 for successful responses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude CLI returns exit code 1 even when successfully generating output. Check for stdout content before failing on non-zero exit codes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- automation/patcher.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/automation/patcher.py b/automation/patcher.py index b5e5b39..b3acdb0 100644 --- a/automation/patcher.py +++ b/automation/patcher.py @@ -224,6 +224,12 @@ def call_model(model: ModelConfig, prompt: str, cwd: Path) -> str: cwd=str(cwd), shell=True, ) + # Check if we got output even if returncode is non-zero + # (claude CLI returns 1 even on successful prompt responses) + if result.stdout.strip(): + return result.stdout + + # Only raise error if we got nothing useful if result.returncode != 0: raise PatchGenerationError(f"AI command failed ({result.returncode}): {result.stderr.strip()}") return result.stdout