48b5287baf
When a tool like query_database fails (e.g., bad column name), the SQLAlchemy session enters a failed transaction state. Subsequent operations (like saving the assistant response) then also fail with InFailedSQLTransactionError. Fix: rollback the session in the except block of _execute_tool(). Also improved query_database tool description with correct column names (category_key not category) to help the AI write valid SQL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>