We consider a problem of sequential testing a simple hypothesis against a simple alternative, based on observations of a discrete-time stochastic process in the presence of a random horizon H. At any time n of the experiment, the statistician is only informed whether H > n or not. In this latter case, the experiment should be terminated and the final decision on the acceptance or rejection of the hypothesis should be taken on the basis of the available observations (). H is assumed to be independent of the observations, and its distribution is known to the statistician. Under the random horizon, we consider a variant of the modified Kiefer-Weiss problem: given restrictions on the probabilities of errors, minimize the average sample size calculated under the assumption that the observations follow a fixed distribution, not necessarily one of those hypothesized. Under suitable conditions on the process and/or the horizon, we characterize the structure of all optimal sequential tests in this problem. Then, we apply these results to characterize optimal tests in the case of independent observations. On the basis of the general theory, more specific results are obtained for independent and identically distributed (i.i.d.) observations with a geometrically distributed horizon. In a simple sampling model, we solve the Kiefer-Weiss problem under the random horizon model. We also discuss the questions of Wald-Wolfowitz optimality in the presence of the random horizon. In particular, we show that the stopping rules of the optimal tests, minimizing the average sample size under one of the hypotheses, are randomized versions of those of Wald’s sequential probability ratio tests.