Skip to content

fix: health check 503, bind to 127.0.0.1, standardize dependencies - #64

Merged
tarun-etikala merged 1 commit into
red-hat-data-services:mainfrom
tarun-etikala:fix/post-helm-fixes-clean
Apr 21, 2026
Merged

tarun-etikala merged 1 commit into
red-hat-data-services:mainfrom
tarun-etikala:fix/post-helm-fixes-clean

Conversation

@tarun-etikala

@tarun-etikala tarun-etikala commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Health check returns 503 when uninitialized — All 8 standard agents now return HTTP 503 (not 200) when the agent isn't ready, so K8s readiness probes correctly gate traffic. Matches the AutoGen pattern.
  • Bind local dev to 127.0.0.1 — Makefiles now use --host 127.0.0.1 in run-app/run-app-fresh targets. Container Dockerfiles remain at 0.0.0.0 for K8s networking.
  • Standardize FastAPI to >=0.135.1 — 6 agents bumped from >=0.129.0 or >=0.132.0.
  • Bump uvicorn in mcp_automl_template to >=0.41.0 — from >=0.30.0.
  • Remove env: init dependency in react_with_database_memory/Makefile — aligns with all other agents where env is standalone.

Files changed (23 + 1 doc)

Category Files Change
Health check 503 8 main.py Add JSONResponse import, return 503 when not initialized
127.0.0.1 binding 8 Makefile --host 0.0.0.0 → --host 127.0.0.1 (run-app + run-app-fresh)
FastAPI version 6 pyproject.toml >=0.129.0/>=0.132.0 → >=0.135.1
Uvicorn version 1 pyproject.toml >=0.30.0 → >=0.41.0 (mcp_automl_template)
Makefile dep fix 1 Makefile env: init → env: (react_with_database_memory)
Audit doc 1 md Updated resolved/accepted counts

Test plan

  • curl localhost:8000/health before agent init returns HTTP 503 with {"status": "not_ready", ...}
  • curl localhost:8000/health after agent init returns HTTP 200 with {"status": "healthy", ...}
  • make run-app binds to 127.0.0.1 (not reachable from other hosts)

@coderabbitai

coderabbitai Bot commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request updates FastAPI and Uvicorn version constraints, changes uvicorn host binds from 0.0.0.0 to 127.0.0.1 in several Makefiles, and modifies multiple /health endpoints to return HTTP 503 with "status": "not_ready" when agents are uninitialized, otherwise returning "healthy" and agent_initialized: true.

Changes

Cohort / File(s) Summary
FastAPI Dependency Updates
agents/autogen/mcp_agent/pyproject.toml, agents/google/adk/pyproject.toml, agents/langgraph/agentic_rag/pyproject.toml, agents/langgraph/react_agent/pyproject.toml, agents/langgraph/react_with_database_memory/pyproject.toml, agents/vanilla_python/openai_responses_agent/pyproject.toml
Bumped FastAPI minimum version constraints to >=0.135.1 (replacing earlier >=0.129.0/>=0.132.0).
Uvicorn Dependency Update
agents/autogen/mcp_agent/mcp_automl_template/pyproject.toml
Raised uvicorn[standard] minimum version from >=0.30.0,<1.0.0 to >=0.41.0,<1.0.0.
Server Binding / Makefile Changes
agents/crewai/websearch_agent/Makefile, agents/google/adk/Makefile, agents/langgraph/agentic_rag/Makefile, agents/langgraph/human_in_the_loop/Makefile, agents/langgraph/react_agent/Makefile, agents/langgraph/react_with_database_memory/Makefile, agents/llamaindex/websearch_agent/Makefile, agents/vanilla_python/openai_responses_agent/Makefile
Changed uvicorn host bind from 0.0.0.0 to 127.0.0.1 in run-app/run-app-fresh targets. Also removed env: init prerequisite in agents/langgraph/react_with_database_memory/Makefile.
Health Endpoint Behavior Changes
agents/crewai/websearch_agent/main.py, agents/google/adk/main.py, agents/langgraph/agentic_rag/main.py, agents/langgraph/human_in_the_loop/main.py, agents/langgraph/react_agent/main.py, agents/langgraph/react_with_database_memory/main.py, agents/llamaindex/websearch_agent/main.py, agents/vanilla_python/openai_responses_agent/main.py
Refactored /health handlers to compute initialized/agent_initialized, set status to "healthy" or "not_ready", add agent_initialized in body, and return JSONResponse(..., status_code=503) when not initialized; added JSONResponse import where applicable.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the three main changes: health check 503 status, binding to localhost, and standardizing dependencies across agents.
Description check ✅ Passed The description comprehensively covers all changes: health check 503 behavior, 127.0.0.1 binding, FastAPI/uvicorn dependency updates, and Makefile fixes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@tarun-etikala tarun-etikala reopened this Apr 16, 2026
@tarun-etikala
tarun-etikala marked this pull request as draft April 16, 2026 18:18
@tarun-etikala
tarun-etikala force-pushed the fix/post-helm-fixes-clean branch 2 times, most recently from e3c2d06 to 10f043c Compare April 20, 2026 02:51
@tarun-etikala
tarun-etikala marked this pull request as ready for review April 20, 2026 02:55

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
agents/langgraph/react_with_database_memory/Makefile (1)

