compression_automation.py 1.2 KB

123456789101112131415161718192021
  1. """Carry automation at a compression boundary without opening worker storage."""
  2. def carry_compression_automation(agent, old_session_id):
  3. # In-process state, not a sidecar: the bot-to-bot chain moves on every store (#137027).
  4. from agent.bot_chain import carry_chain
  5. carry_chain(old_session_id, agent.session_id)
  6. from agent.runtime_session_store import RuntimeSessionStore
  7. if isinstance(agent._session_db, RuntimeSessionStore):
  8. # The owner moved these exact sidecars atomically with child publication.
  9. return
  10. from agent.conversation_compression import _swallow
  11. with _swallow('Could not migrate goal on compression: %s'):
  12. from hermes_cli.goals import migrate_goal_to_session
  13. migrate_goal_to_session(old_session_id, agent.session_id, reason='compression')
  14. with _swallow('Could not migrate heartbeat on compression: %s'):
  15. from hermes_cli.heartbeat import migrate_heartbeat_to_session
  16. migrate_heartbeat_to_session(old_session_id, agent.session_id)
  17. with _swallow('Could not migrate loop on compression: %s'):
  18. from hermes_cli.loops import migrate_loop_to_session
  19. migrate_loop_to_session(old_session_id, agent.session_id, reason='compression')