Skip to content

fix(monitoring): report measured 0% uptime and 0 ms latency from perform_health_check - #4720

Merged
vybe merged 2 commits into
Abilityai:devfrom
pcbeingused333:fix/4702-perform-health-check-zero
Nov 23, 2026
Merged

vybe merged 2 commits into
Abilityai:devfrom
pcbeingused333:fix/4702-perform-health-check-zero

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #4702

Description

perform_health_check built uptime_percent_24h and avg_latency_24h_ms with a truthiness test (if uptime else None). A measured 0.0 (an agent down for the whole 24 h window, or a measured 0 ms latency) is falsy, so POST /api/monitoring/agents/{name}/check (and the MCP check tool wrapping it) and the first-check path of GET /api/monitoring/agents/{name} returned null, which consumers read as "never measured". Both fields now use is not None, as #4699 did for the router's own builder.

Related Issue

Fixes #4702

Journey Impact

Journey Impact: none: only the health check response changes, from null to 0.0 when 0 was measured

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Testing

  • I have tested this locally
  • New tests added (if applicable)
  • All existing tests pass

New tests/unit/test_4702_perform_health_check_zero.py (registered in tests/registry.json) drives perform_health_check with the probes and DB stubbed: a measured 0.0 uptime and 0.0 latency must come back as 0.0 (fails on dev with None), and no measurement at all still reads None. With the fix both pass, as does test_monitoring_dormant_skip.py.

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation (if applicable)
  • I have not committed any sensitive data (API keys, credentials, etc.)
  • My commits are signed off (git commit -s) — required for contributors outside the core team
  • I have added appropriate logging for new functionality

This PR was prepared with AI assistance (Claude Code); disclosed here as CONTRIBUTING asks.

🤖 Generated with Claude Code

pcbeingused333 and others added 2 commits November 22, 2026 00:25
…orm_health_check

perform_health_check built its 24h figures with a truthiness test, so a
measured 0.0 came back as None ("never measured") on POST
/api/monitoring/agents/{name}/check and the first-check path of the GET.
Use 'is not None', as Abilityai#4699 did for the router's own builder.

Fixes Abilityai#4702

Signed-off-by: Alex <[email protected]>
… — mechanical, per the merge-train note on the PR

- tests/unit/test_4702_perform_health_check_zero.py: register the module under test with
  monkeypatch.setitem instead of a bare sys.modules write (lint_sys_modules.py: 0 -> 1 violation)
- docs/memory/learnings/: fragment for the truthiness-zero class (Abilityai#4685, Abilityai#4699, Abilityai#4702)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Eugene Vyborov <[email protected]>
@vybe

vybe commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-11-22): on this train. Validated at 5698002ee: the fix is correct, and the new test drives the real perform_health_check (restoring either truthiness test turns it red). Thank you!

Two mechanical changes pushed to your branch as ddb2a2b02:

I also approved this fork's CI runs, so the checks will run now.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: batch validated on train/20261122-1848 (#4722)

@vybe
vybe merged commit 9c5bf62 into Abilityai:dev Nov 23, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants