debug: add detailed error reporting for session detail serialization

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) <noreply@anthropic.com>
This commit is contained in:
2026-03-20 06:20:27 +00:00
parent 7518fe643b
commit 5eeff0c83a

View File

@@ -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 ──