fix: document stream cleanup fallback intent

This commit is contained in:
Wynne668
2026-06-29 00:20:56 -07:00
committed by GitHub
parent 0635fa5eca
commit ac5af25015
4 changed files with 16 additions and 4 deletions
+4 -1
View File
@@ -54,7 +54,10 @@ function coerceApiHost(params: {
try {
const url = new URL(raw);
return url.origin;
} catch {}
} catch {
// Bare hosts are retried with https:// below; malformed absolute URLs fall
// back to provider defaults instead of sending requests to invalid endpoints.
}
if (/^[a-z][a-z\d+.-]*:\/\//i.test(raw)) {
return defaultHost;
+4 -1
View File
@@ -81,7 +81,10 @@ export async function readResponseTextLimited(
}
try {
reader.releaseLock();
} catch {}
} catch {
// Error-body reads are diagnostic best effort; release failures must not
// hide the bounded provider error text already captured.
}
}
return text;
+4 -1
View File
@@ -409,7 +409,10 @@ export function streamProxy(
} finally {
try {
reader?.releaseLock();
} catch {}
} catch {
// Stream handling above already pushed the terminal proxy event;
// cleanup failures must not replace it with a secondary release error.
}
if (options.signal) {
options.signal.removeEventListener("abort", abortHandler);
}
+4 -1
View File
@@ -287,7 +287,10 @@ export async function readResponseText(
}
try {
reader.releaseLock();
} catch {}
} catch {
// The read/cancel path already produced the best-effort body result;
// lock-release failures must not replace that outcome.
}
}
const bytes = concatBytes(parts, bytesRead);