hermes-agent/apps
Brooklyn Nicholson adf47ca832 perf(desktop): reconcile only the messages that actually moved
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>
2026-07-26 02:56:08 -05:00
..
bootstrap-installer ci(js-tests): split check into parallel matrix shards per workspace (#70252) 2026-07-23 18:45:16 -04:00
desktop perf(desktop): reconcile only the messages that actually moved 2026-07-26 02:56:08 -05:00
shared ci(js-tests): split check into parallel matrix shards per workspace (#70252) 2026-07-23 18:45:16 -04:00