From d0db9cf6d40d888b34b182ba32e72a644dac0d2f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 20:36:14 +0000 Subject: [PATCH 1/2] Initial plan From cf61b5ea4f3752b74d162f2b80485acb3159a471 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 20:39:37 +0000 Subject: [PATCH 2/2] fix: compute quality_avg as average final_score instead of completion rate Co-authored-by: rafaelob <814981+rafaelob@users.noreply.github.com> --- .../ailine_runtime/api/routers/observability.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/runtime/ailine_runtime/api/routers/observability.py b/runtime/ailine_runtime/api/routers/observability.py index 2ce4301..c0f3a17 100644 --- a/runtime/ailine_runtime/api/routers/observability.py +++ b/runtime/ailine_runtime/api/routers/observability.py @@ -118,17 +118,22 @@ async def observability_dashboard( # Provider status provider_info = obs_store.get_provider_status() + # Compute average quality score from completed traces with a valid final_score + completed_quality_scores = [ + t.final_score + for t in recent_traces + if t.status == "completed" and t.final_score is not None + ] + quality_avg_value = sum(completed_quality_scores) / max( + len(completed_quality_scores), 1 + ) + return { # Flat fields expected by the frontend ObservabilityDashboard interface "provider": provider_info.get("name", "unknown"), "model": provider_info.get("model", "unknown"), "scores": { - "quality_avg": round( - sum(1 for t in recent_traces if t.status == "completed") - / max(len(recent_traces), 1) - * 100, - 1, - ), + "quality_avg": round(quality_avg_value, 1), "latency_p50_ms": round(latency_percentiles.get("p50", 0) * 1000, 1), "latency_p95_ms": round(latency_percentiles.get("p95", 0) * 1000, 1), },