@@ -358,7 +358,20 @@ describe("createFeishuWSClient proxy handling", () => {
358358 expect ( options . agent ) . toBeUndefined ( ) ;
359359 } ) ;
360360
361- it ( "creates a ws proxy agent when lowercase https_proxy is set" , async ( ) => {
361+ it ( "does not inherit ambient proxy env by default" , async ( ) => {
362+ process . env . https_proxy = "http://lower-https:8001" ;
363+ process . env . HTTPS_PROXY = "http://upper-https:8002" ;
364+ process . env . HTTP_PROXY = "http://upper-http:8999" ;
365+
366+ await createFeishuWSClient ( baseAccount ) ;
367+
368+ expect ( proxyAgentCtorMock ) . not . toHaveBeenCalled ( ) ;
369+ const options = firstWsClientOptions ( ) ;
370+ expect ( options . agent ) . toBeUndefined ( ) ;
371+ } ) ;
372+
373+ it ( "creates a ws proxy agent when explicitly enabled and lowercase https_proxy is set" , async ( ) => {
374+ process . env . OPENCLAW_FEISHU_WS_USE_PROXY = "1" ;
362375 process . env . https_proxy = "http://lower-https:8001" ;
363376
364377 await createFeishuWSClient ( baseAccount ) ;
@@ -368,7 +381,8 @@ describe("createFeishuWSClient proxy handling", () => {
368381 expect ( options . agent ) . toEqual ( { proxied : true } ) ;
369382 } ) ;
370383
371- it ( "creates a ws proxy agent when uppercase HTTPS_PROXY is set" , async ( ) => {
384+ it ( "creates a ws proxy agent when explicitly enabled and uppercase HTTPS_PROXY is set" , async ( ) => {
385+ process . env . OPENCLAW_FEISHU_WS_USE_PROXY = "1" ;
372386 process . env . HTTPS_PROXY = "http://upper-https:8002" ;
373387
374388 await createFeishuWSClient ( baseAccount ) ;
@@ -378,7 +392,8 @@ describe("createFeishuWSClient proxy handling", () => {
378392 expect ( options . agent ) . toEqual ( { proxied : true } ) ;
379393 } ) ;
380394
381- it ( "falls back to HTTP_PROXY for ws proxy agent creation" , async ( ) => {
395+ it ( "falls back to HTTP_PROXY when explicitly enabled" , async ( ) => {
396+ process . env . OPENCLAW_FEISHU_WS_USE_PROXY = "1" ;
382397 process . env . HTTP_PROXY = "http://upper-http:8999" ;
383398
384399 await createFeishuWSClient ( baseAccount ) ;
0 commit comments