@monotykamary/pi-retry 0.7.0 → 0.7.2
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/README.md +3 -2
- package/package.json +4 -4
- package/src/error-patterns.ts +30 -2
package/README.md
CHANGED
|
@@ -162,9 +162,10 @@ These are explicitly **not** retried:
|
|
|
162
162
|
|
|
163
163
|
### Non-Retryable (Quota / Session Limit / Budget)
|
|
164
164
|
Exhausted quotas, session limits, and budgets are auto-detected and stop the retry loop (with an explanatory notification), because retrying is pointless until you act or the reset window passes:
|
|
165
|
-
- **Usage / session limits with reset windows** — "You've hit your limit · resets …" and "5-hour limit reached" (Claude Code), "You've hit your usage limit" / "You've exceeded your usage limit" (Codex)
|
|
165
|
+
- **Usage / session limits with reset windows** — "You've hit your limit · resets …" and "5-hour limit reached" (Claude Code), "You've hit your usage limit" / "You've exceeded your usage limit" (Codex), "You have hit your ChatGPT usage limit (plus plan)" (ChatGPT subscription caps via the Codex backend, also `usage_limit_reached`)
|
|
166
166
|
- **Plan / billing quotas** — OpenAI `insufficient_quota`, "You exceeded your current quota, please check your plan and billing details" (OpenAI, Gemini — reached only after pi's built-in 429 retry gives up)
|
|
167
|
-
- **
|
|
167
|
+
- **Google subscription caps** — "You have exhausted your capacity on this model. Your quota will reset after …" (Gemini Code Assist), "You have reached the quota limit for …" / "You can resume using this model at …" (Antigravity)
|
|
168
|
+
- **Hard allotments** — OpenRouter `free-models-per-day`, Alibaba "Allocated quota exceeded" (`Throttling.AllocationQuota`), GitHub Copilot "premium request allowance", z.ai GLM Coding Plan "Usage limit reached for 5 hour" / "no resource package"
|
|
168
169
|
- **Budget exhaustion** — "out of budget", "Budget has been exceeded" (LiteLLM-style proxies), max/spending/monthly limits
|
|
169
170
|
- **Suspended accounts** — "Your account … is suspended" (Kimi `exceeded_current_quota_error`)
|
|
170
171
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monotykamary/pi-retry",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Extension suite for pi coding agent that handles 400/413 errors and connection errors with automatic retry",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Tom X Nguyen",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@earendil-works/pi-tui": "*"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@earendil-works/pi-agent-core": "^0.84.
|
|
42
|
-
"@earendil-works/pi-coding-agent": "^0.84.
|
|
43
|
-
"@earendil-works/pi-tui": "^0.84.
|
|
41
|
+
"@earendil-works/pi-agent-core": "^0.84.2",
|
|
42
|
+
"@earendil-works/pi-coding-agent": "^0.84.2",
|
|
43
|
+
"@earendil-works/pi-tui": "^0.84.2",
|
|
44
44
|
"@types/node": "25.9.1",
|
|
45
45
|
"@vitest/coverage-v8": "4.1.7",
|
|
46
46
|
"knip": "6.14.1",
|
package/src/error-patterns.ts
CHANGED
|
@@ -142,10 +142,19 @@ const SILENCED_PATTERNS = [
|
|
|
142
142
|
// "5-hour limit reached · resets 12pm"
|
|
143
143
|
// - Codex: "You've hit your usage limit. Upgrade to Plus"
|
|
144
144
|
// "You've exceeded your usage limit."
|
|
145
|
+
// + ChatGPT subscription plan caps (surfaced from chatgpt.com backend,
|
|
146
|
+
// observed via codex providers): "You have hit your ChatGPT usage limit
|
|
147
|
+
// (plus plan). Try again in ~5330 min." — plan name in parens varies
|
|
148
|
+
// (go/plus/pro/team); also arrives as HTTP 429 "The usage limit has been
|
|
149
|
+
// reached" with error.type `usage_limit_reached`
|
|
145
150
|
// - OpenAI: code "insufficient_quota" — "You exceeded your current
|
|
146
151
|
// quota, please check your plan and billing details"
|
|
147
152
|
// - Gemini: same sentence in 429 RESOURCE_EXHAUSTED responses; only
|
|
148
153
|
// reaches us after pi's built-in 429 retry gives up
|
|
154
|
+
// + Google AI Pro/Ultra subscription caps: "You have exhausted your
|
|
155
|
+
// capacity on this model. Your quota will reset after 8h44m7s." (Code
|
|
156
|
+
// Assist), "You have reached the quota limit for Claude Sonnet 4.5
|
|
157
|
+
// (Thinking). You can resume using this model at …" (Antigravity)
|
|
149
158
|
// - OpenRouter: "Rate limit exceeded: free-models-per-day. ..."
|
|
150
159
|
// - Alibaba: "Allocated quota exceeded, please increase your quota limit"
|
|
151
160
|
// (Throttling.AllocationQuota — hard cap; RateQuota is
|
|
@@ -154,9 +163,21 @@ const SILENCED_PATTERNS = [
|
|
|
154
163
|
// - LiteLLM: "Budget has been exceeded! Current cost: …, Max budget: …"
|
|
155
164
|
// - Kimi: "Your account {org}<{ak}> is suspended, please check your
|
|
156
165
|
// plan and billing details" (exceeded_current_quota_error)
|
|
166
|
+
// - z.ai GLM: "Usage limit reached for 5 hour. Your limit will reset at
|
|
167
|
+
// …" (5-hour window, matches usage-limit-reached above) and
|
|
168
|
+
// 429 code 1113 "Insufficient balance or no resource package.
|
|
169
|
+
// Please recharge." (Coding Plan quota drained — unlike plain
|
|
170
|
+
// balance errors this needs a window reset or plan change)
|
|
171
|
+
//
|
|
172
|
+
// Deliberately retryable (verified, kept out): DeepSeek 402 "Insufficient
|
|
173
|
+
// Balance" and 429 "Rate Limit Reached" (concurrency), Kimi TPD org limits
|
|
174
|
+
// and "exceeded your current token quota" (balance). See the note on
|
|
175
|
+
// hasQuotaExhaustedError below.
|
|
157
176
|
export const QUOTA_EXHAUSTED_PATTERNS = [
|
|
158
|
-
// Session / usage limits with reset windows (Claude, Codex)
|
|
159
|
-
/hit your (
|
|
177
|
+
// Session / usage limits with reset windows (Claude, Codex, ChatGPT plans)
|
|
178
|
+
/hit your (?:[a-z]+ )?usage limit/i, // "…hit your usage limit", "…hit your ChatGPT usage limit (plus plan)" — the optional word is the provider name; "hit your rate limit" intentionally NOT matched (burst limit stays retryable)
|
|
179
|
+
/hit your limit/i,
|
|
180
|
+
/usage_limit_reached/i, // Codex backend 429 error.type surfaced in the body
|
|
160
181
|
/usage\s*limit\s*(has\s*been\s*)?reached/i,
|
|
161
182
|
/hour\s*limit\s*reached/i, // "5-hour limit reached" — must NOT hit DeepSeek 429 "Rate Limit Reached"
|
|
162
183
|
/limit\s*will\s*reset\s*at/i,
|
|
@@ -175,6 +196,13 @@ export const QUOTA_EXHAUSTED_PATTERNS = [
|
|
|
175
196
|
/budget\s*(has\s*been\s*)?(exceeded|exhausted|limit)/i,
|
|
176
197
|
/max(imum)?\s*budget\s*(exceeded|reached|limit)/i,
|
|
177
198
|
/spending\s*limit/i,
|
|
199
|
+
// Google subscription caps (Gemini Code Assist, Antigravity)
|
|
200
|
+
/exhausted your capacity/i, // "You have exhausted your capacity on this model."
|
|
201
|
+
/quota will reset after/i, // "Your quota will reset after 8h44m7s."
|
|
202
|
+
/reached the quota limit/i, // Antigravity "You have reached the quota limit for Gemini 3 Pro (High)"
|
|
203
|
+
/you can resume using this model/i, // Antigravity resume tail when the lead-in is truncated
|
|
204
|
+
// z.ai / GLM Coding Plan window exhaustion (429 code 1113)
|
|
205
|
+
/no resource package/i, // "Insufficient balance or no resource package. Please recharge."
|
|
178
206
|
// Suspended accounts (Kimi exceeded_current_quota_error suspended form)
|
|
179
207
|
/account\b[^.]*\bis\s*suspended/i,
|
|
180
208
|
// Generic
|