Fix TLS cert preflight classification false positive

This commit is contained in:
Alex Filatov
2026-03-02 19:57:39 +00:00
committed by George Pickett
parent f181b7dbe6
commit dc8a56c857
2 changed files with 18 additions and 1 deletions

View File

@@ -30,6 +30,24 @@ describe("runOpenAIOAuthTlsPreflight", () => {
code: "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
});
});
it("keeps generic TLS transport failures in network classification", async () => {
const networkFetchImpl = vi.fn(async () => {
throw new TypeError("fetch failed", {
cause: new Error(
"Client network socket disconnected before secure TLS connection was established",
),
});
});
const result = await runOpenAIOAuthTlsPreflight({
fetchImpl: networkFetchImpl,
timeoutMs: 20,
});
expect(result).toMatchObject({
ok: false,
kind: "network",
});
});
});
describe("formatOpenAIOAuthTlsPreflightFix", () => {

View File

@@ -16,7 +16,6 @@ const TLS_CERT_ERROR_PATTERNS = [
/unable to verify the first certificate/i,
/self[- ]signed certificate/i,
/certificate has expired/i,
/tls/i,
];
const OPENAI_AUTH_PROBE_URL =