Files
buzz/desktop/src-tauri
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 27aa3e0a8c fix(desktop): order retained agent events by the relay's own comparator
The retention cache resolved an equal-`created_at` collision by skipping the
inbound event unconditionally, while the relay breaks that tie by lowest event
id. The two could therefore disagree about which same-second event is the head,
and every later disk-vs-head compare inherited the error.

Retained rows now carry the event id as a real column so the local compare can
match `replace_parameterized_event`. A pending row still wins its tie
regardless of id: it is durable local intent, arbitrated against a
writer-consistent head by the boot pass rather than dropped by a cache compare.

The id is re-derived from a parsed and verified event, never read from the
JSON's self-asserted `id` field, so a legacy row whose bytes do not verify
stays unresolved instead of receiving a key it could win a tie with.

`RetainedEvent::pending`/`::inbound` replace the hand-built literals at every
call site, which makes it structurally impossible for a row's ordering key to
describe different bytes than its own `raw_event`.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-01 14:09:31 -04:00
..