oira666_pi-limits-wait 0.6.10 → 0.6.11

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 CHANGED
@@ -12,7 +12,7 @@ pi install npm:oira666_pi-limits-wait
12
12
 
13
13
  Restart Pi or run `/reload` after installing.
14
14
 
15
- Tested against Pi 1.4.0.
15
+ Tested against Pi 1.5.0.
16
16
 
17
17
  ## What it does
18
18
 
@@ -26,7 +26,7 @@ Tested against Pi 1.4.0.
26
26
  - On `server_is_overloaded`, waits 5 minutes, then retries. If the provider is still overloaded after Pi's normal retries, it waits another 5 minutes and repeats.
27
27
  - On transient network/transport failures — including undici idle-timeout aborts (`UND_ERR_HEADERS_TIMEOUT` / `UND_ERR_BODY_TIMEOUT`), `fetch failed`, `terminated`, `ECONNRESET`, `ETIMEDOUT`, etc. — treats the error as retryable with a short backoff (default 15s, or the provider's `retry-after`) instead of giving up. This prevents a stalled streaming request from turning into a silent hang.
28
28
  - Leaves context-overflow recovery entirely to Pi. The extension uses Pi's own `isContextOverflow()` detector and immediately surfaces matching failures without waiting, retrying, or selecting another fallback. If the overflow came from a fallback already attempted for the request, the extension makes that attempted model current when Pi is still on the request's original model and accepts the switch; it never overrides a newer user model selection. Pi intentionally ignores overflow errors from non-current models. Successful over-window responses and zero-output length stops also pass through unchanged, allowing Pi to compact and perform its built-in recovery.
29
- - For any other (unclassified) provider error — including an API `Internal server error` and HTTP `400`/`403` failures — waits and retries the same model. There is deliberately no permanent-HTTP-status allowlist. This retry-all behavior is enabled by default and uses a configurable retry limit and interval; it does not alter model-limit wait intervals. ChatGPT Business workspace-admin usage limits use this bounded policy, even when accompanied by HTTP `429` or `Retry-After`, rather than an endless timed-limit loop. Disable `PI_LIMITS_WAIT_DEFAULT_WAITING` to surface them immediately, matching Pi's non-retryable classification; the provider's admin guidance is preserved.
29
+ - For any other (unclassified) provider error — including an API `Internal server error` and HTTP `400`/`403` failures — waits and retries the same model. There is deliberately no permanent-HTTP-status allowlist. This retry-all behavior is enabled by default and uses a configurable retry limit and interval; it does not alter model-limit wait intervals. ChatGPT Business workspace-admin usage limits and Zhipu/Z.ai plan-exhaustion code `1308` use this bounded policy, even when accompanied by HTTP `429` or `Retry-After`, rather than an endless timed-limit loop. Disable `PI_LIMITS_WAIT_DEFAULT_WAITING` to surface them immediately, matching Pi's non-retryable classification; the provider's error guidance is preserved.
30
30
  - Reports retry/fallback waits in chat notifications without adding persistent TUI status lines.
31
31
  - In non-interactive hosts (`rpc` and `json` modes) the extension never reports a planned retry as an error. While it is waiting to retry, it publishes `info`-level liveliness notifications (plus a `setStatus` entry) describing what it is doing, how long it will wait, and why. An `error`-level notification is emitted only when the extension stops retrying and surfaces the terminal failure. See [Non-interactive (RPC) reporting](#non-interactive-rpc-reporting).
32
32
  - During a wait, pressing Enter in an empty editor retries immediately. Typed commands, autocomplete, and model-picker navigation still work normally. Choosing another model with `/model` immediately ends the pending wait and tries that exact model, even if it was previously marked unavailable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oira666_pi-limits-wait",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "description": "Extension for PI that allows to automatically wait for limits to reset and retry the request",
5
5
  "type": "module",
6
6
  "exports": {
@@ -48,8 +48,8 @@
48
48
  "@earendil-works/pi-coding-agent": ">=1.4.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@earendil-works/pi-ai": "1.4.0",
52
- "@earendil-works/pi-coding-agent": "1.4.0",
51
+ "@earendil-works/pi-ai": "1.5.0",
52
+ "@earendil-works/pi-coding-agent": "1.5.0",
53
53
  "tsx": "^4.23.15",
54
54
  "typescript": "^7.0.2"
55
55
  }
@@ -217,11 +217,12 @@ export function retryAfterHeaderMs(headers: Headers): number | undefined {
217
217
  }
218
218
 
219
219
  export function getRetryableError(msg: string): RetryableError | undefined {
220
- // Business workspace limits require an administrator, not a timed reset.
220
+ // Workspace-admin limits and Z.ai plan exhaustion are not transient throttles.
221
221
  // Keep retry-all configurable, but use its bounded unknown-error budget even
222
222
  // when transport metadata adds HTTP 429 / Retry-After to the provider text.
223
223
  if (msg.includes("subscription_sharing_workplace_individual_usage_limit_exceeded")
224
- || msg.includes("You've reached your ChatGPT workspace's usage limit.")) return undefined;
224
+ || msg.includes("You've reached your ChatGPT workspace's usage limit.")
225
+ || /"code"\s*:\s*"?1308(?![0-9])/i.test(msg)) return undefined;
225
226
  if (isServerOverloadedError(msg)) {
226
227
  return { reason: "overloaded", waitMs: parseRetryDelayMs(msg) ?? DEFAULT_OVERLOADED_WAIT_MS };
227
228
  }