Skip to content

Commit afe77e5

Browse files
Update E2E test proxy to account for newer CLI behaviors
1 parent 9e6e165 commit afe77e5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/harness/replayingCapiProxy.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,22 @@ export class ReplayingCapiProxy extends CapturingHttpProxy {
308308
}
309309
}
310310

311+
// Beyond this point, we're only going to be able to supply responses in CI if we have a snapshot,
312+
// and we only store snapshots for chat completion. For anything else (e.g., custom-agents fetches),
313+
// return 404 so the CLI treats them as unavailable instead of erroring.
314+
if (options.requestOptions.path !== chatCompletionEndpoint) {
315+
const headers = {
316+
"content-type": "application/json",
317+
"x-github-request-id": "proxy-not-found",
318+
};
319+
options.onResponseStart(404, headers);
320+
options.onData(
321+
Buffer.from(JSON.stringify({ error: "Not found by test proxy" })),
322+
);
323+
options.onResponseEnd();
324+
return;
325+
}
326+
311327
// Fallback to normal proxying if no cached response found
312328
// This implicitly captures the new exchange too
313329
const isCI = process.env.GITHUB_ACTIONS === "true";

0 commit comments

Comments
 (0)