Solution (source code)

= Solution

Independence of the slope estimate and residual variance, together with their normal and chi-square laws, gives the Student <pivotal quantity>
$$
\frac{\widehat\beta-\beta}{s/\sqrt{S_{xx}}}\sim t_{n-2}.
$$
Thus an exact Gaussian-model two-sided 95% <confidence interval> is
$$
\boxed{\widehat\beta\ \pm\ t_{n-2,0.975}\frac{s}{\sqrt{S_{xx}}}.}
$$
Using a normal quantile without estimating the variance uncertainty would not give this exact finite-sample coverage.