@@ -2975,9 +2975,9 @@ describe("combo compact failover", () => {
29752975 backupUrl ?: string ,
29762976 ) : { config : OcxConfig } {
29772977 const config = comboConfig ( {
2978- openai : {
2978+ " openai-apikey" : {
29792979 adapter : "openai-responses" ,
2980- baseUrl : "https://chatgpt. com/backend-api/codex " ,
2980+ baseUrl : "https://api.openai. com/v1 " ,
29812981 authMode : "key" ,
29822982 apiKey : "combo-compact-key" ,
29832983 } ,
@@ -2993,12 +2993,12 @@ describe("combo compact failover", () => {
29932993 return chatStream ( "compact backup" ) ;
29942994 } ) ;
29952995 const { config } = canonicalPoolConfig ( [
2996- { provider : "openai" , model : "gpt-5.4" } ,
2996+ { provider : "openai-apikey " , model : "gpt-5.4" } ,
29972997 { provider : "backup" , model : "m1" } ,
29982998 ] , baseUrl ( b ) ) ;
29992999 globalThis . fetch = ( async ( input : unknown , init ?: RequestInit ) => {
30003000 const url = typeof input === "object" && input !== null && "url" in input ? String ( ( input as Request ) . url ) : String ( input ) ;
3001- if ( url . includes ( "chatgpt .com" ) ) {
3001+ if ( url . includes ( "api.openai .com" ) ) {
30023002 return Response . json ( { error : { message : "rate limited" } } , { status : 429 } ) ;
30033003 }
30043004 return originalFetch ( input as RequestInfo , init ) ;
@@ -3019,7 +3019,7 @@ describe("combo compact failover", () => {
30193019 const attempts = log . attempts as Array < Record < string , unknown > > ;
30203020 expect ( attempts ) . toHaveLength ( 2 ) ;
30213021 expect ( attempts [ 0 ] ) . toMatchObject ( {
3022- provider : "openai" ,
3022+ provider : "openai-apikey " ,
30233023 adapter : "openai-responses" ,
30243024 status : 429 ,
30253025 } ) ;
@@ -3028,15 +3028,17 @@ describe("combo compact failover", () => {
30283028
30293029 test ( "combo compact runs the synthetic turn as SSE so a canonical child can serve it" , async ( ) => {
30303030 const bodies : Array < Record < string , unknown > > = [ ] ;
3031- const { config } = canonicalPoolConfig ( [ { provider : "openai" , model : "gpt-5.4" } ] ) ;
3031+ const { config } = canonicalPoolConfig ( [ { provider : "openai-apikey " , model : "gpt-5.4" } ] ) ;
30323032 globalThis . fetch = ( async ( input : unknown , init ?: RequestInit ) => {
3033- const url = input instanceof Request ? input . url : String ( input ) ;
3034- if ( ! url . includes ( "chatgpt.com" ) ) {
3033+ const url = typeof input === "object" && input !== null && "url" in input
3034+ ? String ( ( input as Request ) . url )
3035+ : String ( input ) ;
3036+ if ( ! url . includes ( "api.openai.com" ) ) {
30353037 return originalFetch ( input as RequestInfo , init ) ;
30363038 }
30373039 // Only the codex/responses child turn is under test; side probes (e.g. the
30383040 // wham/usage quota check) just get a tolerated non-2xx.
3039- if ( ! url . includes ( "backend- api/codex /responses" ) ) {
3041+ if ( ! url . includes ( "api.openai.com/v1 /responses" ) ) {
30403042 return Response . json ( { error : { message : "probe not under test" } } , { status : 403 } ) ;
30413043 }
30423044 const body = JSON . parse ( String ( init ?. body ?? "{}" ) ) as Record < string , unknown > ;
@@ -3051,7 +3053,7 @@ describe("combo compact failover", () => {
30513053 response : {
30523054 id : "resp_compact" ,
30533055 status : "completed" ,
3054- output : [ { type : "compaction" , encrypted_content : encodeCompactionSummary ( "compact summary" ) } ] ,
3056+ output : [ { type : "compaction" , encrypted_content : "gAAAAABm-native-openai-ciphertext" } ] ,
30553057 } ,
30563058 } ;
30573059 return new Response ( [
@@ -3068,11 +3070,11 @@ describe("combo compact failover", () => {
30683070 const response = await postCompactLogged ( config ) ;
30693071 expect ( response . status ) . toBe ( 200 ) ;
30703072 const json = await response . json ( ) as { output ?: unknown [ ] } ;
3071- expect ( JSON . stringify ( json . output ) ) . toContain ( "compact summary" ) ;
3073+ expect ( json . output ) . toEqual ( [ expect . objectContaining ( {
3074+ type : "compaction" , encrypted_content : "gAAAAABm-native-openai-ciphertext" ,
3075+ } ) ] ) ;
30723076 expect ( bodies ) . toHaveLength ( 1 ) ;
30733077 expect ( bodies [ 0 ] ! . stream ) . toBe ( true ) ;
3074- // Canonical children keep the native compaction_trigger item — only
3075- // non-native targets get the summarizer prompt injected (covered above).
3076- expect ( JSON . stringify ( bodies [ 0 ] ! . input ) ) . toContain ( "compaction_trigger" ) ;
3078+ expect ( JSON . stringify ( bodies [ 0 ] ! . input ) ) . toContain ( "CONTEXT CHECKPOINT COMPACTION" ) ;
30773079 } ) ;
30783080} ) ;
0 commit comments