This Answer provides an entirely different method of solving the present problem, based on treating the box and surroundings as a closed system (and thus using the closed system version of the first law of thermodynamics). This is the approach alluded to by @pglpm in one of his comments. Rather than considering the surroundings outside the box as being infinite, we consider the gas outside the box as being enclosed within a larger adiabatic container of finite volume. We then solve this problem in the limit as the outer container volume becomes infinite.
Here are the parameters employed in the present analysis:
Box:
$n_0$ = number of moles of gas in box initially
V = Volume of box
$T_0$ = Initial Temperature
$p_0$ = Initial Pressure
n = number of moles in box in final state
T = Temperature in box in final state
p* = Pressure in box in final state (identical to final pressure outside box)
Outside Enclosure:
$n_{s0}$ = number of moles of gas in enclosure initially
$V_s$ = Volume of enclosure
$T_0$ = Initial temperature
p = Initial pressure
$n_s$ = Final number of moles in enclosure
T* = Final temperature of gas in enclosure
p* = Final pressure of gas in enclosure (identical to final pressure in box)
From the ideal gas law, we have: $$n_0=\frac{p_0V}{RT_0}\tag{1a}$$ $$n=\frac{p^*V}{RT}\tag{1b}$$ $$n_{s0}=\frac{pV_S}{RT_0}\tag{1c}$$ $$n_s=\frac{p^*V_S}{RT^*}\tag{1d}$$
As shown in Example 6.10 of Fundamentals of Engineering Thermodynamics by Moran et al, when a gas within an adiabatic enclosure escapes very slowly (in our case into the box), the gas that still remains inside the enclosure at any time during the process has suffered an adiabatic reversible expansion. This means that the final pressure and temperature of the gas in the enclosure will be less than the initial pressure and temperature. Furthermore, quantitatively, we will have that: $$p^*\left(\frac{V_s}{n_s}\right)^{\gamma}=p\left(\frac{V_s}{n_{s0}}\right)^{\gamma}$$or equivalently, $$\frac{n_s}{n_{s0}}=\left(\frac{p^*}{p}\right)^{1/\gamma}$$or equivalently,$$n_s=\frac{pV_S}{RT_0}\left(\frac{p^*}{p}\right)^{1/\gamma}\tag{2}$$Moreover, we have: $$\frac{T^*}{T_0}=\left(\frac{p^*}{p}\right)^{\frac{\gamma - 1}{\gamma}}\tag{3}$$
For the closed system consisting of the box and the rigid insulated enclosure, there is no work done by the system on its surrounding and no heat exchange between the system and its surroundings. Therefore, from the version of the first law of thermodynamics applicable to a closed system, the change in internal energy of this combined system is zero. Initially, the gas in both the enclosure and the box are at the same temperature, $T_0$. In the final state of the system, the $n_s$ moles of gas in the enclosure are at T* and the n moles of gas in the box are at T. Therefore, from the first law: $$nC_v(T-T_0)+n_sC_v(T^*-T_0)=0\tag{4}$$From a mass balance on the system, the number of moles of gas in the initial state is equal to the number of moles of gas in the final state: $$n+n_s=n_0+n_{s0}\tag{5}$$If we substitute Eqns. 1 into Eqns. 4 and 5, we obtain:$$V\left(1-\frac{T_0}{T}\right)+V_S\left(1-\frac{T_0}{T^*}\right)=0\tag{6}$$and$$\left(V\frac{T_0}{T}+V_S\frac{T_0}{T^*}\right)=\frac{p_0V+pV_S}{p^*}\tag{7}$$ Combining Eqns. 6 and 7 yields: $$p^*=\frac{V_S}{(V_S+V)}p+\frac{V}{(V_S+V)}p_0\tag{8}$$According to Eqn. 8, the final pressure p* is just a weighted average of the initial pressures in the enclosure and the box, weighted in terms of the volumes of the two containers.
We can now determine the final temperature T* in the enclosure by combining Eqns 3 and 8 to yield: $$\frac{T^*}{T_0}=\left(\frac{V_S}{(V_S+V)}+\frac{V}{(V_S+V)}\frac{p_0}{p}\right)^{\frac{\gamma - 1}{\gamma}}\tag{9}$$
TO BE CONTINUEDIf we substitute this into Eqn. 6 and solve for T, the final temperature in the box, we obtain: $$\frac{T}{T_0}=\frac{1}{\left[1+\frac{V_S}{V}\left(1-\frac{\left(1+\frac{V}{V_S}\right)^{(\gamma-1)/\gamma}}{\left(1+\frac{V}{V_S}\frac{p_0}{p}\right)^{(\gamma-1)/\gamma}}\right)\right]}\tag{10}$$If we take the limit of this relationship as $V/V_S$ approaches zero (i.e., the volume of the enclosure becomes infinite), we obtain:$$\frac{T}{T_0}=\frac{\gamma}{1+(\gamma-1)(p_0/p)}\tag{11}$$ This is exactly the same result we obtained in the previous analysis using the open system version of the first law of thermodynamics.