|
25 | 25 | * response (for example "Response status code does not indicate success: 400 (Bad Request)"). |
26 | 26 | * - capi_quota_exceeded_error: The Copilot CAPI quota has been exhausted |
27 | 27 | * or rate-limited (e.g., "CAPIError: 429 429 quota exceeded", |
28 | | - * "CAPIError: Too Many Requests"). All matched forms are treated as |
29 | | - * non-retryable because the Copilot SDK has already retried internally |
30 | | - * before surfacing the error. |
| 28 | + * "CAPIError: Too Many Requests", or the Copilot CLI's own |
| 29 | + * retry-exhaustion message "Failed to get response from the AI model; |
| 30 | + * retried N times ... Last error: 429/5xx" which carries no "CAPIError:" |
| 31 | + * prefix). All matched forms are treated as non-retryable because the |
| 32 | + * Copilot CLI/SDK has already retried internally before surfacing the |
| 33 | + * error. |
31 | 34 | * - invocation_cap_exceeded: The per-run pooled LLM invocation cap is |
32 | 35 | * fully exhausted (e.g., "CAPIError: 429 Maximum LLM invocations exceeded (N/N)" |
33 | 36 | * or `"type":"max_runs_exceeded"`). This is more specific than generic |
@@ -165,9 +168,13 @@ const MISSING_MODEL_PRICING_PATTERN = /Model\s+"([^"]+)"\s+has no AI credits pri |
165 | 168 | // "CAPIError: 429 429 quota exceeded" (original observed form) |
166 | 169 | // "CAPIError: 429 Too Many Requests" (HTTP 429 form) |
167 | 170 | // "CAPIError: Too Many Requests" (no status code in message) |
168 | | -// All forms are treated as non-retryable; the Copilot SDK has already retried |
169 | | -// internally before surfacing this error (evidenced by "retried 5 times" context). |
170 | | -const CAPI_QUOTA_EXCEEDED_PATTERN = /CAPIError:\s*(?:429\s+)?(?:429\s+quota exceeded|Too Many Requests)/i; |
| 171 | +// "Failed to get response from the AI model; retried 5 times ... Last error: 429 Too Many Requests" |
| 172 | +// (Copilot CLI's own retry-exhaustion message, no "CAPIError:" prefix — seen with both |
| 173 | +// 429 and 5xx terminal statuses, e.g. "Last error: 503 Service Unavailable") |
| 174 | +// All forms are treated as non-retryable; the Copilot CLI/SDK has already retried |
| 175 | +// internally before surfacing this error (evidenced by "retried N times" context). |
| 176 | +const CAPI_QUOTA_EXCEEDED_PATTERN = |
| 177 | + /CAPIError:\s*(?:429\s+)?(?:429\s+quota exceeded|Too Many Requests)|Failed to get response from the AI model;\s*retried\s+\d+\s+times[^\n]{0,300}?Last error:\s*(?:429|5\d{2})\b/i; |
171 | 178 |
|
172 | 179 | /** |
173 | 180 | * Build a case-insensitive merged RegExp from literal/regex patterns. |
|
0 commit comments