From 5eeff0c83a0949db1c3cd3af9ba21f2a4b578178 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Fri, 20 Mar 2026 06:20:27 +0000 Subject: [PATCH] debug: add detailed error reporting for session detail serialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Temporary debug commit — surfaces the actual exception when GET /ai-sessions/{id} fails with 500, instead of generic "Internal server error" from middleware. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/api/endpoints/ai_sessions.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/app/api/endpoints/ai_sessions.py b/backend/app/api/endpoints/ai_sessions.py index d245b3bc..7b80b935 100644 --- a/backend/app/api/endpoints/ai_sessions.py +++ b/backend/app/api/endpoints/ai_sessions.py @@ -645,9 +645,16 @@ async def get_session( confidence_score=step.confidence_at_step, )) - detail = AISessionDetail.model_validate(session) - detail.steps = step_responses - return detail + try: + detail = AISessionDetail.model_validate(session) + detail.steps = step_responses + return detail + except Exception as e: + logger.exception("Failed to serialize session %s: %s", session_id, e) + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Session serialization error: {type(e).__name__}: {str(e)[:200]}", + ) # ── Documentation ──