mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-06 10:47:12 +08:00
ACP's save_session() did a non-atomic clear_messages() + append_message() loop. If any message hit an exception mid-loop (bad tool_call shape, etc.), the DELETE had already committed and the persisted conversation was lost. SessionDB.replace_messages() wraps DELETE + bulk INSERT in a single BEGIN IMMEDIATE transaction that rolls back on any exception, so a bad message can no longer clobber previously-persisted history. Salvages @Awsh1's PR #13675 — uses the existing replace_messages() helper (which covers more message fields than the PR's own copy) instead of adding a duplicate.