@@ -1372,7 +1372,9 @@ describe("readSystemdServiceExecStart", () => {
13721372 execFileMock . mockReset ( ) ;
13731373 execFileMock . mockImplementation ( ( command , args , options , callback ) => {
13741374 expect ( command ) . toBe ( "busctl" ) ;
1375- expect ( options . timeout ) . toBe ( 1234 ) ;
1375+ expect ( options . timeout ) . toEqual ( expect . any ( Number ) ) ;
1376+ expect ( options . timeout ) . toBeGreaterThan ( 0 ) ;
1377+ expect ( options . timeout ) . toBeLessThanOrEqual ( 1234 ) ;
13761378 expect ( options . killSignal ) . toBe ( "SIGKILL" ) ;
13771379 if ( args . includes ( "LoadUnit" ) ) {
13781380 expect ( args ) . toEqual ( [
@@ -1423,6 +1425,23 @@ describe("readSystemdServiceExecStart", () => {
14231425 expect ( execFileMock ) . toHaveBeenCalledTimes ( 2 ) ;
14241426 } ) ;
14251427
1428+ it ( "bounds manager lookup for callers without a timeout before local fallback" , async ( ) => {
1429+ mockReadGatewayServiceFile ( [ "[Service]" , "ExecStart=/usr/bin/openclaw gateway run" ] ) ;
1430+ execFileMock . mockReset ( ) ;
1431+ execFileMock . mockImplementation ( ( command , _args , options , callback ) => {
1432+ expect ( command ) . toBe ( "busctl" ) ;
1433+ expect ( options . timeout ) . toEqual ( expect . any ( Number ) ) ;
1434+ expect ( options . timeout ) . toBeGreaterThan ( 0 ) ;
1435+ expect ( options . timeout ) . toBeLessThanOrEqual ( 5_000 ) ;
1436+ callback ( createExecFileError ( "manager query timed out" ) , "" , "manager query timed out" ) ;
1437+ } ) ;
1438+
1439+ const command = await readSystemdServiceExecStart ( { HOME : TEST_SERVICE_HOME } ) ;
1440+
1441+ expect ( command ?. programArguments ) . toEqual ( [ "/usr/bin/openclaw" , "gateway" , "run" ] ) ;
1442+ expect ( execFileMock ) . toHaveBeenCalledTimes ( 1 ) ;
1443+ } ) ;
1444+
14261445 it ( "loads OPENCLAW_GATEWAY_TOKEN from EnvironmentFile" , async ( ) => {
14271446 const readFileSpy = mockReadGatewayServiceFile (
14281447 [ "[Service]" , "ExecStart=/usr/bin/openclaw gateway run" , "EnvironmentFile=%h/.openclaw/.env" ] ,
0 commit comments