From d399caadc9f434960f90a98f8aa5091da0897edf Mon Sep 17 00:00:00 2001 From: menzelj Date: Wed, 24 Jun 2026 11:31:19 +0000 Subject: [PATCH] Dashboard: surface the real compute_fleet error in the response (0.38.2) The fleet endpoint returned a bare 500, so the error banner only showed "status code 500" with no cause. Wrap the call to log the full traceback server-side and return the exception type, message and originating file:line in the HTTP detail, so the dashboard banner pinpoints the failure for an authenticated user. Co-Authored-By: Claude Opus 4.8 --- backend/routers/dashboard.py | 20 ++++++++++++++++++-- backend/version.py | 2 +- frontend/package.json | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/backend/routers/dashboard.py b/backend/routers/dashboard.py index 466d286..4f9b6a2 100644 --- a/backend/routers/dashboard.py +++ b/backend/routers/dashboard.py @@ -1,7 +1,10 @@ """Dashboard aggregation endpoint (fleet-wide cockpit data).""" from __future__ import annotations -from fastapi import APIRouter, Depends +import logging +import traceback + +from fastapi import APIRouter, Depends, HTTPException from sqlmodel import Session from auth import get_current_user @@ -9,6 +12,8 @@ from database import get_session from models.user import User from services import dashboard_service +logger = logging.getLogger("stackpilot.dashboard") + router = APIRouter(prefix="/api/dashboard", tags=["dashboard"]) @@ -20,4 +25,15 @@ async def fleet( ) -> dict: """Fleet-wide 'needs attention' list, KPIs and per-host rollup across the local host and every agent — the data behind the operator cockpit.""" - return await dashboard_service.compute_fleet(session, refresh=refresh) + try: + return await dashboard_service.compute_fleet(session, refresh=refresh) + except Exception as exc: # noqa: BLE001 — surface the real cause for diagnosis + logger.exception("compute_fleet failed") + # Deepest frame pinpoints where it broke; safe to expose to the + # authenticated user and it makes the dashboard error banner actionable. + tb = traceback.extract_tb(exc.__traceback__) + where = f" at {tb[-1].filename.split('/')[-1]}:{tb[-1].lineno}" if tb else "" + raise HTTPException( + status_code=500, + detail=f"{type(exc).__name__}: {exc}{where}", + ) from exc diff --git a/backend/version.py b/backend/version.py index 1b3e05a..7833fbb 100644 --- a/backend/version.py +++ b/backend/version.py @@ -1,3 +1,3 @@ """Single source of truth for the StackPilot release version.""" -APP_VERSION = "0.38.1" +APP_VERSION = "0.38.2" diff --git a/frontend/package.json b/frontend/package.json index 3ed346d..28acc4b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "stackpilot-frontend", "private": true, - "version": "0.38.1", + "version": "0.38.2", "type": "module", "scripts": { "dev": "vite",