I feel like this is likely to be suggested before and it's likely that there's a reason you all choose not to do this, but just in the rare case it hasn't been considered...
When I get logged out of my Kagi session I usually am unaware of it and I find out because I've used my browser's address bar that redirects to Kagi to run the query. However, if I'm not logged in, it takes me to the landing page and I log in, but my query was lost in translation.
This is particularly frustrating on a mobile phone where time is typically highly valued. Re-typing a search query is frustrating.
If Kagi redirects you to log in from the search (?q=) feature, keep the search either in the query parameter to redirect or store it in session to redirect after a successful log in attempt.