fix(cli): suppress memory prefetch for single-query runs - #44353
fix(cli): suppress memory prefetch for single-query runs#44353hyper-factor wants to merge 1 commit into
Conversation
Avoid spawning post-turn memory prefetch work for non-interactive single-query CLI invocations. These processes exit immediately after printing the response, so prefetch threads can race interpreter shutdown and surface as SIGABRT/exit 134 despite a successful answer.
Positive verification: Suppress post-turn memory prefetch in single-query runsReviewed: cli.py signal handler, cli_agent_setup_mixin.py atexit cleanup. The fix is well-scoped: single-query non-interactive runs ( No findings. LGTM. |
|
Reviewed this PR — the |
|
Thanks for the focused shutdown investigation. This is now implemented on
Automated hermes-sweeper review. |
Summary
hermes chat -q/ quiet one-shot paths).Why
We reproduced a legitimate upstream bug:
hermes chat -qcan print the correct answer, then exit with SIGABRT / rc=134 when Honcho hybrid memory is enabled. The crash happens after successful output, which breaks automation/worker callers that rely on exit code.This overlaps with existing shutdown-related reports, but the open PRs I checked focus on
hermes -z, provider shutdown, or forced one-shot exit. This PR targets thechat -qpath by avoiding unnecessary prefetch work when there is no next turn to warm.Related
hermes chat -qsubprocesses #43186Test plan
uv run --with pytest --with pytest-asyncio python -m pytest -o addopts='' tests/cli/test_cli_active_agent_ref.py tests/agent/test_memory_post_turn_prefetch.py -q4 passedHERMES_HOME:HERMES_HOME=/tmp/hermes-home PYTHONFAULTHANDLER=1 .venv/bin/hermes chat -Q --toolsets safe -q 'Reply exactly: UPSTREAM_PR_OK'UPSTREAM_PR_OK, exit code0