Files
openchamber/packages
vhqtvnandvhqtvn 4f25c3009d fix(status): pick latest assistant message in single pass (#1297)
* fix(status): pick latest assistant message in single pass

Sync reconciliation can splice messages out of array order, so the
previous "filter + sort + last" pipeline could pick the wrong record
as the latest assistant message and surface a stale status.

Replace it with a single-pass scan that compares created-time (tiebreak
by id) — same selection, but resilient to non-sorted message arrays.

* refactor: use comparator + running max for latest assistant pick

Address Greptile review: collapse the dual-exit-point single-pass max
finder (separate continue + isNewer branches, repeated null checks)
into a single isLater(a, b) comparator with one running-max comparison
per iteration. Same selection rule, easier to verify.

---------

Co-authored-by: vhqtvn <8930337+vhqtvn@users.noreply.github.com>
2026-05-18 18:17:18 +03:00
..
2026-05-18 01:01:31 +03:00
2026-05-18 01:01:31 +03:00
2026-05-18 01:01:31 +03:00
2026-05-18 01:01:31 +03:00