If neither you nor your opponent time out from Flash lagging because you tabbed out or the connection breaking, you will simply end your turn by waiting.
AI only takes over if a player times out. Obviously it can't take over if you're still in the game and watching it, so AI can never win any rewards for you. However, on your opponent's end, they can still lose to your AI.