I have a bot that can't edit pages after a few hours of inactivity. I save the cookies from a login request and use them in subsequent runs of a bot. Previously, it would work fine for months on end. But now the bot is no longer able to edit pages after a few hours of inactivity. According to an assert=user query, it's still logged in. But fetching a new csrf token and attempting to edit a page always fails with the error: badtoken: Invalid token. It works again after a new login.
I'm not sure exactly when this started happening, maybe a couple of months. I only just got around to investigating it, but haven't discovered much.
T89702 is something similar, but possibly pywikibot related. I'm not using pywikibot, and it's quite possible the problem is my misunderstanding of the API, or some change to the API.