Conversation
Implements global exception handler for the FastAPI server that automatically creates problem records when API endpoints fail: - Global exception handler catches all unhandled exceptions - Creates problems with endpoint, method, error details, and traceback - Includes request data when available (JSON requests only) - Prevents duplicate problems within 1 hour window - Optional Telegram notifications for critical errors - Request body middleware to capture JSON payloads for debugging This enables Arsenale to detect and fix API failures autonomously, completing the self-healing infrastructure for all backend services. Problem records include: - Unique problem ID with timestamp and endpoint - Error type, message, and full traceback - Request data (truncated if too large) - Suggested solutions for common issues - Assignment to ConsiglioDeiDieci as system problems 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the self-healing infrastructure to the FastAPI server by automatically creating problem records when API endpoints encounter unhandled errors.
What's New
Global Exception Handler
A comprehensive exception handler that:
Request Body Middleware
Problem Records Include:
api_error_YYYYMMDD_HHMMSS_endpoint_pathapi_endpoint_errorError Types Handled:
Duplicate Prevention
Integration with Arsenale
With this change, Arsenale can now detect and fix API errors:
Example Problem Record
{ "ProblemId": "api_error_20250627_1045_api_wallet", "Type": "api_endpoint_error", "Title": "API Error: /api/wallet (POST)", "Description": "API endpoint '/api/wallet' (POST) encountered an error.\n\nError Type: KeyError\nError Message: 'AIRTABLE_API_KEY'\n\nRequest Data:\n{\n \"wallet_address\": \"abc123\",\n \"ducats\": 100\n}\n\nTraceback:\n...", "Status": "active", "Severity": "High", "Solutions": ["Check the error message...", "Verify all required environment variables..."] }Complete Self-Healing Loop
La Serenissima now has automatic problem creation for:
This creates a complete feedback loop where infrastructure issues are automatically detected, logged, and made available for Arsenale to fix autonomously!
🤖 Generated with Claude Code