@arvorco/relentless 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/agents/claude.ts +22 -2
package/package.json
CHANGED
package/src/agents/claude.ts
CHANGED
|
@@ -180,7 +180,23 @@ export const claudeAdapter: AgentAdapter = {
|
|
|
180
180
|
},
|
|
181
181
|
|
|
182
182
|
detectRateLimit(output: string): RateLimitInfo {
|
|
183
|
+
// Debug: Log to file when rate limit is detected
|
|
184
|
+
const debugRateLimit = (pattern: string, message: string) => {
|
|
185
|
+
if (process.env.RELENTLESS_DEBUG) {
|
|
186
|
+
const debugInfo = {
|
|
187
|
+
timestamp: new Date().toISOString(),
|
|
188
|
+
pattern,
|
|
189
|
+
message,
|
|
190
|
+
outputLength: output.length,
|
|
191
|
+
outputSample: output.slice(0, 500),
|
|
192
|
+
outputEnd: output.slice(-500),
|
|
193
|
+
};
|
|
194
|
+
console.error(`[RELENTLESS_DEBUG] Rate limit detected: ${JSON.stringify(debugInfo, null, 2)}`);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
183
198
|
if (output.includes("[Relentless] Idle timeout")) {
|
|
199
|
+
debugRateLimit("idle_timeout", "Claude idle timeout");
|
|
184
200
|
return {
|
|
185
201
|
limited: true,
|
|
186
202
|
message: "Claude idle timeout",
|
|
@@ -188,6 +204,7 @@ export const claudeAdapter: AgentAdapter = {
|
|
|
188
204
|
}
|
|
189
205
|
|
|
190
206
|
if (/(?:operation not permitted|permission denied|\beperm\b).*(?:\/\.claude|\.claude)/i.test(output)) {
|
|
207
|
+
debugRateLimit("permission_error", "Claude unavailable due to permission error");
|
|
191
208
|
return {
|
|
192
209
|
limited: true,
|
|
193
210
|
message: "Claude unavailable due to permission error",
|
|
@@ -195,8 +212,10 @@ export const claudeAdapter: AgentAdapter = {
|
|
|
195
212
|
}
|
|
196
213
|
|
|
197
214
|
// More specific pattern for actual API model not found errors
|
|
198
|
-
//
|
|
199
|
-
|
|
215
|
+
// Only match JSON API error responses, not conversational mentions
|
|
216
|
+
const modelNotFoundPattern = /"type":\s*"not_found_error".*"model"/i;
|
|
217
|
+
if (modelNotFoundPattern.test(output)) {
|
|
218
|
+
debugRateLimit("model_not_found", "Claude model not found");
|
|
200
219
|
return {
|
|
201
220
|
limited: true,
|
|
202
221
|
message: "Claude model not found",
|
|
@@ -225,6 +244,7 @@ export const claudeAdapter: AgentAdapter = {
|
|
|
225
244
|
}
|
|
226
245
|
}
|
|
227
246
|
|
|
247
|
+
debugRateLimit("hit_your_limit", "Claude Code rate limit exceeded");
|
|
228
248
|
return {
|
|
229
249
|
limited: true,
|
|
230
250
|
resetTime,
|