Skip to content

bug(monitoring): POST /check still reports a measured 0% uptime and 0 ms latency as null (sibling of #4685) #4702

Open

Description

@vybe

Problem

perform_health_check builds its response with the same truthiness test that #4685 fixed in the router:

# src/backend/services/monitoring_service.py:858-859
uptime_percent_24h=round(uptime, 2) if uptime else None,
avg_latency_24h_ms=round(avg_latency, 2) if avg_latency else None

A measured 0.0 (an agent down for the whole 24 h window, or a measured 0 ms latency) is falsy, so these paths report null, which consumers read as "never measured":

  • POST /api/monitoring/agents/{name}/check (routers/monitoring.py:575), and the MCP check tool that wraps it
  • the first-ever-check path of GET /api/monitoring/agents/{name} (routers/monitoring.py:425)

#4699 (Fixes #4685) fixed only the router's own builder. The issue named only the router, so the PR was correct for its scope; this one is the sibling found by the merge train on 2026-11-21.

Acceptance criteria

  • Both fields use is not None, so only a missing measurement is null
  • A test drives POST /api/monitoring/agents/{name}/check (or perform_health_check) for an agent whose only checks are unreachable / 0 ms and asserts 0.0 for both fields; reverting to truthiness turns it red

Activity

  1. added
    priority-p3
    type-bug
    theme-reliability
    complexity-low
    status-ready
    on Nov 21, 2026
  2. added
    status-in-dev
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p3status-in-devstatus-readytheme-reliabilitytype-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions