Interesting. I am not 100% sure on this one.
The first thing that comes to mind is the "3 Consecutive Fouls" rules in the General Rules of Pocket Billiards.
Though not explicitly mentioned in some Cowboy pool rules, you should typically "fall back" on the "general rules of pocket billiards" and the "general rules of carom billiards" when something isn't specified in the game's rules.
The general rules of pocket billiards have an all-important "3 Consecutive Fouls" clause to prevent stalemate situations like this.
It says that if you foul three times in a row without making a legal shot in between those fouls, you lose the game automatically. So in your scenario, whoever did this first would lose the game if the players simply kept repeating the foul shot over and over.
6.14 Three Consecutive Fouls
If a player fouls three times without making an intervening legal shot, it is a serious foul.
"Serious fouls" typically result in the loss of the game)
Besides that, the only other thing I can think of is that some games have rules that force the shooter to have to "shoot away" from the object ball if the cue ball is directly touching it.
Again, I'm not completely certain on this, so hopefully someone else will weigh in.
If you are playing with friends, I suggest that before play starts, try to get everyone to agree to use either the "3 consecutive foul" rule or to abide by the "shoot away from touched object balls" rule for situations like the one you described.