|
Fix stop button responsiveness and shutdown CancelledError
Agent loop (_execute_tools_with_sink):
- Poll stop_event every 1s while draining the event sink via asyncio.wait_for
- When stopped, cancel the tool task, yield a synthetic ToolEvent failure,
append a cancellation message to session, yield StreamStopped, and return
- Pass stop_event into _execute_tools_with_sink call site
Subagent runner:
- Check stop_event at the start of each tool in turn_tool_calls loop
- Returns early with ("", False) when stopped mid-batch
McpManager.disconnect_all():
- Disconnect clients sequentially instead of asyncio.gather
- Handle asyncio.CancelledError per-client to avoid shutdown traceback
AppContainer.shutdown():
- Catch BaseException instead of Exception for MCP and DB cleanup
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
|---|
|
|
| navi/core/agent.py |
|---|
| navi/core/container.py |
|---|
| navi/core/subagent_runner.py |
|---|
| navi/mcp/manager.py |
|---|