fix(errors): narrow proxy transport detection

This commit is contained in:
Eva
2026-04-11 05:20:30 +07:00
committed by Peter Steinberger
parent b4fdd9c495
commit d744073d67
3 changed files with 21 additions and 1 deletions

View File

@@ -265,6 +265,18 @@ describe("formatAssistantErrorText", () => {
);
});
it("keeps non-transport config errors that mention proxy settings actionable", () => {
const msg = makeAssistantError(
'Model-provider request.proxy/request.tls is not yet supported for api "ollama"',
);
expect(formatAssistantErrorText(msg)).toContain(
'Model-provider request.proxy/request.tls is not yet supported for api "ollama"',
);
expect(formatAssistantErrorText(msg)).not.toBe(
"LLM request failed: proxy or tunnel configuration blocked the provider request.",
);
});
it("sanitizes invalid streaming event order errors", () => {
const msg = makeAssistantError(
'Unexpected event order, got message_start before receiving "message_stop"',

View File

@@ -1166,4 +1166,12 @@ describe("classifyProviderRuntimeFailureKind", () => {
"replay_invalid",
);
});
it("does not classify generic config errors that mention proxy settings as proxy failures", () => {
expect(
classifyProviderRuntimeFailureKind(
'Model-provider request.proxy/request.tls is not yet supported for api "ollama"',
),
).not.toBe("proxy");
});
});

View File

@@ -470,7 +470,7 @@ const AUTH_SCOPE_NAME_RE = /\b(?:api\.responses\.write|model\.request)\b/i;
const HTML_BODY_RE = /^\s*(?:<!doctype\s+html\b|<html\b)/i;
const HTML_CLOSE_RE = /<\/html>/i;
const PROXY_ERROR_RE =
/\bproxy\b|\bproxyconnect\b|\bhttps?_proxy\b|\b407\b|\bproxy authentication required\b|\btunnel connection failed\b|\bconnect tunnel\b|\bsocks proxy\b/i;
/\bproxyconnect\b|\bhttps?_proxy\b|\b407\b|\bproxy authentication required\b|\btunnel connection failed\b|\bconnect tunnel\b|\bsocks proxy\b|\bproxy error\b/i;
const DNS_ERROR_RE = /\benotfound\b|\beai_again\b|\bgetaddrinfo\b|\bno such host\b|\bdns\b/i;
const INTERRUPTED_NETWORK_ERROR_RE =
/\beconnrefused\b|\beconnreset\b|\beconnaborted\b|\benetreset\b|\behostunreach\b|\behostdown\b|\benetunreach\b|\bepipe\b|\bsocket hang up\b|\bconnection refused\b|\bconnection reset\b|\bconnection aborted\b|\bnetwork is unreachable\b|\bhost is unreachable\b|\bfetch failed\b|\bconnection error\b|\bnetwork request failed\b/i;