Step 3: Extract AntiStallMonitor from run_stream()
- Create navi/core/anti_stall.py with AntiStallMonitor class
- Encapsulates stall detection (todo progress + repeated tool calls)
- Encapsulates adaptive re-plan (failed todo step detection)
- Provides init() / pre_turn() / post_turn() two-phase interface
- Remove ~50 lines of stall/replan logic from agent.py run_stream()
- Remove _todo_status_snapshot and _todo_failed_steps helpers from agent.py
- Update AgentTurnContext: remove stall fields (now live in AntiStallMonitor)
- Add 13 unit tests for pre_turn and post_turn behavior

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent d004530 commit 8bd25a7196358017630579e1f4533b5ad95e10bb
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored on 16 May
Showing 4 changed files
View
navi/core/agent.py
View
navi/core/agent_run_context.py
View
navi/core/anti_stall.py 0 → 100644
View
tests/unit/core/test_anti_stall.py 0 → 100644