23e44a2843
Follow-up for salvaged PRs #73400 + #73372: - Move _preserve_agent_history_on_shutdown logic into gateway/shutdown_flush.py as flush_agent_history_to_file() - Reuse the hardened _write_payload (atomic writes, fsync, private permissions, UUID filenames) from #73372 instead of the plain open()/write() from #73400 - Replace os.environ.get('HERMES_HOME') with get_hermes_home() for profile-safe path resolution - Update tests to test the real function directly - Net: removes 37 lines from gateway/run.py, unifies both fix paths in a single module with consistent atomic-write guarantees