File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -364,6 +364,21 @@ describe("gateway tool defaults", () => {
364364 expect ( call . deviceIdentity ) . toEqual ( mocks . deviceIdentity ) ;
365365 } ) ;
366366
367+ it ( "keeps the local approval runtime token for remote mode without a remote URL" , async ( ) => {
368+ mocks . configState . value = {
369+ gateway : {
370+ mode : "remote" ,
371+ } ,
372+ } ;
373+ mocks . callGateway . mockResolvedValueOnce ( { decision : "allow-once" } ) ;
374+
375+ await callGatewayTool ( "exec.approval.waitDecision" , { } , { id : "approval-id" } ) ;
376+
377+ const call = capturedGatewayCall ( ) ;
378+ expect ( call ) . not . toHaveProperty ( "deviceIdentity" ) ;
379+ expect ( call . approvalRuntimeToken ) . toEqual ( expect . any ( String ) ) ;
380+ } ) ;
381+
367382 it ( "does not send the local approval runtime token to env-selected gateways" , async ( ) => {
368383 process . env . OPENCLAW_GATEWAY_URL = "wss://gateway.example" ;
369384 mocks . callGateway . mockResolvedValueOnce ( { decision : "allow-once" } ) ;
Original file line number Diff line number Diff line change @@ -117,7 +117,13 @@ function resolveDefaultGatewayTarget(params: {
117117 // so loopback alone must not grant local approval-runtime authority.
118118 return "remote" ;
119119 }
120- return params . cfg . gateway ?. mode === "remote" ? "remote" : "local" ;
120+ if (
121+ params . cfg . gateway ?. mode === "remote" &&
122+ normalizeOptionalString ( params . cfg . gateway . remote ?. url )
123+ ) {
124+ return "remote" ;
125+ }
126+ return "local" ;
121127}
122128
123129function validateGatewayUrlOverrideForAgentTools ( params : {
You can’t perform that action at this time.
0 commit comments