[sblock=OOC-Fayden]To be clear, I believe it's a case of your animal "gets" an attack of opportunity, but doesn't choose to take it because of his command. You've only ordered him to Heel and Guard, and neither applies.
Guard: The animal stays in place and prevents others from approaching.
Heel: The animal follows you closely, even to places where it normally wouldn’t go.
As I think you already noticed, what I think you wanted to do was:
Defend: The animal defends you (or is ready to defend you if no threat is present), even without any command being given. Alternatively, you can command the animal to defend a specific other character.
I'll assume that you can make more than 1 attempt to handle animal during your turn as a free action, and assume after that at the end of your turn you attempted another handle-animal check as a free action (DC 10). 2 rolled + 4 pet + 4 skill succeeds (guess you only fail on a 1 this level). I assume you would want to attack?[/sblock]