Skip to content

fix(health): skip discarded dependency probes on the public health route (issue #316) [codex] - #462

Draft
PetrefiedThunder wants to merge 1 commit into
mainfrom
codex/grok-bot/amw-b007-i316
Draft

PetrefiedThunder wants to merge 1 commit into
mainfrom
codex/grok-bot/amw-b007-i316

Conversation

@PetrefiedThunder

Copy link
Copy Markdown
Collaborator

Fixes #316

Draft PR from the AMW fleet cohort, job amw-b007-i316. Merges only after green CI and a PASS from a different engine; this repo deploys to production on merge, so it also waits for C.Lee's deploy yes.

Job brief and acceptance criteria

Job AMW-B007: fix(health): skip discarded dependency probes on the public health route (issue #316)

Repo: agent-middleware
Area: gateway

Implement issue #316: the public health route runs dependency probes whose results are discarded. Skip them on the public route while keeping the detailed probe where it is used.

Acceptance criteria: Test proves the public route does not call the probes (mock the probe callables in the test only) and the response shape is unchanged; 'Fixes #316'.

Implementer report (codex)

The runtime fix already exists in 4151aaf3 (PR #317). Updated test_health_public_probes.py to verify all discarded probes remain uncalled, response parity is preserved, and detailed mode runs every probe. No protected files changed.

Gate commands run, with UV_CACHE_DIR="$PWD/.cache/uv":

uv run --directory gateway --no-project --isolated --python 3.12 --with-requirements requirements.txt --with-editable '../sdk/python[verify]' python -m pytest tests/test_health_public_probes.py tests/test_health_public_projection.py tests/test_health_dependencies.py tests/test_health_sim_parity.py tests/test_health_redis_liveness.py -q -rs --tb=short

uv run --no-project --isolated --python 3.12 --with-requirements gateway/requirements.txt --with-editable './sdk/python[verify,mcp]' python -m pytest sdk/python/tests -q -rs

uv run --directory gateway --no-project --isolated --with "ruff==$(sed -n 's/^ruff==//p' gateway/requirements-dev.txt)" ruff check .

uv run --directory gateway --no-project --isolated --with "ruff==$(sed -n 's/^ruff==//p' gateway/requirements-dev.txt)" ruff format --check .

uv run --directory gateway --no-project --isolated --python 3.12 --with-requirements requirements.txt --with-editable '../sdk/python[verify]' --with 'mypy==2.4.1' mypy app/

Results: 72 gateway tests passed, 485 SDK tests passed, Ruff passed, mypy passed across 214 files. Formatting passed after one correction. Restoring the old behavior in memory caused both regression cases to fail as expected; the subsequent file run passed all eight tests.

Changes remain uncommitted because the sandbox blocked Git’s index.lock. Operator follow-up: commit with sign-off, Fixes #316, and the required attribution trailer. Nothing pushed; no PR opened. Full gateway suite and builds were not run.

Branch: codex/grok-bot/amw-b007-i316.

Local gate re-run by the operator on the Mac

ruff gateway check rc=0 format rc=0
mypy rc=0 Success: no issues found in 214 source files
pytest(gateway changed tests) rc=0 8 passed, 2 warnings in 5.45s

Commits:

2ebdf1a7 fix(health): skip discarded dependency probes on the public health route (issue #316)

Cross engine review by a different engine is posted as a PR comment.

Generated by codex for grok-bot through grok-job (job amw-b007-i316).

…ute (issue #316)

Changes authored by codex in a headless grok-job run; committed by the operator.

Generated-by: codex (bot=grok-bot, job=amw-b007-i316)
Signed-off-by: PetrefiedThunder <131207452+PetrefiedThunder@users.noreply.github.com>
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agent-middleware-web Ready Ready Preview Dec 5, 2026 6:01am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Dec 5, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PetrefiedThunder

Copy link
Copy Markdown
Collaborator Author

Cross engine review (round 1): Claude Code, read only, of codex authored work, head 2ebdf1a.

VERDICT: PASS

The branch adds tests only (gateway/tests/test_health_public_probes.py, +63 lines); the route fix itself is already on main from #317 (4151aaf3). All 8 tests in the file pass locally on Python 3.12, including the three new cases. I did not run Ruff, mypy or the full gateway suite.

Acceptance criteria:

  • Probes not called on the public route: met. The new test mocks all eight _check_* callables in the test only, asserts the four public probes are awaited once and mqtt, stripe, llm and sentinel are never called.
  • Response shape unchanged: met. The body is compared to build_public_dependency_report(full) for both a healthy and a degraded public dependency.
  • Detailed probe kept: met. With ENABLE_PROOF_SURFACES=True every probe is awaited once.
  • 'Fixes Skip discarded dependency probes on the public health route #316': not verified, see item 1.

No fleet rule violations in the diff: no product code, user-facing copy, secrets, spec, deploy or publish changes, and the mocks are confined to the test file.

Non-blocking notes:

  1. Commit 2ebdf1a7: the message says "(issue Skip discarded dependency probes on the public health route #316)", not "Fixes Skip discarded dependency probes on the public health route #316". My gh access was denied, so I could not read the PR body. Fix: confirm the PR description contains the literal line Fixes #316.

  2. Commit 2ebdf1a7: the subject is fix(health): skip discarded dependency probes..., but the commit changes no product code. Fix: retitle to test(health): ..., and check whether Skip discarded dependency probes on the public health route #316 was already closed by Skip discarded dependency probes on the public health route #317, in which case this PR is follow-up coverage rather than the fix.

  3. gateway/tests/test_health_public_probes.py:189: the healthy assertion assumes process-global runtime degradation is clear, so a prior test that leaves it degraded would fail the up case. Fix: pin get_runtime_degradation in the dependency_probes fixture.

  4. Not checked: whether another open PR owns this test file (needs gh).

@PetrefiedThunder

Copy link
Copy Markdown
Collaborator Author

Cross engine review: kimi CLI (xeng fleet), read only, of codex's PR.

• I'll review PR #462 by examining the local git history and the diff against origin/main.

• Now let me verify the health module the tests patch, especially how the route resolves probe functions.

• The probe dict is built inside gather_dependency_report at call time, so monkeypatching module attributes will work. Now let me check the route handler to confirm how public vs detailed mode is wired.

• The route wiring matches the test's assumptions. Now let me check get_runtime_degradation since the new test asserts an exact overall status, which could be order-dependent if degradation state leaks between tests.

• Let me check conftest for autouse fixtures that reset degradation state, and look at how the runtime_degradation test file resets.

• Static trace looks sound. Now let me verify the implementer's claim that the runtime fix already exists on origin/main (commit 4151aaf / PR #317), making this PR legitimately test-only.

• Runtime fix confirmed on origin/main. One last robustness check: whether any test marks runtime degradation without resetting it, since the new test asserts an exact healthy status.

• Review complete. I examined the full diff, the health module, the route wiring, conftest fixtures, and the git history. Summary of what I verified:

Scope and context

Findings

  1. Mock seam is correct, not accidental. gather_dependency_report builds its probe dict from module globals at call time (gateway/app/core/health.py:567-576), so monkeypatch.setattr(health_module, "_check_*", probe) at gateway/tests/test_health_public_probes.py:159 intercepts exactly what the route awaits. All 8 probes are replaced; the discarded set {mqtt, stripe, llm, sentinel} at line 171 is the exact complement of PUBLIC_DEPENDENCY_KEYS (health.py:627-629).

  2. Real regression value. Reverting the route to a full gather_dependency_report() would trip probe.assert_not_called() (line 181). Call-count assertions (lines 177-181) correctly run before the parity recomputation at line 185, which awaits the public mocks a second time; ordering is right.

  3. "Response shape unchanged" is genuinely proven, not tautological: line 187 asserts the route body equals the projection of a full (pre-fix behavior) report with the same mocks, latency stripped on both sides. The status parametrization (line 188) matches the projection's recompute logic (health.py:657-666).

  4. No cross-test state leakage into the exact healthy/degraded assertion: both files that mark runtime degradation reset it (autouse fixture gateway/tests/test_runtime_degradation.py:27-31, try/finally in gateway/tests/test_core_db_qa.py:438-450). The detailed-mode test's ENABLE_PROOF_SURFACES flip (line 195) stacks on the fixture's patch with correct monkeypatch undo order.

  5. Operator gate re-run (ruff check/format, mypy, 8 passed on the changed file) is consistent with the file contents; test count matches (5 pre-existing + 2 parametrized + 1 new).

  6. Fleet rules: no em/en dashes or user-facing copy added; mocks and RuntimeError fault injection are test inputs, explicitly allowed by the real-data rule; single branch, single commit, sign-off present. Nit, non-blocking: the commit message says "(issue Skip discarded dependency probes on the public health route #316)" rather than "Fixes Skip discarded dependency probes on the public health route #316", but the keyword is in the PR body, which is what GitHub uses for auto-close.

No correctness, security, test-quality, or copy-rule issues found.

VERDICT: PASS

This branch was successfully deployed

1 active deployment
Preview — 2ebdf1a7 Deployed Dec 5, 2026 by vercel[bot]
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.

Skip discarded dependency probes on the public health route

1 participant