From f2cb2448b7068b348fbd1ed54e5c650b1a73b40d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 8 Nov 2025 07:07:26 +0000 Subject: [PATCH] fix: Add missing reasoning and consequence fields to PO approval actions Error: 500 Internal Server Error on /dashboard/action-queue Pydantic validation error: ActionItem requires 'reasoning' and 'consequence' fields Root Cause: ----------- Purchase order approval actions were missing required fields: - Had: reasoning_data (dict) - not a valid field - Needed: reasoning (string) and consequence (string) The Fix: -------- services/orchestrator/app/services/dashboard_service.py line 380-396 Changed from: 'reasoning_data': {...} # Invalid field To: 'reasoning': 'Pending approval for {supplier} - {type}' 'consequence': 'Delayed delivery may impact production schedule' Now action items have all required fields for Pydantic validation to pass. Fixes the 500 error on action-queue endpoint. --- services/orchestrator/app/services/dashboard_service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/orchestrator/app/services/dashboard_service.py b/services/orchestrator/app/services/dashboard_service.py index 3e66f5da..2d9934a2 100644 --- a/services/orchestrator/app/services/dashboard_service.py +++ b/services/orchestrator/app/services/dashboard_service.py @@ -383,7 +383,8 @@ class DashboardService: "urgency": urgency, "title": f"Purchase Order {po.get('po_number', 'N/A')}", "subtitle": f"Supplier: {po.get('supplier_name', 'Unknown')}", - "reasoning_data": reasoning_data, # NEW: Structured data for i18n + "reasoning": f"Pending approval for {po.get('supplier_name', 'supplier')} - {reasoning_data.get('type', 'inventory replenishment')}", + "consequence": "Delayed delivery may impact production schedule", "amount": po.get("total_amount", 0), "currency": po.get("currency", "EUR"), "actions": [