summaryrefslogtreecommitdiff
path: root/internal/executor/ratelimit.go
blob: 109aa49c719a5a60e429a4b6b13b5ff09d027efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package executor

import "strings"

// isQuotaExhausted returns true if err indicates the 5-hour Claude usage quota
// is fully exhausted. Unlike transient rate limits, these should not be retried.
func isQuotaExhausted(err error) bool {
	if err == nil {
		return false
	}
	msg := strings.ToLower(err.Error())
	return strings.Contains(msg, "hit your limit") ||
		strings.Contains(msg, "you've hit your limit") ||
		strings.Contains(msg, "you have hit your limit") ||
		strings.Contains(msg, "rate limit reached (rejected)") ||
		strings.Contains(msg, "status: rejected")
}