feat: add bounded compression handoff#29293
Open
stefanpieter wants to merge 1 commit into
Open
Conversation
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.
Summary
Fixes #20372.
Adds an opt-in, bounded auto-handoff path for long Hermes sessions that have been compressed repeatedly:
agent.auto_handoff_on_compressionconfig withenabled,after_compressions,max_auto_handoffs,mode, andhandoff_artifact_dirmode: prompt_userto write a packet while preserving ordinary compression semanticsmode: fresh_sessionto continue from a linked fresh session only after successful DB-backed rotationmax_auto_handoffsHERMES_HOME/handoff-packet [note]for manual packet creation without switching sessionsSafety / behavior notes
prompt_usermode keeps the normalcompressionend reason and context-engine boundary.fresh_sessiononly writes the artifact, increments the handoff count, resets compressor/plugin state, and replaces active context after a child session has been created successfully.Test plan
python -m py_compile agent/conversation_compression.py agent/agent_init.py cli.py hermes_cli/commands.py hermes_cli/config.py hermes_cli/web_server.py run_agent.py tests/run_agent/test_auto_handoff_on_compression.pypython -m pytest -o 'addopts=' tests/run_agent/test_auto_handoff_on_compression.py -q— 10 passedpython -m pytest -o 'addopts=' tests/run_agent/test_compress_focus_plugin_fallback.py tests/run_agent/test_session_reset_fix.py tests/run_agent/test_compression_feasibility.py tests/run_agent/test_413_compression.py -q— 36 passedpython -m pytest -o 'addopts=' tests/hermes_cli/test_web_server.py -k 'config or schema' -q— 25 passed, 120 deselectedgit diff --checkruff check agent/conversation_compression.py agent/agent_init.py cli.py hermes_cli/commands.py hermes_cli/config.py hermes_cli/web_server.py run_agent.py tests/run_agent/test_auto_handoff_on_compression.py