fix: add --max-turns 1 to Claude preflight check for reliable completion#165
fix: add --max-turns 1 to Claude preflight check for reliable completion#165
Conversation
The preflight check was timing out because it didn't limit Claude to a single turn. Without --max-turns 1, Claude could run multiple turns or attempt tool use, potentially exceeding the 30-second timeout even for a simple test prompt. This matches the behavior of a working manual test: claude -p "Say OK" --max-turns 1 Fixes #161
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
WalkthroughA preflight override is added to ClaudeAgentPlugin that verifies Claude CLI presence, runs a bounded one-turn test prompt using Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant ClaudeAgentPlugin
participant ClaudeCLI as "claude (external CLI)"
Caller->>ClaudeAgentPlugin: request preflight(timeout?)
ClaudeAgentPlugin->>ClaudeAgentPlugin: detect claude CLI
ClaudeAgentPlugin->>ClaudeCLI: spawn process with test prompt (--max-turns 1)
Note right of ClaudeCLI: runs test prompt\nwrites to stdout or fails
ClaudeCLI-->>ClaudeAgentPlugin: stdout / error (or no output)
ClaudeAgentPlugin->>ClaudeAgentPlugin: evaluate output, measure duration
alt success (non-empty stdout)
ClaudeAgentPlugin-->>Caller: AgentPreflightResult { success: true, durationMs }
else timeout / exec error / empty output
ClaudeAgentPlugin-->>Caller: AgentPreflightResult { success: false, reason, suggestion, durationMs }
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #165 +/- ##
==========================================
- Coverage 40.87% 40.70% -0.18%
==========================================
Files 72 72
Lines 19912 19996 +84
==========================================
Hits 8140 8140
- Misses 11772 11856 +84
🚀 New features to boost your workflow:
|
When the preflight check fails with "Agent execution failed", the error now includes the exit code and first 200 chars of stderr to help debug why Claude is exiting with non-zero when spawned by ralph-tui.
The preflight check was timing out because it didn't limit Claude to a
single turn. Without --max-turns 1, Claude could run multiple turns or
attempt tool use, potentially exceeding the 30-second timeout even for
a simple test prompt.
This matches the behavior of a working manual test:
claude -p "Say OK" --max-turns 1
Fixes #161
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.