mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-27 17:58:07 +00:00
syncRepositoryIncrementally rewrote the entire transcript on every adapter snapshot: one addOrUpdateMessage per message, a second full export to find deletions, and an unconditional resetHead. During streaming that fires ~30x a second, so the per-delta cost scaled with how long the conversation already was — the reported symptom. Now that settled messages keep reference identity, an identity check is a sound "did this change?" test. Write only the items whose message or parentId moved, and skip resetHead when the head did not move (it prunes the head's descendants, so calling it needlessly is not free). Anything the fast path cannot prove safe — a disjoint session swap, a changed message count, an id with no repository entry — falls through to the original full rebuild. Tests cover the perf contract (one write for one delta, zero for a no-op) and the correctness cases the fast path must not break: appends, authoritative deletion, disjoint session replacement, branch re-parenting, and an explicit headId rewind. The two perf assertions fail on main. Co-authored-by: Jakub Wolniewicz <frizikk@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| bootstrap-installer | ||
| desktop | ||
| shared | ||