Skip to content

Log every failed Healthchecks ping with its reason and show the last failures on the dashboard #4037

Closed

Description

@pithead-architect

What's the problem

When the appliance's Healthchecks ping fails, nothing on the box records why. dashboard/mining_dashboard/service/notify/healthchecks.py logs a ping that cannot reach the endpoint at DEBUG only, logs a non-2xx rejection once at WARNING, and records nothing to the store. So in the dashboard a failed ping is indistinguishable from a real outage — exactly the confusion the 2026-11-11 incident turned on. Child issue of #4032.

What it impacts

Every owner who self-monitors with the dead-man's switch, and the project when triaging a DOWN alert: without a local record of failed ping attempts and their reasons (Tor SOCKS timeout, DNS, connection error, HTTP status), a Tor-path failure and an actual stack outage look identical.

How I found it

From parent issue #4032: the 2026-11-11 production DOWN windows could not be confirmed; indirect evidence pointed at the Tor egress path but the appliance's own record would have said so. Verified in this checkout: healthchecks.py returns False on failure with at most a DEBUG log ("Healthchecks ping failed (offline?)") and a once WARNING for HTTP rejection; the dashboard's SQLite schema is dashboard/mining_dashboard/service/storage_schema.py, which already creates bounded history tables (e.g. events, network_history); the notifier already has test seams (tor_proxy injection, a clock argument) used by existing pytest.

How important is it

High: it is an explicit acceptance criterion of the owner-requested #4032 and the difference between "the box is down" and "our ping could not get out".

Acceptance criteria

  • Every failed ping attempt is recorded in a ring buffer in the dashboard's existing SQLite store: a new ping_failures(ts REAL, reason TEXT, detail TEXT) table in storage_schema.py, trimmed on insert to a bounded row count.
  • reason classifies the failure: tor_socks (SOCKS connect/timeout), dns, connect, http_status (with the status in detail). The exception mapping must be tested per class through the existing HealthchecksClient seams.
  • The recorded detail never contains the ping URL: a Healthchecks URL embeds the check UUID and is a credential. A test seeds a failing request and asserts the stored row contains none of the URL.
  • The health page shows the last ping failures (timestamp + reason), with a clear empty state, via the existing health/status API so both the page and the data endpoint carry it.
  • Recovery continues to work as today (throttle advances only on success); the ring write must never raise into the data loop.
  • Docs: docs/monitoring.md says what is recorded, where it is shown, and that the ping URL itself is never stored.

Possible solutions

Map requests exceptions to reason classes at the existing except requests.RequestException and status branches in HealthchecksClient.ping; keep the client pure (inject a recorder, default a no-op) so the throttle/rejection tests stay green; render the list in the same panel the health page already uses for events.

Parent: #4032

Worker brief: Test tier: tiers 1-3 only — dashboard logic and tests per the repo profile (uv run --extra test pytest modules you touch, the frontend node --test for any new client logic, biome on edited JS); no bench job needed, say so in the PR body. Do not run make test or Docker locally.

Implement ping-failure recording and display for parent issue #4032, per the acceptance criteria on the issue. Read dashboard/mining_dashboard/service/notify/healthchecks.py first (its module docstring sets the silent-on-offline discipline you are deliberately changing only for the local record), dashboard/mining_dashboard/service/storage_schema.py for the table pattern, and how the health page gets its data today. The ping URL is a secret: never log or store it, and test that. Write the pytest first: one row per reason class (Tor SOCKS, DNS, connect, HTTP status), a URL-never-stored assertion, and a ring-cap assertion. Keep healthchecks.py raise-free. Do not touch the support-bundle collection, the recovery CLI, or journald config — sibling child issues own those.

Activity

  1. added this to the v2.0.4 milestone on Nov 11, 2026
  2. added
    dashboard
    appliance
    P1-user-facing
    needs-triage
    size:S
    on Nov 11, 2026
  3. added a commit that references this issue on Nov 12, 2026
  4. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    Contributor

    Grouped with #4036, but PR #4053 does not close it: the worker left it out. Released for its own pick.

  5. added a commit that references this issue on Nov 13, 2026
  6. pithead-developer commented on Nov 13, 2026

    @pithead-developer
    Contributor

    Merged in #4053.

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

    P1-user-facingappliancedashboardneeds-triagesize:S

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions