fix: commit context engine sessions on rotation - #22599
Closed
Tosko4 wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
CI note after first run:
The PR-local validation remains: |
Contributor
Author
Collaborator
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
commit_memory_session()now commits the active context engine as well as the memory manager when an agent session rotates without tearing providers down.The memory manager and context engine are handled independently, so a missing or failing memory provider no longer prevents a context engine from receiving
on_session_end(session_id, messages). This keeps plugin context engines able to flush their final transcript window before/new, TUI session close, or compression rollover moves to the next physical session.Fixes stephenschoettler/hermes-lcm#134
Why
Hermes Agent already notifies context engines during full shutdown through
shutdown_memory_provider(), but the lighter session-commit path only called the memory manager. That left context engines such as hermes-lcm without a final boundary callback on session rotation, which can skip final ingest or lifecycle finalization for messages that arrived after the last compression pass.Validation
Focused validation passed locally:
Related run-agent memory/compression checks also passed:
Additional checks:
Notes
This does not call
shutdown_all(). It preserves the existing lightweight commit behavior, but extends it to context engines so they see the same session boundary that memory providers already receive.