Merge branch 'main' into fix/unified-error-classifier
Resolve conflicts in provider-error-pause.ts and provider-errors.test.ts. Add stream_exhausted(_without_result) pattern to unified CONNECTION_RE (ported from main's classifyProviderError addition). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
878ed00f1b
commit
7d0130fa0f
2 changed files with 8 additions and 1 deletions
|
|
@ -47,7 +47,7 @@ const RATE_LIMIT_RE = /rate.?limit|too many requests|429/i;
|
|||
const NETWORK_RE = /network|ECONNRESET|ETIMEDOUT|ECONNREFUSED|socket hang up|fetch failed|connection.*reset|dns/i;
|
||||
const SERVER_RE = /internal server error|500|502|503|overloaded|server_error|api_error|service.?unavailable/i;
|
||||
// ECONNRESET/ECONNREFUSED are in NETWORK_RE (same-model retry first).
|
||||
const CONNECTION_RE = /terminated|connection.?refused|other side closed|EPIPE|network.?(?:is\s+)?unavailable/i;
|
||||
const CONNECTION_RE = /terminated|connection.?refused|other side closed|EPIPE|network.?(?:is\s+)?unavailable|stream_exhausted(?:_without_result)?/i;
|
||||
const STREAM_RE = /Unexpected end of JSON|Unexpected token.*JSON|Expected double-quoted property name|SyntaxError.*JSON/i;
|
||||
const RESET_DELAY_RE = /reset in (\d+)s/i;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@ test("classifyError defaults to 60s for rate limit without reset", () => {
|
|||
assert.ok("retryAfterMs" in result && result.retryAfterMs === 60_000);
|
||||
});
|
||||
|
||||
test("classifyError treats stream_exhausted_without_result as transient connection failure", () => {
|
||||
const result = classifyError("stream_exhausted_without_result");
|
||||
assert.ok(isTransient(result));
|
||||
assert.equal(result.kind, "connection");
|
||||
assert.ok("retryAfterMs" in result && result.retryAfterMs === 15_000);
|
||||
});
|
||||
|
||||
test("classifyError detects Anthropic internal server error", () => {
|
||||
const msg = '{"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"}}';
|
||||
const result = classifyError(msg);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue