I am a bit confused about this rationale. The argument seems to be that when we provide something outside the range of the function then the gradients will be some set value that is incorrect (and that could be anything) , however we can see in the above example that the returned gradient in the x<0 case is 0 which is in fact the correct gradient.  I made a slightly different example to illustrate it does not always return 0 and in fact seems to be returning the correct gradient:
from torch.autograd.functional import jvp, vjp

x2 = torch.tensor([-1.0, 1.0], requires_grad=True)
def log_1(x):
  return torch.log(x[1]) + 2 * x[0]

print(jvp(log_1, x2, torch.eye((2))[0,:])[1])
# prints 2

The issue here is that the first snippet in OPs examples is returning nans whilst the second snippet is returning the “correct” answer mathematically. Why is it not possible to make both return nans or both return the correct gradients ? why would this be expected behaviour ?  it feels like theres some set logic differentiating these two and the inconsistency really does not help with debugging. Is the difference that one outputs nans vs the other infs ?