Files
hermes-agent/tools
liuhao1024 15485e0c8d fix(browser): capture real-profile agent-browser CLI output via temp files, not pipes
Rebase of the #96731 fix onto the post-split layout: the call sites moved
from tools/browser_tool.py to tools/browser_tool_real_profile.py
(_agent_browser_session_cmd and the attach open).

The CLI forks a resident daemon that inherits its stdio and outlives the
CLI. With pipe capture the CLI can exit while its output never reaches
EOF: POSIX burns the whole 15s timeout draining pipes on every call, and
Windows' TimeoutExpired cleanup re-drains unbounded, blocking past the
outer tool deadline (#96731). Reuse _popen_agent_browser (the pattern
_run_browser_command already established) instead of adding a second
mechanism: wait for the CLI alone; a grandchild holding inherited file
handles is harmless.

TimeoutExpired semantics are preserved for both callers (session_cmd ->
None + debug log, attach -> the took-too-long message), and the daemon
env (reaper-visible socket dir, owner_pid claim, no idle timeout) is now
built once per capture inside the shared helper.
2026-10-02 22:54:53 -05:00
..
…