Skip to content

serviceHealth reports 'All containers healthy' for exited or missing containers #114

Closed

Description

@TMHSDigital

Summary

homelab_serviceHealth reports "All containers healthy." when a container has crashed (exited) or when the requested service does not exist.

Where

  • mcp-server/src/tools/serviceHealth.ts:22, :32, :36
  • mcp-server/src/prompts.ts:22 (morning-health-check asks for "unhealthy, restarting or exited" containers via this tool)

Details

  • It uses docker ps without -a, so exited/dead containers are never listed.
  • --format "table ..." always prints a header row, so ps || "No containers found." never triggers.
  • Only health=unhealthy is checked, so anything not running is treated as healthy.

Impact

The main health tool, and the daily health-check prompt built on it, report a healthy lab while a service is down.

Steps to reproduce

  1. docker stop <some container> on the Pi.
  2. Call homelab_serviceHealth: the container is missing from the list and the result ends with "All containers healthy."
  3. Call it with service: "doesnotexist": header row plus "All containers healthy."

Suggested fix

Use docker ps -a, list containers whose state is exited, dead, restarting or created as problems, keep the unhealthy check, and report "No containers matched" when there are no data rows.

Acceptance criteria

  • Exited and restarting containers are reported as problems.
  • A non-matching service returns a clear "no container" message.
  • Handler tests cover both cases.

Getting started

  • Relevant files: mcp-server/src/tools/serviceHealth.ts, mcp-server/src/tools/__tests__/handlers.test.ts
  • How to run tests: cd mcp-server && npm install && npm test

Filed by repo-audit/full-audit at a59395f. Severity: medium. Effort: S. audit-key: bug|mcp-server/src/tools/serviceHealth.ts|register

Activity

  1. added
    bug
    good first issue
    severity: medium
    on Nov 18, 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

    buggood first issuemcp-serverseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions