Unveiling Pitfalls: Understanding Why AI-driven Code Agents Fail at GitHub Issue Resolution