fix: cleanly shut down Honcho background workers#11680
Closed
KeroZelvin wants to merge 1 commit into
Closed
Conversation
Contributor
|
Thanks for the fix, @KeroZelvin! After reviewing against the current This is an automated hermes-sweeper review. Evidence:
The shutdown lifecycle this PR describes is fully operational on |
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.
Bug Description
Hermes could print a valid response and then abort during interpreter teardown in Honcho-enabled CLI runs. This was easiest to reproduce in short-lived one-shot commands like
hermes chat -q ....Root Cause
Hermes's Honcho integration started several daemon background threads for context prefetch, dialectic prefetch, sync, and async writes. During process shutdown, some of those workers could still be doing HTTP/SSL work while Python was already in
Py_FinalizeEx, leading to an abort after the response had already been returned.Fix
HonchoSessionManager.shutdown()instead of onlyflush_all()How to Verify
./venv/bin/python -m hermes_cli.main -p 273 chat -q "Reply with exactly OK"repeatedly in a Honcho-enabled profile.RC:0after printing the response instead of intermittently aborting with a coredump.Test Plan
Commands run:
./venv/bin/python -m pytest tests/honcho_plugin/test_async_memory.py tests/honcho_plugin/test_session.py -q./venv/bin/python -m py_compile plugins/memory/honcho/session.py plugins/memory/honcho/__init__.py tests/honcho_plugin/test_async_memory.pyRisk Assessment
Medium — this changes Honcho shutdown/lifecycle behavior, but the blast radius is limited to Hermes's Honcho integration and is covered by targeted regression tests.