fix(dashboard): cache gateway PID status probes - #53511
Closed
0disoft wants to merge 1 commit into
Closed
Conversation
tonydwb
approved these changes
Jun 27, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Adds file-change-based caching for get_running_pid() dashboard polling. Uses threading.Lock for thread safety, file stat signatures (mtime_ns, size) for cache invalidation, and a 1-second TTL. Properly clears cache on PID file writes, lock acquisition/release, and stale cleanup. Includes thorough tests.
Reviewed by Hermes Agent
liuhao1024
pushed a commit
to liuhao1024/hermes-agent
that referenced
this pull request
Jul 8, 2026
liuhao1024
pushed a commit
to liuhao1024/hermes-agent
that referenced
this pull request
Jul 8, 2026
…ests get_status now probes via get_running_pid_cached() (NousResearch#53511 salvage); these tests were added on main after that PR was cut and still patched web_server.get_running_pid, so their fakes were bypassed and CI slice 5/8 failed. Patch the name the handler actually calls.
Collaborator
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…ests get_status now probes via get_running_pid_cached() (NousResearch#53511 salvage); these tests were added on main after that PR was cut and still patched web_server.get_running_pid, so their fakes were bypassed and CI slice 5/8 failed. Patch the name the handler actually calls.
justemu
pushed a commit
to justemu/hermes-agent
that referenced
this pull request
Jul 18, 2026
justemu
pushed a commit
to justemu/hermes-agent
that referenced
this pull request
Jul 18, 2026
…ests get_status now probes via get_running_pid_cached() (NousResearch#53511 salvage); these tests were added on main after that PR was cut and still patched web_server.get_running_pid, so their fakes were bypassed and CI slice 5/8 failed. Patch the name the handler actually calls.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…ests get_status now probes via get_running_pid_cached() (NousResearch#53511 salvage); these tests were added on main after that PR was cut and still patched web_server.get_running_pid, so their fakes were bypassed and CI slice 5/8 failed. Patch the name the handler actually calls.
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…ests get_status now probes via get_running_pid_cached() (NousResearch#53511 salvage); these tests were added on main after that PR was cut and still patched web_server.get_running_pid, so their fakes were bypassed and CI slice 5/8 failed. Patch the name the handler actually calls.
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…ests get_status now probes via get_running_pid_cached() (NousResearch#53511 salvage); these tests were added on main after that PR was cut and still patched web_server.get_running_pid, so their fakes were bypassed and CI slice 5/8 failed. Patch the name the handler actually calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_running_pid()for read-only dashboard/status polling./api/statusso high-frequency dashboard polling does not repeatedly open and lockgateway.lock.Root cause
/api/statuscalledget_running_pid()on every request. That path checksis_gateway_runtime_lock_active(), which opensgateway.lockand probes the advisory lock each time. Under active dashboard polling this churns file descriptors and can hitOSError: [Errno 24] Too many open filesin the dashboard process.Validation
bash scripts/run_tests.sh tests/gateway/test_status.py tests/hermes_cli/test_web_server.pycould not start on this Windows host due to the local Bash/CallMsiREGDB_E_CLASSNOTREGlauncher error..\.venv\Scripts\python.exe -m pytest tests/gateway/test_status.py::TestGatewayPidState -q->15 passed.\.venv\Scripts\python.exe -m pytest tests/hermes_cli/test_web_server.py::TestWebServerEndpoints tests/hermes_cli/test_web_server.py::TestStatusRemoteGateway tests/hermes_cli/test_web_server.py::TestGatewayBusyReadout -q->136 passed, 4 warningsruff check gateway/status.py hermes_cli/web_server.py tests/gateway/test_status.py tests/hermes_cli/test_web_server.py-> passedgit diff --check-> passed, with CRLF conversion warnings onlyI also ran the full
tests/gateway/test_status.pyfile directly on Windows. It now has86 passed, 3 failed; the remaining failures are pre-existing Windows/local-environment failures unrelated to this PR (sleepexecutable missing for two process-start-time tests, plus an existing Windows path/cmdline assertion intest_runtime_status_running_pid_accepts_matching_profile_cmdline).Fixes #53484