-
Notifications
You must be signed in to change notification settings - Fork 405
fix(loop): detect missing timeout command at startup #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add check_timeout_available() that verifies GNU coreutils timeout is installed before running the loop. Exits with clear installation instructions for macOS, Ubuntu/Debian, and CentOS/RHEL instead of failing silently during Claude Code execution.
WalkthroughAdded a new Changes
Sequence Diagram(s)(omitted — change is a single-script dependency check and does not meet diagram criteria) Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
Add startup check in
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@ralph_loop.sh`:
- Around line 170-186: The check_timeout_available function currently only looks
for timeout and will fail on macOS where Homebrew coreutils installs gtimeout;
update check_timeout_available to accept either timeout or gtimeout (use command
-v to test both) and set the chosen command accordingly (matching the behavior
expected by lib/timeout_utils.sh), and update the error/help text to mention
gtimeout as an alternative and instruct macOS users about gtimeout/homebrew
coreutils.
| # Check if timeout command is available (required for execution timeouts) | ||
| check_timeout_available() { | ||
| if ! command -v timeout &> /dev/null; then | ||
| log_status "ERROR" "timeout command not found. This is required for Claude Code execution timeouts." | ||
| echo "" | ||
| echo "The 'timeout' command is part of GNU coreutils." | ||
| echo "" | ||
| echo "Install coreutils:" | ||
| echo " macOS: brew install coreutils" | ||
| echo " Ubuntu/Debian: sudo apt-get install coreutils" | ||
| echo " CentOS/RHEL: sudo yum install coreutils" | ||
| echo "" | ||
| echo "After installing on macOS, ensure /opt/homebrew/bin (Apple Silicon)" | ||
| echo "or /usr/local/bin (Intel) is in your PATH." | ||
| exit 1 | ||
| fi | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat lib/timeout_utils.shRepository: frankbria/ralph-claude-code
Length of output: 4283
🏁 Script executed:
sed -n '1145,1150p' ralph_loop.shRepository: frankbria/ralph-claude-code
Length of output: 235
🏁 Script executed:
sed -n '1,15p' ralph_loop.shRepository: frankbria/ralph-claude-code
Length of output: 509
Check for gtimeout on macOS in addition to timeout.
The function checks only for timeout, but on macOS with Homebrew coreutils, the command is typically installed as gtimeout. Since lib/timeout_utils.sh (already sourced at line 11) supports falling back to gtimeout, this check should also accept gtimeout as a valid alternative. Without this, the script will fail to start on macOS systems where coreutils is installed but gtimeout is not in the main timeout name.
Suggested fix
check_timeout_available() {
- if ! command -v timeout &> /dev/null; then
+ if ! command -v timeout &> /dev/null && ! command -v gtimeout &> /dev/null; then
log_status "ERROR" "timeout command not found. This is required for Claude Code execution timeouts."
echo ""
- echo "The 'timeout' command is part of GNU coreutils."
+ echo "The 'timeout' (or 'gtimeout' on macOS) command is part of GNU coreutils."🤖 Prompt for AI Agents
In `@ralph_loop.sh` around lines 170 - 186, The check_timeout_available function
currently only looks for timeout and will fail on macOS where Homebrew coreutils
installs gtimeout; update check_timeout_available to accept either timeout or
gtimeout (use command -v to test both) and set the chosen command accordingly
(matching the behavior expected by lib/timeout_utils.sh), and update the
error/help text to mention gtimeout as an alternative and instruct macOS users
about gtimeout/homebrew coreutils.
Summary
check_timeout_available()that verifies GNU coreutilstimeoutis installed before running the loopProblem
On macOS, the
timeoutcommand is not installed by default. When runningralph, the script would fail silently with the error going to the output file rather than the terminal, making it very difficult to diagnose.Test plan
ralphon a system withouttimeoutinstalled - should see clear error messageralphon a system withtimeoutinstalled - should work normallySummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.