It was not really harassment warfare, there are so many times 诸葛亮need to retreat coz the food not enough, their supply line is too long.
And most of the times, 司马懿just ignore him totally and refuse to fight until his supply line got problem then retreat. You called that got advantage?
Zhu ge liang is wasting his own country resources by all the 北伐。
and that is the restriction they faced. but sima yi having a much bigger army stationed there, used up more food and resources just keeping an eye on shu.
this is a battle of attrition. shu ish like japan attacking pearl harbour. u think they can sue peace immediately after they destroy pearl harbour? u think shu can immediately sue peace after their first northern campaign? win or lose they will have to carry on becos wei ish not gonna let them off anyway.
that is oso why sima yi had to choose the least risky route, ie not to engage shu. just like americans not retaliating from 1941-43 but played defensive. becos supplies not steady. he was already spending more resources than ZGL cos he gotta maintain a bigger army, if he engaged shu wilfully and accidentally lost, the depletion on his side is even bigger.
and ZGL actions also posed some form of deterrance to wei, that they are always ready for war.