The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): close the wrapper's stderr pipe in finally; hoist test imports (gate follow-up)
kshitijk4pooraa68a17aeb4c
diff --git a/hermes_cli/stderr_timestamp.py b/hermes_cli/stderr_timestamp.pyindex c45464521a9..7b194cd5490 100644--- a/hermes_cli/stderr_timestamp.py+++ b/hermes_cli/stderr_timestamp.py@@ -142,11 +142,11 @@ def main(argv: Sequence[str] | None = None) -> int:previous_handlers = _install_signal_forwarders(proc)try:_copy_stderr_with_timestamps(proc.stderr, log_path)- proc.stderr.close()# Keep forwarding until the child has actually exited: a signal that lands between# its stderr EOF and wait() would otherwise kill the wrapper with the default action.returncode = proc.wait()finally:+ proc.stderr.close()for signum, handler in previous_handlers.items():signal.signal(signum, handler)return _child_returncode_for_supervisor(args.command, returncode)diff --git a/tests/hermes_cli/test_stderr_timestamp.py b/tests/hermes_cli/test_stderr_timestamp.pyindex f375d6cff1f..c408aae608b 100644--- a/tests/hermes_cli/test_stderr_timestamp.py+++ b/tests/hermes_cli/test_stderr_timestamp.py@@ -1,7 +1,11 @@"""Tests for hermes_cli.stderr_timestamp."""+import osimport re+import signal+import subprocessimport sys+import timeimport pytest@@ -221,11 +225,6 @@ def test_wrapper_forwards_sigusr1_restart_request_to_child(tmp_path):drain-aware SIGUSR1 to the wrapper. It must reach the gateway child and the wrapper mustreport the child's planned exit code — not die of the signal itself (which makes launchdtreat the restart as a crash and apply its back-off to every sibling profile)."""- import os- import signal- import subprocess- import time-log_path = tmp_path / "gateway.error.log"ready = tmp_path / "ready"child = (