mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-15 17:25:04 -05:00
Adds comprehensive error logging for OpenRouter/OpenAI API errors to help diagnose issues like provider routing failures, context length exceeded, rate limits, etc. Changes: - Add _extract_api_error_details() to extract rich info from API errors including status code, response body, OpenRouter headers, etc. - Add _log_api_error() helper to log errors with context (session ID, message count, model, retry count) - Update error handling in _stream_chat_chunks() to use new logging - Update error handling in _generate_llm_continuation() to use new logging - Extract provider's error message from response body for better user feedback This helps debug issues like SECRT-1859 where OpenRouter returns 'provider returned error' with provider_name='unknown' without capturing the actual error details. Refs: SECRT-1859