Improve external context engine plugin support#13370
Conversation
54f983f to
061a15b
Compare
stephenschoettler
left a comment
There was a problem hiding this comment.
Validated locally. This addresses the host-side context-engine lifecycle layer behind the #68 repro by making session boundaries explicit for external engines instead of reusing stale session state across /new, /resume, /branch, and rollover paths. I also ran the targeted plugin/session tests from the PR body locally; they passed.
061a15b to
c57cd99
Compare
c57cd99 to
ff6b05e
Compare
When _compress_context rotates session_id (compression split), fire on_session_start(new_sid, boundary_reason="compression", old_session_id=<old>) on the active context engine. Plugin engines (e.g. hermes-lcm) use this to preserve DAG lineage across the rollover instead of re-initializing fresh per-session state. Built-in ContextCompressor.on_session_start accepts **kwargs and ignores them — no behavior change for default users. Closes hermes-lcm#68 symptom: after Hermes compressed and minted a new physical session, LCM was treating the split as a fresh /new and losing continuity (compression_count: 1, store_messages: 0, dag_nodes: 0). Credit: @Tosko4 (PR #13370) — minimized scope to the boundary_reason signal only; the broader session-lifecycle refactor will be taken in separate PRs if justified by concrete plugin need.
|
Closing in favor of #16306, which is merged to main as commit e85b752 with your authorship preserved. We salvaged the core hermes-lcm#68 fix — the The rest of #13370 (new Thanks for the fix and for driving the hermes-lcm#68 repro. |
When _compress_context rotates session_id (compression split), fire on_session_start(new_sid, boundary_reason="compression", old_session_id=<old>) on the active context engine. Plugin engines (e.g. hermes-lcm) use this to preserve DAG lineage across the rollover instead of re-initializing fresh per-session state. Built-in ContextCompressor.on_session_start accepts **kwargs and ignores them — no behavior change for default users. Closes hermes-lcm#68 symptom: after Hermes compressed and minted a new physical session, LCM was treating the split as a fresh /new and losing continuity (compression_count: 1, store_messages: 0, dag_nodes: 0). Credit: @Tosko4 (PR NousResearch#13370) — minimized scope to the boundary_reason signal only; the broader session-lifecycle refactor will be taken in separate PRs if justified by concrete plugin need.
When _compress_context rotates session_id (compression split), fire on_session_start(new_sid, boundary_reason="compression", old_session_id=<old>) on the active context engine. Plugin engines (e.g. hermes-lcm) use this to preserve DAG lineage across the rollover instead of re-initializing fresh per-session state. Built-in ContextCompressor.on_session_start accepts **kwargs and ignores them — no behavior change for default users. Closes hermes-lcm#68 symptom: after Hermes compressed and minted a new physical session, LCM was treating the split as a fresh /new and losing continuity (compression_count: 1, store_messages: 0, dag_nodes: 0). Credit: @Tosko4 (PR NousResearch#13370) — minimized scope to the boundary_reason signal only; the broader session-lifecycle refactor will be taken in separate PRs if justified by concrete plugin need.
When _compress_context rotates session_id (compression split), fire on_session_start(new_sid, boundary_reason="compression", old_session_id=<old>) on the active context engine. Plugin engines (e.g. hermes-lcm) use this to preserve DAG lineage across the rollover instead of re-initializing fresh per-session state. Built-in ContextCompressor.on_session_start accepts **kwargs and ignores them — no behavior change for default users. Closes hermes-lcm#68 symptom: after Hermes compressed and minted a new physical session, LCM was treating the split as a fresh /new and losing continuity (compression_count: 1, store_messages: 0, dag_nodes: 0). Credit: @Tosko4 (PR NousResearch#13370) — minimized scope to the boundary_reason signal only; the broader session-lifecycle refactor will be taken in separate PRs if justified by concrete plugin need.
When _compress_context rotates session_id (compression split), fire on_session_start(new_sid, boundary_reason="compression", old_session_id=<old>) on the active context engine. Plugin engines (e.g. hermes-lcm) use this to preserve DAG lineage across the rollover instead of re-initializing fresh per-session state. Built-in ContextCompressor.on_session_start accepts **kwargs and ignores them — no behavior change for default users. Closes hermes-lcm#68 symptom: after Hermes compressed and minted a new physical session, LCM was treating the split as a fresh /new and losing continuity (compression_count: 1, store_messages: 0, dag_nodes: 0). Credit: @Tosko4 (PR NousResearch#13370) — minimized scope to the boundary_reason signal only; the broader session-lifecycle refactor will be taken in separate PRs if justified by concrete plugin need.
When _compress_context rotates session_id (compression split), fire on_session_start(new_sid, boundary_reason="compression", old_session_id=<old>) on the active context engine. Plugin engines (e.g. hermes-lcm) use this to preserve DAG lineage across the rollover instead of re-initializing fresh per-session state. Built-in ContextCompressor.on_session_start accepts **kwargs and ignores them — no behavior change for default users. Closes hermes-lcm#68 symptom: after Hermes compressed and minted a new physical session, LCM was treating the split as a fresh /new and losing continuity (compression_count: 1, store_messages: 0, dag_nodes: 0). Credit: @Tosko4 (PR NousResearch#13370) — minimized scope to the boundary_reason signal only; the broader session-lifecycle refactor will be taken in separate PRs if justified by concrete plugin need.
When _compress_context rotates session_id (compression split), fire on_session_start(new_sid, boundary_reason="compression", old_session_id=<old>) on the active context engine. Plugin engines (e.g. hermes-lcm) use this to preserve DAG lineage across the rollover instead of re-initializing fresh per-session state. Built-in ContextCompressor.on_session_start accepts **kwargs and ignores them — no behavior change for default users. Closes hermes-lcm#68 symptom: after Hermes compressed and minted a new physical session, LCM was treating the split as a fresh /new and losing continuity (compression_count: 1, store_messages: 0, dag_nodes: 0). Credit: @Tosko4 (PR NousResearch#13370) — minimized scope to the boundary_reason signal only; the broader session-lifecycle refactor will be taken in separate PRs if justified by concrete plugin need.
Supersedes closed PR #8416. The original PR became unreopenable after the source fork disappeared; this recreates the same branch on the restored fork.
Summary
context.engineexplicitly selects something elseWhat changed
context.engineexplicitly asks for one/new,/resume, and/branch/compress <focus>backward-compatible with engines that do not accept afocus_topicargumenthermes pluginsso it can be selected from the provider UINon-goals
hermes-lcmplugins/context_engine/Validation
Passed:
python -m pytest tests/run_agent/test_context_engine_plugin_init.py tests/run_agent/test_session_reset_fix.py tests/cli/test_cli_new_session.py tests/hermes_cli/test_plugins_cmd.py tests/agent/test_context_engine.py -q93 passedThat slice includes explicit coverage for: