Follow-up widening the archived-history fix to the sibling save paths the original PR did not cover. Model switches (_cmd_model, set_session_model) and _restore mint a fresh AIAgent with _session_db_created=False, so the agent-owns-persistence guard evaluates False and the blind full-history replace_messages() fired — DELETEing the durable active=0/compacted=1 rows on any compressed ACP session (same data-loss class the PR fixes, different trigger). - hermes_state.replace_messages: add active_only=True to delete/reinsert only the live (active=1) rows, leaving soft-archived rows untouched (idea adopted from the competing PR #50306 by @mrparker0980, credited). - hermes_state.has_archived_messages: cheap existence probe for active=0 rows. - acp_adapter._persist: when the agent doesn't own persistence but the session already has archived rows on disk, replace active-only; otherwise the destructive full replace stays (fresh create/fork has nothing to lose). - Regression test: model-switch save on a compacted session keeps the archived turn discoverable via get_messages(include_inactive=True) + search_messages. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_approval_isolation.py | ||
| test_auth.py | ||
| test_edit_approval.py | ||
| test_entry.py | ||
| test_events.py | ||
| test_mcp_e2e.py | ||
| test_permissions.py | ||
| test_ping_suppression.py | ||
| test_registry_manifest.py | ||
| test_server.py | ||
| test_session.py | ||
| test_session_db_private_access.py | ||
| test_session_provenance.py | ||
| test_tools.py | ||