summaryrefslogtreecommitdiff
path: root/internal/executor/executor.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-09 05:50:59 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-09 05:50:59 +0000
commit8ec366de42dd66256895f16c9669469791ca823a (patch)
tree1650beda8dd017e476148a0177e96e3ab79832a8 /internal/executor/executor.go
parent5c8562460fc5b78372a1cfdb400e0cb1f51875cd (diff)
executor: strengthen rate-limit avoidance in classifier
Updated isQuotaExhausted to detect more Claude quota messages. Added 'rate limit reached (rejected)' to quota exhausted checks. Strengthened classifier prompt to explicitly forbid selecting rate-limited agents. Improved Pool to set 5h rate limit on quota exhaustion.
Diffstat (limited to 'internal/executor/executor.go')
-rw-r--r--internal/executor/executor.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/internal/executor/executor.go b/internal/executor/executor.go
index 1c9e667..4bb1f2c 100644
--- a/internal/executor/executor.go
+++ b/internal/executor/executor.go
@@ -234,14 +234,18 @@ func (p *Pool) executeResume(ctx context.Context, t *task.Task, exec *storage.Ex
exec.EndTime = time.Now().UTC()
if err != nil {
- if isRateLimitError(err) {
+ if isRateLimitError(err) || isQuotaExhausted(err) {
p.mu.Lock()
retryAfter := parseRetryAfter(err.Error())
if retryAfter == 0 {
- retryAfter = 1 * time.Minute
+ if isQuotaExhausted(err) {
+ retryAfter = 5 * time.Hour
+ } else {
+ retryAfter = 1 * time.Minute
+ }
}
p.rateLimited[agentType] = time.Now().Add(retryAfter)
- p.logger.Info("agent rate limited", "agent", agentType, "retryAfter", retryAfter)
+ p.logger.Info("agent rate limited", "agent", agentType, "retryAfter", retryAfter, "quotaExhausted", isQuotaExhausted(err))
p.mu.Unlock()
}
@@ -445,14 +449,18 @@ func (p *Pool) execute(ctx context.Context, t *task.Task) {
exec.EndTime = time.Now().UTC()
if err != nil {
- if isRateLimitError(err) {
+ if isRateLimitError(err) || isQuotaExhausted(err) {
p.mu.Lock()
retryAfter := parseRetryAfter(err.Error())
if retryAfter == 0 {
- retryAfter = 1 * time.Minute
+ if isQuotaExhausted(err) {
+ retryAfter = 5 * time.Hour
+ } else {
+ retryAfter = 1 * time.Minute
+ }
}
p.rateLimited[agentType] = time.Now().Add(retryAfter)
- p.logger.Info("agent rate limited", "agent", agentType, "retryAfter", retryAfter)
+ p.logger.Info("agent rate limited", "agent", agentType, "retryAfter", retryAfter, "quotaExhausted", isQuotaExhausted(err))
p.mu.Unlock()
}