Skip to content

Conversation

@natustx
Copy link

@natustx natustx commented Jan 15, 2026

Summary

  • 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

Problem

On macOS, the timeout command is not installed by default. When running ralph, 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

  • Run ralph on a system without timeout installed - should see clear error message
  • Run ralph on a system with timeout installed - should work normally

Summary by CodeRabbit

  • Chores
    • Added startup validation for the required system "timeout" utility. If missing, the script halts and displays platform-specific installation instructions for macOS, Ubuntu/Debian, and CentOS/RHEL.
    • Ensures execution timeouts are enforced once the required utility is present.

✏️ Tip: You can customize this high-level summary in your review settings.

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.
@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Walkthrough

Added a new check_timeout_available() function to ralph_loop.sh that verifies the presence of the timeout command at startup. If timeout is missing, the script logs an error, prints platform-specific installation instructions for macOS, Ubuntu/Debian, and CentOS/RHEL, and exits with code 1. The main function now calls this check before initialization.

Changes

Cohort / File(s) Summary
Dependency Validation
ralph_loop.sh
Added check_timeout_available() to verify timeout availability; emits OS-specific install guidance (macOS, Ubuntu/Debian, CentOS/RHEL) and exits with code 1 when absent. Main execution now calls this check early.

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

🐰 I hop in scripts to keep time wise,
I peek for timeout with curious eyes.
If it's not there, I point the right way,
Install the tool and then we play. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding detection for a missing timeout command at startup, which is the primary purpose of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Jan 15, 2026

Add startup check in ralph_loop.sh to detect missing timeout and exit with install instructions

Introduce check_timeout_available that validates timeout via command -v and logs an error with install guidance; call it at the start of main before .ralphrc loads.

📍Where to Start

Start with the check_timeout_available invocation in main in ralph_loop.sh.


Macroscope summarized 494740d.

Copy link

@coderabbitai coderabbitai bot left a 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.

Comment on lines +170 to +186
# 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
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat lib/timeout_utils.sh

Repository: frankbria/ralph-claude-code

Length of output: 4283


🏁 Script executed:

sed -n '1145,1150p' ralph_loop.sh

Repository: frankbria/ralph-claude-code

Length of output: 235


🏁 Script executed:

sed -n '1,15p' ralph_loop.sh

Repository: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant