It seems as I run into a common issue with my Raspberry 4. After an indeterministic uptime, the wifi stops working.
This bash script checks for wireless internet connection and, if it is failing, tries to fix it.
It is simple and it seems to work.
I just have to write some automation to roll it out automatically including a corresponding cron job once I find some time.