🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(acceptance): keep log order for review events written in the same millisecond (#22062)
Arvin Xuc43d09937d64
diff --git a/packages/utils/src/verify/localAcceptance.test.ts b/packages/utils/src/verify/localAcceptance.test.tsindex 4ac938498e0..ae063576f7c 100644--- a/packages/utils/src/verify/localAcceptance.test.ts+++ b/packages/utils/src/verify/localAcceptance.test.ts@@ -367,4 +367,20 @@ describe('mergeLocalReviewEvents', () => {const b: LocalReviewEvent = { ...a, createdAt: '2026-01-01T00:00:00.000Z', id: 'b' };expect(mergeLocalReviewEvents([a], [b, a]).map((event) => event.id)).toEqual(['b', 'a']);});++ it('keeps log order for events written in the same millisecond', () => {+ const checks: LocalReviewEvent = {+ category: 'A',+ comment: 'checks',+ createdAt: '2026-01-01T00:00:00.000Z',+ id: 'z-random',+ kind: 'group',+ roundIndex: 1,+ };+ const decision: LocalReviewEvent = { ...checks, comment: 'decision', id: 'a-random' };+ expect(mergeLocalReviewEvents([checks], [decision]).map((event) => event.id)).toEqual([+ 'z-random',+ 'a-random',+ ]);+ });});diff --git a/packages/utils/src/verify/localAcceptance.ts b/packages/utils/src/verify/localAcceptance.tsindex e8d53a8689a..d8aabd73381 100644--- a/packages/utils/src/verify/localAcceptance.ts+++ b/packages/utils/src/verify/localAcceptance.ts@@ -794,7 +794,7 @@ export const mergeLocalReviewEvents = (): LocalReviewEvent[] => {const byId = new Map<string, LocalReviewEvent>();for (const events of logs) for (const event of events ?? []) byId.set(event.id, event);- return [...byId.values()].sort(- (a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id),- );+ // Ids are random, so ties keep log order (sort is stable) — a decision written in the same+ // millisecond as the review before it must still come after it.+ return [...byId.values()].sort((a, b) => a.createdAt.localeCompare(b.createdAt));};