fix: graceful recovery from max tool iterations
Problem: When a mysis hit MaxToolIterations (10 tool calls in a turn), it would error out, transition to Errored state, and require manual restart. This broke autonomous operation and lost progress. Solution: Treat max iterations as a turn boundary, not a fatal error. - Log warning instead of returning error - Increment encouragement counter (if autonomous turn) - Return nil (success) to continue autonomous loop - All 10 tool calls already executed and stored Behavior: - Turn with user message hits limit → counter stays 0, continues - Autonomous turn hits limit → counter increments, continues - Third autonomous turn hits limit → counter reaches 3, goes idle - Broadcast after limit → resets counter, continues Truth table compliance: Verified by zoea-analyser agents - Maintains all state transitions from MESSAGE_FORMAT_GUARANTEES.md - Preserves autonomous operation - Graceful degradation instead of hard failure This completes the autonomous turn loop implementation: - Myses take up to 3 autonomous turns before idle - Complex multi-step workflows (10+ tool calls) handled gracefully - Progress preserved across turn boundaries - Natural idle transition after 3 encouragements Files changed: - internal/core/mysis.go (lines 718-749): Max iterations handling Related: fix/autonomous-loop-correct branch (commit 788254c) Verified: Two zoea-analyser agents confirmed safety and compliance
xonecas2026-02-08
7799e98ee58a20895bbcee7acab3bf517cd6fe28
parent 788254c