- Track failed tool calls in call history (parse errors, execution errors)
- Increment turns counter for failed tool calls too
- Stuck detection now works even when tools fail repeatedly
- Inspired by Ruflo and Hermes Agent best practices
Fixes the bug where zCode would get stuck in infinite loops when tool calls fail.
Test results: 16/16 tests passing (100% success rate)
- ✅ Reposted question detection (3/3)
- ✅ Stuck detection with failed tool calls
- ✅ Mixed successful and failed calls
- ✅ Insufficient calls detection
- ✅ Greeting detection (4/4)
- ✅ Status detection (2/2)
- ✅ Normal message detection (3/3)