I think I have found how the bot gets its aiming scrambled when a visible enemy hides behind an obstacle, and ends up looking at the floor or at the sky. There's a bad decision somewhere, and the result is in the BotBodyTarget function (bot_combat.cpp), it adds vecRandom to the current value of vecEnemy and vecLastEnemyOrigin (through local static 'target'), while saving these values in the current pBot structure. It will do that for the next several game frames, each time adding vecRandom. I know that for sure because I've watched the code at work. I assume the defect doesn't appear while the enemy is visible because pBot->vecEnemy gets refreshed each frame.
I'm not sure what would be the correct fix, but, by commenting the line:
Code:
pBot->vecLastEnemyOrigin = target; // KWo - 25.01.2008
at the end of BotBodyTarget function, it seems to improve the bot's behavior.