It's a continuing task in that, after failure, the agent always gets a reward of 0
$0$ at each time-step ad infinitum.
From the book:
we could treat pole-balancing as a continuing task, using discounting. In this case the reward would be -1 on each failure and zero at all other times. The return at each time would then be related to -g^K$-\gamma^K$, where K where $K$ is the number of time steps before failure.
(Here I have used g as gamma
,$\gamma$ as the discount factor).
Said another way, assuming the agent fails in the (K + 1)th step the reward is 0
$0$ till that step, -1
$-1$ for it, and then 0
$0$ for eternity.
So the return: G_t = R_{t+1} + g R_{t+2} + g^2 R_{t+3} + ... + g^K R_{t+K+1} + ... = -g^K
$$G_t = R_{t+1} + \gamma R_{t+2} + \gamma^2 R_{t+3} + ... + \gamma^K R_{t+K+1} + ... = -\gamma^K$$