File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ describe("Sessions", async () => {
1515 } ) ;
1616 expect ( session . sessionId ) . toMatch ( / ^ [ a - f 0 - 9 - ] + $ / ) ;
1717
18- expect ( await session . getMessages ( ) ) . toMatchObject ( [
18+ const allEvents = await session . getMessages ( ) ;
19+ const sessionStartEvents = allEvents . filter ( ( e ) => e . type === "session.start" ) ;
20+ expect ( sessionStartEvents ) . toMatchObject ( [
1921 {
2022 type : "session.start" ,
2123 data : { sessionId : session . sessionId , selectedModel : "fake-test-model" } ,
Original file line number Diff line number Diff 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" ;
You can’t perform that action at this time.
0 commit comments