20-25: ⚠️ Potential issue | 🟠 Major

make env can fail on a fresh checkout after dropping init.

Line 25 still unconditionally runs source .env; if .env is missing, make env now fails. This is a regression from the previous env: init behavior.

Proposed fix (keep standardization, avoid first-run failure)
 env: ## Create venv, load .env, and install dependencies
 	`@echo` "==> Creating virtual environment and installing dependencies..." && \
 	  rm -rf .venv && \
 	  uv sync --python 3.12 && \
+	  if [ ! -f .env ]; then cp .env.example .env; fi && \
 	  echo "==> Load .env variables..." && \
 	  source .venv/bin/activate && set -a && source .env && set +a && \
 	  echo "" && \
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@agents/langgraph/react_with_database_memory/Makefile` around lines 20 - 25,
The env Makefile target unconditionally runs "source .env" which causes make to
fail on a fresh checkout if .env is missing; update the env recipe (the env
target) to only source .env when the file exists (e.g., guard with a
file-existence check before running source .env) while preserving the set -a /
set +a behavior so environment variables are exported when .env is present and
the recipe still succeeds when it's absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@agents/google/adk/main.py`:
- Around line 414-418: Split liveness and readiness checks so liveness never
fails on startup: keep the current readiness logic that inspects runner
(initialized = runner is not None) and returns JSONResponse(status_code=503,
content=body) when not initialized on a dedicated readiness endpoint (e.g.,
/ready or keep /health as readiness), and add a separate liveness endpoint
(e.g., /live) that always returns a 200 OK body (or returns {"status":"alive"})
regardless of runner state; update the route handlers in main.py to use the
initialized variable and JSONResponse for readiness only and ensure the liveness
handler always returns a simple 200 response so probes do not trigger restart
loops.

---

Outside diff comments:
In `@agents/langgraph/react_with_database_memory/Makefile`:
- Around line 20-25: The env Makefile target unconditionally runs "source .env"
which causes make to fail on a fresh checkout if .env is missing; update the env
recipe (the env target) to only source .env when the file exists (e.g., guard
with a file-existence check before running source .env) while preserving the set
-a / set +a behavior so environment variables are exported when .env is present
and the recipe still succeeds when it's absent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 31e7c543-5bc9-45d3-9620-b44539ad2feb

📥 Commits

Reviewing files that changed from the base of the PR and between 5d3da79 and 10f043c.

📒 Files selected for processing (23)
  • agents/autogen/mcp_agent/mcp_automl_template/pyproject.toml
  • agents/autogen/mcp_agent/pyproject.toml
  • agents/crewai/websearch_agent/Makefile
  • agents/crewai/websearch_agent/main.py
  • agents/google/adk/Makefile
  • agents/google/adk/main.py
  • agents/google/adk/pyproject.toml
  • agents/langgraph/agentic_rag/Makefile
  • agents/langgraph/agentic_rag/main.py
  • agents/langgraph/agentic_rag/pyproject.toml
  • agents/langgraph/human_in_the_loop/Makefile
  • agents/langgraph/human_in_the_loop/main.py
  • agents/langgraph/react_agent/Makefile
  • agents/langgraph/react_agent/main.py
  • agents/langgraph/react_agent/pyproject.toml
  • agents/langgraph/react_with_database_memory/Makefile
  • agents/langgraph/react_with_database_memory/main.py
  • agents/langgraph/react_with_database_memory/pyproject.toml
  • agents/llamaindex/websearch_agent/Makefile
  • agents/llamaindex/websearch_agent/main.py
  • agents/vanilla_python/openai_responses_agent/Makefile
  • agents/vanilla_python/openai_responses_agent/main.py
  • agents/vanilla_python/openai_responses_agent/pyproject.toml

