I agree with Tom, this almost definitely NOT a problem with buildup on the valves. Valves that stick or don't seat right are almost never an intermittent problem, they just get worse until you fix it or the engine quits running. They are also ALWAYS accompanied by some kind of 'backfire' noise, which you definitely would have noticed.
This sounds like you have a problem with your fuel/air mixture which is dependent on a number of sensors in the engine and powertrain. Tom might be close with his idea about the program that controls the transmission, but I think it's more likely a problem with an engine sensor, or with the program that controls the engine. These programs share information, so it can be hard to pinpoint exactly where the problem is.
A bad knock sensor, or MAF sensor, or throttle position sensor could cause this problem. If the check engine light is on, it would be good to see if any of the codes relate to these. A bad spark plug wire can also cause this, though if that's the problem you will usually see some flickering on the dash lights when the engine hesitates.
It could also be as simple as a fuel pump getting sluggish, if this still has the original in it, or as simple as a fuel filter, if you've been paying mechanics to change things like that. I once fixed a Suzuki for a person that was stalling every time they came to a stop... it turned out that the vehicle had a non-standard air filter, so when she took the vehicle for service, they just weren't changing it. When I pulled the old air filter out, it looked like a brick made of dirt!
I might be able to give you a clearer idea if you can tell me what (if any) OBD trouble codes came up when they ran the engine scan, and what the mileage is on this vehicle. I'm assuming you get regular maintenance done (oil changes, etc.), but again, it can be hard to trust people to do the simplest things correctly when you hire them out!
It's only been sent out twice, once to the mechanic my husband selected before he died, and then to this new one, who's business name is John's Suby Repair.
He said that no codes came up when they checked. Mileage around 99,990. Yes, regular maintenance as long as he owned it, from November 2018.
I've been researching this more, and it seems to be a very common problem on 2013-2015 models. There doesn't seem to be an agreed upon 'fix' for this, though a couple people have reported that the problem went away after having the dealership clear/reprogram the engine and powertrain modules.
I have found a popular work-around... many people have noted that this seems to be a problem with the transmission not shifting into a low enough gear when slowing down, and that shifting the car down into "L" when coming to a stop, then leaving it in "L" when starting until the engine reaches 2000-2500 rpm, seems to take care of the hesitation. Of course, this will only work if your vehicle has an automatic transmission, and seems to work best on cars with CVT transmissions.
It looks like this is a recurring software issue either way, that Subaru either can't fix, or is choosing to ignore. I'll keep my eyes open, and if I see anything that looks like a real fix for this, I'll send you the link.
It doesn't happen with acceleration from a stop but when one is just riding down the road. Tom says this car has the automatic CVT transmission. We've also done the disconnect the battery to reset thing, which helped briefly.
Thank you for putting the time into this! It's a help to know what you found.
That makes your problem a little different than the common problem, which only happens when accelerating from speeds below 5mph. Hard to say exactly where it would be, but I would first check the air and fuel systems and sensors. Especially the sensors, since the battery reset helped for a while. It's very likely one of them is near failure or has an intermittent connection problem. This wouldn't necessarily throw a 'check engine' code, but daily scans might reveal a 'pending' trouble code. Also check the 02 sensors, they're used to regulate the fuel/air mixture, and their wires tend to get exposed to a lot of heat. Corrosion on electrical plugs is also a very frustrating nuisance in the NorthEast.
If there's nothing there, look very closely at the whole air intake assembly. Very small leaks around the air intake can sometimes cause low or negative airflow in certain conditions (basically, the right cross-draft can suck the air out of the engine), causing intermittent loss of power and hesitant acceleration.
Just thought I'd mention... if you don't have an OBDII scanner (code reader) at home, they sell bluetooth enabled scanners for around $10 that work with a free app on your phone, and will do everything (or more) than your local mechanic's $300 scan tool. They can be super helpful for seeing what's going with the engine and powertrain while the hesitation is actually happening.
My husband had a little thing like that, no idea what version. Tom says it's still in the car, if I ever get it back from the mechanic's...
I've passed this conversation onto Tom...