@@ -550,6 +550,54 @@ describe("openclaw live updater", () => {
550550 ] ) ;
551551 } ) ;
552552
553+ test ( "routes managed Gateway health through the injected port" , ( ) => {
554+ const { root, mirror } = makeFixture ( ) ;
555+ writeBuild ( mirror ) ;
556+ const entrypoint = path . join ( mirror , "dist/index.js" ) ;
557+ const callsPath = path . join ( root , "managed-probe-calls.jsonl" ) ;
558+ writeFileSync (
559+ entrypoint ,
560+ `import { appendFileSync } from "node:fs";
561+ const args = process.argv.slice(2);
562+ appendFileSync(${ JSON . stringify ( callsPath ) } , JSON.stringify({
563+ args,
564+ port: process.env.OPENCLAW_GATEWAY_PORT,
565+ }) + "\\n");
566+ if (args.includes("--port")) process.exit(2);
567+ ` ,
568+ ) ;
569+
570+ verifyGatewayReadiness (
571+ ( ) => {
572+ throw new Error ( "managed probes must use the exact built Gateway CLI" ) ;
573+ } ,
574+ mirror ,
575+ git ( mirror , "rev-parse" , "HEAD" ) ,
576+ ( ) => { } ,
577+ {
578+ configPath : path . join ( root , "openclaw.json" ) ,
579+ entrypoint,
580+ executable : process . execPath ,
581+ invocationPrefix : [ entrypoint ] ,
582+ port : 18789 ,
583+ runtime : process . execPath ,
584+ } ,
585+ ) ;
586+
587+ expect (
588+ readFileSync ( callsPath , "utf8" )
589+ . trim ( )
590+ . split ( "\n" )
591+ . map ( ( line ) => JSON . parse ( line ) ) ,
592+ ) . toEqual ( [
593+ {
594+ args : [ "gateway" , "status" , "--deep" , "--require-rpc" , "--json" ] ,
595+ port : "18789" ,
596+ } ,
597+ { args : [ "health" , "--verbose" , "--json" ] , port : "18789" } ,
598+ ] ) ;
599+ } ) ;
600+
553601 test ( "bounds built Gateway CLI probes and cleans their config overlay" , ( ) => {
554602 const { root, mirror } = makeFixture ( ) ;
555603 writeBuild ( mirror ) ;
0 commit comments