Comment thread agents/google/adk/main.py Resolved
@tarun-etikala
tarun-etikala marked this pull request as draft April 20, 2026 03:06
- Return HTTP 503 from /health when agent is uninitialized so K8s
  readiness probes correctly gate traffic (8 agents, audit #5)
- Bind local dev servers to 127.0.0.1 to prevent DNS rebinding
  attacks; container Dockerfiles remain at 0.0.0.0 (audit #36)
- Standardize FastAPI to >=0.135.1 across all agents (audit #33)
- Bump uvicorn in mcp_automl_template to >=0.41.0 (audit #34)
- Remove env:init dependency in react_with_database_memory (audit red-hat-data-services#46)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tarun-etikala
tarun-etikala force-pushed the fix/post-helm-fixes-clean branch from 10f043c to 3e252c7 Compare April 20, 2026 18:16
@tarun-etikala
tarun-etikala marked this pull request as ready for review April 20, 2026 18:59

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
agents/langgraph/react_with_database_memory/Makefile (1)

20-25: ⚠️ Potential issue | 🟠 Major

env target can fail on fresh setup after removing init dependency

Line 25 unconditionally runs source .env, but Line 20 no longer depends on init. On a fresh clone without .env, make env will fail before completing setup.

Suggested fix
-env: ## Create venv, load .env, and install dependencies
+env: init ## Create venv, load .env, and install dependencies
 	`@echo` "==> Creating virtual environment and installing dependencies..." && \
 	  rm -rf .venv && \
 	  uv sync --python 3.12 && \
 	  echo "==> Load .env variables..." && \
 	  source .venv/bin/activate && set -a && source .env && set +a && \

Or, if you want to keep env independent, add a guard/copy step before sourcing .env.

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@agents/langgraph/react_with_database_memory/Makefile` around lines 20 - 25,
The Makefile env target unconditionally sources .env which breaks on a fresh
clone since env no longer depends on init; update the env target (symbol: env)
to guard against missing .env by either adding the init dependency back or
inserting a conditional/guard before the source .env step (e.g., check for .env
existence and copy a .env.example or skip sourcing if absent), ensuring the rest
of the commands (uv sync, .venv activation) still run when .env is not present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@agents/langgraph/react_with_database_memory/Makefile`:
- Around line 20-25: The Makefile env target unconditionally sources .env which
breaks on a fresh clone since env no longer depends on init; update the env
target (symbol: env) to guard against missing .env by either adding the init
dependency back or inserting a conditional/guard before the source .env step
(e.g., check for .env existence and copy a .env.example or skip sourcing if
absent), ensuring the rest of the commands (uv sync, .venv activation) still run
when .env is not present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 31f3a765-7fe4-4f3a-9a27-d94dcc29f5c9

📥 Commits

Reviewing files that changed from the base of the PR and between 10f043c and 3e252c7.

📒 Files selected for processing (23)
  • agents/autogen/mcp_agent/mcp_automl_template/pyproject.toml
  • agents/autogen/mcp_agent/pyproject.toml
  • agents/crewai/websearch_agent/Makefile
  • agents/crewai/websearch_agent/main.py
  • agents/google/adk/Makefile
  • agents/google/adk/main.py
  • agents/google/adk/pyproject.toml
  • agents/langgraph/agentic_rag/Makefile
  • agents/langgraph/agentic_rag/main.py
  • agents/langgraph/agentic_rag/pyproject.toml
  • agents/langgraph/human_in_the_loop/Makefile
  • agents/langgraph/human_in_the_loop/main.py
  • agents/langgraph/react_agent/Makefile
  • agents/langgraph/react_agent/main.py
  • agents/langgraph/react_agent/pyproject.toml
  • agents/langgraph/react_with_database_memory/Makefile
  • agents/langgraph/react_with_database_memory/main.py
  • agents/langgraph/react_with_database_memory/pyproject.toml
  • agents/llamaindex/websearch_agent/Makefile
  • agents/llamaindex/websearch_agent/main.py
  • agents/vanilla_python/openai_responses_agent/Makefile
  • agents/vanilla_python/openai_responses_agent/main.py
  • agents/vanilla_python/openai_responses_agent/pyproject.toml
✅ Files skipped from review due to trivial changes (9)
  • agents/vanilla_python/openai_responses_agent/pyproject.toml
  • agents/autogen/mcp_agent/mcp_automl_template/pyproject.toml
  • agents/langgraph/react_with_database_memory/pyproject.toml
  • agents/autogen/mcp_agent/pyproject.toml
  • agents/langgraph/react_agent/pyproject.toml
  • agents/google/adk/pyproject.toml
  • agents/langgraph/human_in_the_loop/Makefile
  • agents/langgraph/agentic_rag/pyproject.toml
  • agents/langgraph/human_in_the_loop/main.py
🚧 Files skipped from review as they are similar to previous changes (12)
  • agents/google/adk/main.py
  • agents/langgraph/agentic_rag/main.py
  • agents/crewai/websearch_agent/Makefile
  • agents/vanilla_python/openai_responses_agent/Makefile
  • agents/google/adk/Makefile
  • agents/langgraph/react_agent/Makefile
  • agents/langgraph/react_with_database_memory/main.py
  • agents/vanilla_python/openai_responses_agent/main.py
  • agents/llamaindex/websearch_agent/Makefile
  • agents/llamaindex/websearch_agent/main.py
  • agents/crewai/websearch_agent/main.py
  • agents/langgraph/agentic_rag/Makefile

@andrewdonheiser

Copy link
Copy Markdown
Contributor

Looks good @tarun-etikala

@andrewdonheiser
andrewdonheiser self-requested a review April 21, 2026 19:13

@andrewdonheiser andrewdonheiser 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.

👍

@tarun-etikala
tarun-etikala merged commit d7ad2ce into red-hat-data-services:main Apr 21, 2026
1 check 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