Skip to content

fix: throttle repeated readiness failure logs - #785

Open
ibrahimmaq14 wants to merge 1 commit into
OpenHands:mainfrom
ibrahimmaq14:fix/597-readiness-log-throttling
Open

ibrahimmaq14 wants to merge 1 commit into
OpenHands:mainfrom
ibrahimmaq14:fix/597-readiness-log-throttling

Conversation

@ibrahimmaq14

@ibrahimmaq14 ibrahimmaq14 commented Nov 21, 2026 •

Copy link
Copy Markdown

Fixes #597

Reproduction and root cause

Run uv run --frozen python -m pytest -q tests/test_health.py with the regression test applied to the original handler. Three requests across /ready and /api/automation/ready each returned the expected 503 JSON and emitted an ERROR with a full traceback. The test expected one ERROR and found three. The handler previously logged every connection exception unconditionally.

Fix

Remember the last exception type and message in app state and log a full traceback when the failure changes. After a successful connection, clear the state and emit one INFO recovery log. State updates run without an await after the connection check. Both readiness routes continue to check the database on every probe and return the same 200 and 503 responses.

Verification

  • Before the fix: 1 failed, 9 passed in tests/test_health.py.
  • After the fix: 11 passed in tests/test_health.py on Python 3.12.15 (Windows).
  • uv run --frozen ruff check: passed.
  • uv run --frozen ruff format --check: 269 files already formatted.
  • uv run --frozen pyright --pythonplatform Linux: 0 errors, 0 warnings, 0 informations.
  • Linux uv run --frozen pre-commit run --all-files --show-diff-on-failure: all five hooks passed. Whole-project Linux Pyright also reported 0 errors, warnings, or infos.
  • Windows CI test selection (tests/test_windows_runner.py, tests/test_execution.py, tests/test_preset_runner_refresh.py, tests/test_plugin_specs.py): 105 passed, 26 skipped.
  • Full Linux run with the CI coverage threshold: 3,489 passed, 8 skipped, 13 failed, 1 setup error. The failures came from Node missing from PATH and a Bash wrapper exported with Windows line endings. PostgreSQL fixture setup timed out once.
  • Clean Linux rerun of tests/test_health.py, tests/test_pr_artifacts_workflow.py, tests/test_verify_automation_skill.py, and tests/test_git_sync_router.py::TestGitSyncCheckAgainstARealRepo with Node available and LF checkout: 75 passed. This rerun covered every failing or errored test from the full Linux run.
  • Full native Windows run: 3,284 passed, 113 skipped, 18 failed, 101 errors, including Git subprocess setup failures and platform-dependent tests. All 11 readiness tests passed.
  • Initial GitHub checks: description, title validation and labeling, and artifact checks passed. Run tests, ci, and Docker require maintainer approval for the fork.

AI disclosure: Codex assisted with issue research, reproduction, implementation, testing, and drafting this PR on behalf of the contributor.

Jev-Fast-Audit

⚡ Jev fast audit · estimates · 0.23s · commit 3594bca
Strongest signal: No primary concern selected.
Evidence: No primary concern to locate.
Coverage: complete supplied coverage; 5/5 hunks, 2/2 files.

All estimates and evidence
Estimate Likelihood / value Direct evidence
SQL injection 3.0% No direct hunk selected
Command injection 3.0% No direct hunk selected
Weakened authentication 3.0% No direct hunk selected
Weakened authorization 4.0% No direct hunk selected
Contract regression 9.0% No direct hunk selected
Data loss 3.0% No direct hunk selected
Sensitive data disclosure 4.0% No direct hunk selected
Unexpected data transfer 3.0% No direct hunk selected
Credential misuse 4.0% No direct hunk selected
Untrusted instruction authority 2.0% No direct hunk selected
Package source redirection 4.0% No direct hunk selected
Unverified remote execution 2.0% No direct hunk selected
Privileged environment access 2.0% No direct hunk selected
Security assessment bypass 3.0% No direct hunk selected
Prohibited workload 2.0% No direct hunk selected
Primary concern None selected; confidence 87.0% No primary concern to locate

@github-actions github-actions Bot added the type: fix A bug fix label Nov 21, 2026
@ibrahimmaq14
ibrahimmaq14 marked this pull request as ready for review November 24, 2026 10:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Readiness endpoint logs an exception on every failed probe; throttle repeated identical readiness failures

1 participant