fix: add timeout to subprocess calls in context_references (salvage #3380) - #3469
Merged
Conversation
_expand_git_reference() and _rg_files() called subprocess.run() without a timeout. On a large repository, @diff, @StaGeD, or @git:N references could hang the agent indefinitely while git or ripgrep processes slow output. - Add timeout=30 to git subprocess in _expand_git_reference() with a user-friendly error message on TimeoutExpired - Add timeout=10 to rg subprocess in _rg_files() returning None on timeout (falls back to os.walk folder listing)
23 tasks
dlkakbs
added a commit
to dlkakbs/hermes-agent
that referenced
this pull request
Mar 29, 2026
All subprocess.run() calls in hermes_cli/gateway.py lacked a timeout parameter. If systemctl, launchctl, loginctl, wmic, or ps blocks (e.g. D-Bus unavailable, WMI service stuck, launchd unresponsive), hermes gateway start/stop/restart/status/install/uninstall hangs indefinitely with no feedback to the user. Timeout values applied: - Lifecycle commands (start/stop/restart/enable/disable/daemon-reload, launchctl load/unload): timeout=30 - Status/query commands (is-active, loginctl show-user, launchctl list, systemctl status, journalctl, tail, ps aux, wmic): timeout=5-10 - loginctl enable-linger: timeout=10 For _is_service_running() and launchd_status(), TimeoutExpired is caught explicitly and treated as not-running, matching how non-zero return codes are already handled. All other call sites are either inside existing try/except Exception blocks (find_gateway_pids, _enable_systemd_linger, get_systemd_linger_status) or raise TimeoutExpired as a clear error instead of hanging forever. Same class of fix as NousResearch#3469 (context_references) and NousResearch#3693 (doctor/status).
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…rch#3469) _expand_git_reference() and _rg_files() called subprocess.run() without a timeout. On a large repository, @diff, @StaGeD, or @git:N references could hang the agent indefinitely while git or ripgrep processes slow output. - Add timeout=30 to git subprocess in _expand_git_reference() with a user-friendly error message on TimeoutExpired - Add timeout=10 to rg subprocess in _rg_files() returning None on timeout (falls back to os.walk folder listing) Co-authored-by: memosr.eth <96793918+memosr@users.noreply.github.com>
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…rch#3469) _expand_git_reference() and _rg_files() called subprocess.run() without a timeout. On a large repository, @diff, @StaGeD, or @git:N references could hang the agent indefinitely while git or ripgrep processes slow output. - Add timeout=30 to git subprocess in _expand_git_reference() with a user-friendly error message on TimeoutExpired - Add timeout=10 to rg subprocess in _rg_files() returning None on timeout (falls back to os.walk folder listing) Co-authored-by: memosr.eth <96793918+memosr@users.noreply.github.com>
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…rch#3469) _expand_git_reference() and _rg_files() called subprocess.run() without a timeout. On a large repository, @diff, @StaGeD, or @git:N references could hang the agent indefinitely while git or ripgrep processes slow output. - Add timeout=30 to git subprocess in _expand_git_reference() with a user-friendly error message on TimeoutExpired - Add timeout=10 to rg subprocess in _rg_files() returning None on timeout (falls back to os.walk folder listing) Co-authored-by: memosr.eth <96793918+memosr@users.noreply.github.com>
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…rch#3469) _expand_git_reference() and _rg_files() called subprocess.run() without a timeout. On a large repository, @diff, @StaGeD, or @git:N references could hang the agent indefinitely while git or ripgrep processes slow output. - Add timeout=30 to git subprocess in _expand_git_reference() with a user-friendly error message on TimeoutExpired - Add timeout=10 to rg subprocess in _rg_files() returning None on timeout (falls back to os.walk folder listing) Co-authored-by: memosr.eth <96793918+memosr@users.noreply.github.com>
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.
Salvage of #3380 by @memosr. Cherry-picked clean, no modifications needed.
_expand_git_reference()and_rg_files()callsubprocess.run()without a timeout. On large repos,@diff,@staged,@git:N, or@folder:references could hang the agent indefinitely.timeout=30for git subprocess, returns user-friendly error on TimeoutExpiredtimeout=10for rg subprocess, returns None to trigger os.walk fallbackCloses #3380.