mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-25 18:52:39 +00:00
* Clear the committed timeline when an agent refresh rehydrates from disk Refreshing a loaded agent reloads it with `rehydrateFromDisk`, which wipes the in-memory timeline so provider history can be re-streamed. It left the committed timeline in place, and that is what `getTimelineRows` reads, so every refresh appended a second full copy of the history: N refreshes, N copies of every message. Wipe both timelines on that path, the way the force-hydrate path already does, so the re-streamed history replaces the old rows instead of stacking on them. * Replace the committed timeline from the replay instead of wiping it first Deleting the committed rows on the reload path meant a history replay that failed halfway left the agent with no transcript, and a retry appended a fresh replay to whatever partial rows it had written. Collect the whole replay before touching either store, then drop the rows a previous hydration committed and write the new ones. A failed stream now leaves the committed timeline exactly as it was, and this covers the replay that runs when an agent is loaded after a daemon restart, which duplicated the same way a refresh did. --------- Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>