Q. It could sometimes happen that someone (usually a child) will turn on a hot water tap on Shabbat. I’ve read in one place that it can’t be closed, except by asking a non-Jew. In another place I read that it would depend on how long it’s been on for: if it was just turned on, then its fine to shut it off yourself, but if it had been on a long time, then it would be assur to turn off the hot water tap (except by asking a non-Jew). In the case when you are not sure how long its been on, it seemed that one could be lenient.
So what is the Halacha in these various cases?
Thanks.

A. Shemiras Shabbos Kehilchoso (1: 48) rules that if by mistake one turned on the hot water tap on Shabbos, and cold water began entering the water heater, replacing the outgoing hot water, it would be prohibited to close the tap, since that would cause the cold water that entered to be heated. However he may indirectly suggest a Gentile to do so.
Horav Shlomo Miller’s Shlit’a opinion is that if one became aware immediately, he may close the tap with a shinui (change) such as using the back side of his hand.
If some time has elapsed, one may close the incoming cold water intake at the boiler itself, preferably with a shinui, as no melocho is done by not allowing cold water into the tank.
(See Shevet Hakehossi 6: 166, Piskei Teshuvos 254: n. 30 that explain the above as being a melocho sheino tzericho or an indirect unwanted work).

Rabbi A. Bartfeld as advised by Horav Shlomo Miller Shlit’a