In agent.py, both analyze_issues() and review_codebase() call json.loads() on Claude's output without any try/except. If the model returns malformed JSON (markdown-wrapped, truncated, or with commentary), the bot crashes with an unhandled JSONDecodeError that propagates up to the Telegram handler.
This affects at least three code paths:
- analyze_issues() (~line 77)
- review_codebase() (~line 139)
- Any caller that expects a list back gets an exception instead
Suggested fix: Wrap json.loads() in a try/except JSONDecodeError block. Log the raw response for debugging and return an empty list (or raise a domain-specific error with context). Also consider a more robust markdown-fence stripping regex, since the current approach only handles the exact pattern of backticks at start/end.
Identified by minbot code review
In agent.py, both analyze_issues() and review_codebase() call json.loads() on Claude's output without any try/except. If the model returns malformed JSON (markdown-wrapped, truncated, or with commentary), the bot crashes with an unhandled JSONDecodeError that propagates up to the Telegram handler.
This affects at least three code paths:
Suggested fix: Wrap json.loads() in a try/except JSONDecodeError block. Log the raw response for debugging and return an empty list (or raise a domain-specific error with context). Also consider a more robust markdown-fence stripping regex, since the current approach only handles the exact pattern of backticks at start/end.
Identified by minbot code review