Skip to content

Commit dd5c408

Browse files
committed
fix: preserve Bun fetch.preconnect in probe
1 parent 8837ca0 commit dd5c408

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/opencode/script/verify-copilot-responses.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ let activeProbeKey: string | undefined
132132

133133
// Capture request URLs to determine which API path is used.
134134
// Provider.getSDK wraps `fetch`, so overriding global fetch is sufficient.
135-
globalThis.fetch = async (input: any, init?: any) => {
135+
const patchedFetch = (async (input: any, init?: any) => {
136136
try {
137137
const url = typeof input === "string" ? input : input?.url ?? String(input)
138138
if (activeProbeKey) {
@@ -144,7 +144,11 @@ globalThis.fetch = async (input: any, init?: any) => {
144144
// ignore
145145
}
146146
return originalFetch(input as any, init as any)
147-
}
147+
}) as typeof fetch
148+
149+
// Bun's fetch type includes `preconnect`, preserve it.
150+
;(patchedFetch as any).preconnect = (originalFetch as any).preconnect
151+
;(globalThis as any).fetch = patchedFetch
148152

149153
function buildConfigOverlayJSON(providerIDs: string[]): string {
150154
// Merge into any existing OPENCODE_CONFIG_CONTENT the user provided.

0 commit comments

Comments
 (0)