feat(ralph-wiggum): Add automatic rate limit detection and wait#120
Open
arpit551 wants to merge 2 commits intoanthropics:mainfrom
Open
feat(ralph-wiggum): Add automatic rate limit detection and wait#120arpit551 wants to merge 2 commits intoanthropics:mainfrom
arpit551 wants to merge 2 commits intoanthropics:mainfrom
Conversation
When running long Ralph loops, hitting Claude's rate limit would cause the loop to fail. This enhancement adds: - Rate limit detection by checking transcript for common error patterns (rate.limit, rate_limit, too.many.requests, 429, quota.exceeded, usage.limit) - Integration with ccusage to determine remaining time until block reset - Automatic wait and resume functionality When a rate limit is detected: 1. The stop hook checks the transcript for rate limit error patterns 2. Uses ccusage (if available) to get accurate remaining time 3. Displays a message showing wait time and resume time 4. Sleeps until the block resets (with 60s buffer) 5. Continues the Ralph loop automatically This enables truly autonomous long-running tasks that can span multiple 5-hour blocks without manual intervention. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of depending on ccusage npm package, now parses the reset time directly from the rate limit error message pattern "resets X:XXam/pm" (e.g., "resets 6:30am"). This approach: - Removes external dependency on ccusage - Uses the exact reset time shown to the user - More reliable and simpler 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What this PR does
When running long Ralph loops, hitting Claude's rate limit would cause the loop to fail. This enhancement adds:
(
rate.limit,rate_limit,too.many.requests,429,quota.exceeded,usage.limit)When a rate limit is detected:
Test plan
/ralph-loopwith a long task🤖 Generated with Claude Code