Digging into session issues I've found this keep-alive thing a little bit overcomplicated and unclear. The keep-alive setting handles two things: session keeping and new-mail checking. Some plugins also bind to keep-alive to do some recurring actions (e.g. to display calendar alarms, etc.).
I think we should split these functionalities. So keep-alive action should be used only for session keeping. In such case we need to execute keep-alive action only after some inactivity time (e.g. session_lifetime
Also it means we don't need a separate config option, because the interval would be calculated from session_lifetime. For session_lifetime=0 there would be no keep-alive requests.
Another thing is recurring check for new-mail. This would work as is, but... see below.
Last but not least. We should provide some "global" recurring action which would work across all tasks so, plugins could bind to it. One "global" action to minimize session race-conditions when few plugins will create their own recurring requests on the same time. In mail task we could "bind" our check-recent action to this global action.
In my opinion this would be a much clearer solution and would give as some additional possibilities:
executed less frequently
I think also, we could rename keep_alive option description ("Check for new messages on") into something like "Update system state (check for new mail, etc.) on", and move it to User Interface section, so we could use it as our global action interval.
ps. I'm not sure we should change draft auto-save interval in any way to fit into this. For simplicity would be nice to use the same global action and its interval.