Bug
In finbot/agents/base.py, _connect_mcp_servers() is called at line 78, but the try block doesn't start until line 99. If the MCP server connection fails (network timeout, DNS failure, server down), the exception propagates unhandled and crashes the entire agent loop.
# line 78 — outside try
await self._connect_mcp_servers()
# ... lines 80-98 ...
try: # line 99
for iteration in range(max_iterations):
Impact
- Any network error during MCP server connection kills the agent with no recovery
- No error event is emitted, so CTF event bus never learns the agent failed
- Users see an unhandled exception instead of a graceful degradation
Suggested Fix
Move _connect_mcp_servers() inside the existing try block, or wrap it in its own try/except with graceful fallback:
try:
await self._connect_mcp_servers()
except Exception as e:
logger.error("MCP server connection failed: %s", e)
# Continue without MCP tools, or raise a clear AgentError
Affected Files
finbot/agents/base.py (line 78)
Bug
In
finbot/agents/base.py,_connect_mcp_servers()is called at line 78, but thetryblock doesn't start until line 99. If the MCP server connection fails (network timeout, DNS failure, server down), the exception propagates unhandled and crashes the entire agent loop.Impact
Suggested Fix
Move
_connect_mcp_servers()inside the existingtryblock, or wrap it in its owntry/exceptwith graceful fallback:Affected Files
finbot/agents/base.py(line 78)