Skip to content

fix(health): separate liveness probe from readiness checks - #225

Open
NP-compete wants to merge 1 commit into
redhat-data-and-ai:mainfrom
NP-compete:fix/livez-liveness-only-probe
Open

fix(health): separate liveness probe from readiness checks#225
NP-compete wants to merge 1 commit into
redhat-data-and-ai:mainfrom
NP-compete:fix/livez-liveness-only-probe

Conversation

@NP-compete

Copy link
Copy Markdown
Member

Summary

  • Add liveness_response() that returns a lightweight "process alive" check (uptime, version, shutdown state) with no dependency probing
  • Route /livez through liveness_response() so Kubernetes only restarts the pod when the process is genuinely stuck or shutting down
  • All other probe paths (/health, /healthz, /readyz) continue running full dependency checks

Closes #224

Test plan

  • test_livez_skips_dependency_checks -- verifies /livez does not call get_health_status()
  • test_readyz_runs_dependency_checks -- verifies /readyz still runs full checks and returns 503 on failure
  • test_alive_when_not_shutting_down -- verifies liveness returns 200 with "alive" status
  • test_503_when_shutting_down -- verifies liveness returns 503 during graceful shutdown
  • All 22 existing health tests continue to pass

The /livez endpoint previously ran full dependency checks (database,
Redis, OPA, MCP servers, LLM provider) identical to /readyz. A transient
database blip caused the liveness probe to return 503, triggering
unnecessary pod restarts instead of just draining traffic.

Add liveness_response() that returns a lightweight "process alive" check
(uptime, version, shutdown state) with no dependency probing. Route
/livez through it so Kubernetes only restarts the pod when the process
is genuinely stuck or shutting down.

Signed-off-by: Soham Dutta <19648293+NP-compete@users.noreply.github.com>
@NP-compete
NP-compete requested a review from a team as a code owner August 15, 2026 20:56
@NP-compete NP-compete self-assigned this Aug 15, 2026
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: c0e73d95-94bb-423c-9179-5e12e4bb0257

📥 Commits

Reviewing files that changed from the base of the PR and between c47e57f and a12b6c6.

📒 Files selected for processing (2)
  • deep_agent/aegra/health.py
  • tests/unit/aegra/test_health.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • redhat-data-and-ai/template-mcp (manual)
  • redhat-data-and-ai/template-ui (manual)

Walkthrough

The health module adds liveness_response and the /livez route. Liveness checks return 200 while active and 503 during shutdown without dependency checks. Other health paths retain shutdown handling and full dependency evaluation. Unit tests cover liveness, shutdown, dependency-check invocation, and readiness failures.

Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity>

Suggested reviewers: anish701

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement issue #224 by isolating /livez from dependency checks while preserving full checks for readiness and other health paths.
Out of Scope Changes check ✅ Passed The changes and tests stay within the linked issue scope of separating liveness and readiness health behavior.
Description check ✅ Passed The description accurately explains the liveness and readiness changes and includes relevant tests.
Title check ✅ Passed The title clearly and concisely describes separating liveness probes from readiness checks.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
🚀 Post-Merge Actions
  • Update changelog

Comment @coderabbitai help to get the list of available commands.

@NP-compete NP-compete changed the title Separate liveness probe from readiness dependency checks fix(health): separate liveness probe from readiness checks Aug 15, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

Liveness probe runs dependency checks, causing unnecessary pod restarts

2 participants